Horizon GUI disconnects during subcloud actions
Currently after an unlock is executed and the horizon page is refreshed, the subcloud system list is retrieved. If there is only one subcloud controller an exception is thrown since there is no connectivity. This change catches the exception and redirects to RegionOne where central system controllers will be listed Closes-Bug: 1939313 Signed-off-by: Jose Infanzon <jose.infanzon@windriver.com> Change-Id: Ifc098ff4f20ebef83674f2fa63ed436167dfbc0c
This commit is contained in:
parent
77cd1cd052
commit
e402a6b08a
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from cgtsclient import exc
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
@ -225,16 +227,16 @@ class CpuProfilesTab(tabs.TableTab):
|
||||||
return cpuprofiles
|
return cpuprofiles
|
||||||
|
|
||||||
def allowed(self, request, datum=None):
|
def allowed(self, request, datum=None):
|
||||||
# TypeError is being catched since in a DC environment
|
# TypeError and CommunicationError are being catched since in
|
||||||
# with one subcloud controller, when an unlock action is executed
|
# a DC environment with one subcloud controller, when an unlock
|
||||||
# and page refreshed the api function system_list,
|
# action is executed and page refreshed the api function system_list,
|
||||||
# tries to iterate through the subcloud hosts.
|
# tries to iterate through the subcloud hosts.
|
||||||
# If the exception is caught, user is redirected to
|
# If the exception is caught, user is redirected to
|
||||||
# System controller and have visibility of the subcloud
|
# System controller and have visibility of the subcloud
|
||||||
# status.
|
# status.
|
||||||
try:
|
try:
|
||||||
return not stx_api.sysinv.is_system_mode_simplex(request)
|
return not stx_api.sysinv.is_system_mode_simplex(request)
|
||||||
except TypeError:
|
except (TypeError, exc.CommunicationError):
|
||||||
if(getattr(settings, 'DC_MODE', False)):
|
if(getattr(settings, 'DC_MODE', False)):
|
||||||
failure_url = "/auth/switch_services_region/" \
|
failure_url = "/auth/switch_services_region/" \
|
||||||
"SystemController/?next=/dc_admin/"
|
"SystemController/?next=/dc_admin/"
|
||||||
|
@ -262,16 +264,16 @@ class InterfaceProfilesTab(tabs.TableTab):
|
||||||
return interfaceprofiles
|
return interfaceprofiles
|
||||||
|
|
||||||
def allowed(self, request, dataum=None):
|
def allowed(self, request, dataum=None):
|
||||||
# TypeError is being catched since in a DC environment
|
# TypeError and CommunicationError are being catched since in
|
||||||
# with one subcloud controller, when an unlock action is executed
|
# a DC environment with one subcloud controller, when an unlock
|
||||||
# and page refreshed the api function system_list,
|
# action is executed and page refreshed the api function system_list,
|
||||||
# tries to iterate through the subcloud hosts.
|
# tries to iterate through the subcloud hosts.
|
||||||
# If the exception is caught, user is redirected to
|
# If the exception is caught, user is redirected to
|
||||||
# System controller and have visibility of the subcloud
|
# System controller and have visibility of the subcloud
|
||||||
# status.
|
# status.
|
||||||
try:
|
try:
|
||||||
return not stx_api.sysinv.is_system_mode_simplex(request)
|
return not stx_api.sysinv.is_system_mode_simplex(request)
|
||||||
except TypeError:
|
except (TypeError, exc.CommunicationError):
|
||||||
if(getattr(settings, 'DC_MODE', False)):
|
if(getattr(settings, 'DC_MODE', False)):
|
||||||
failure_url = "/auth/switch_services_region/" \
|
failure_url = "/auth/switch_services_region/" \
|
||||||
"SystemController/?next=/dc_admin/"
|
"SystemController/?next=/dc_admin/"
|
||||||
|
@ -315,16 +317,16 @@ class DiskProfilesTab(tabs.TableTab):
|
||||||
return diskprofiles
|
return diskprofiles
|
||||||
|
|
||||||
def allowed(self, request, dataum=None):
|
def allowed(self, request, dataum=None):
|
||||||
# TypeError is being catched since in a DC environment
|
# TypeError and CommunicationError are being catched since in
|
||||||
# with one subcloud controller, when an unlock action is executed
|
# a DC environment with one subcloud controller, when an unlock
|
||||||
# and page refreshed the api function system_list,
|
# action is executed and page refreshed the api function system_list,
|
||||||
# tries to iterate through the subcloud hosts.
|
# tries to iterate through the subcloud hosts.
|
||||||
# If the exception is caught, user is redirected to
|
# If the exception is caught, user is redirected to
|
||||||
# System controller and have visibility of the subcloud
|
# System controller and have visibility of the subcloud
|
||||||
# status.
|
# status.
|
||||||
try:
|
try:
|
||||||
return not stx_api.sysinv.is_system_mode_simplex(request)
|
return not stx_api.sysinv.is_system_mode_simplex(request)
|
||||||
except TypeError:
|
except (TypeError, exc.CommunicationError):
|
||||||
if(getattr(settings, 'DC_MODE', False)):
|
if(getattr(settings, 'DC_MODE', False)):
|
||||||
failure_url = "/auth/switch_services_region/" \
|
failure_url = "/auth/switch_services_region/" \
|
||||||
"SystemController/?next=/dc_admin/"
|
"SystemController/?next=/dc_admin/"
|
||||||
|
@ -351,16 +353,16 @@ class MemoryProfilesTab(tabs.TableTab):
|
||||||
return memoryprofiles
|
return memoryprofiles
|
||||||
|
|
||||||
def allowed(self, request, dataum=None):
|
def allowed(self, request, dataum=None):
|
||||||
# TypeError is being catched since in a DC environment
|
# TypeError and CommunicationError are being catched since in
|
||||||
# with one subcloud controller, when an unlock action is executed
|
# a DC environment with one subcloud controller, when an unlock
|
||||||
# and page refreshed the api function system_list,
|
# action is executed and page refreshed the api function system_list,
|
||||||
# tries to iterate through the subcloud hosts.
|
# tries to iterate through the subcloud hosts.
|
||||||
# If the exception is caught, user is redirected to
|
# If the exception is caught, user is redirected to
|
||||||
# System controller and have visibility of the subcloud
|
# System controller and have visibility of the subcloud
|
||||||
# status.
|
# status.
|
||||||
try:
|
try:
|
||||||
return not stx_api.sysinv.is_system_mode_simplex(request)
|
return not stx_api.sysinv.is_system_mode_simplex(request)
|
||||||
except TypeError:
|
except (TypeError, exc.CommunicationError):
|
||||||
if(getattr(settings, 'DC_MODE', False)):
|
if(getattr(settings, 'DC_MODE', False)):
|
||||||
failure_url = "/auth/switch_services_region/" \
|
failure_url = "/auth/switch_services_region/" \
|
||||||
"SystemController/?next=/dc_admin/"
|
"SystemController/?next=/dc_admin/"
|
||||||
|
|
Loading…
Reference in New Issue