Check neutron agent extension support in Info page
Some neutron plugin don't support agent extension, and Horizon show 404 error on admin info page. In this commit, we are going to add check if agent extension supported or not. Closes-bug: 1331032 Change-Id: I5cd3ec747c650fc2b826d55f39be618eca1b7caa
This commit is contained in:
parent
3a9d465830
commit
5179d99800
openstack_dashboard
@ -859,6 +859,10 @@ def is_security_group_extension_supported(request):
|
||||
return is_extension_supported(request, 'security-group')
|
||||
|
||||
|
||||
def is_agent_extension_supported(request):
|
||||
return is_extension_supported(request, 'agent')
|
||||
|
||||
|
||||
# Using this mechanism till a better plugin/sub-plugin detection
|
||||
# mechanism is available.
|
||||
# Using local_settings to detect if the "router" dashboard
|
||||
|
@ -85,7 +85,8 @@ class NetworkAgentsTab(tabs.TableTab):
|
||||
template_name = constants.INFO_DETAIL_TEMPLATE_NAME
|
||||
|
||||
def allowed(self, request):
|
||||
return base.is_service_enabled(request, 'network')
|
||||
return (base.is_service_enabled(request, 'network') and
|
||||
neutron.is_agent_extension_supported(request))
|
||||
|
||||
def get_network_agents_data(self):
|
||||
try:
|
||||
|
@ -32,6 +32,8 @@ class SystemInfoViewTests(test.BaseAdminViewTests):
|
||||
def test_index(self):
|
||||
services = self.services.list()
|
||||
api.nova.service_list(IsA(http.HttpRequest)).AndReturn(services)
|
||||
api.neutron.is_extension_supported(IsA(http.HttpRequest),
|
||||
'agent').AndReturn(True)
|
||||
agents = self.agents.list()
|
||||
api.neutron.agent_list(IsA(http.HttpRequest)).AndReturn(agents)
|
||||
|
||||
@ -83,6 +85,8 @@ class SystemInfoViewTests(test.BaseAdminViewTests):
|
||||
.MultipleTimes().AndReturn(True)
|
||||
api.nova.default_quota_get(IsA(http.HttpRequest),
|
||||
IgnoreArg()).AndReturn({})
|
||||
api.neutron.is_extension_supported(IsA(http.HttpRequest),
|
||||
'agent').AndReturn(True)
|
||||
api.neutron.is_extension_supported(IsA(http.HttpRequest),
|
||||
'security-group').AndReturn(True)
|
||||
|
||||
@ -128,9 +132,12 @@ class SystemInfoViewTests(test.BaseAdminViewTests):
|
||||
|
||||
if neutron_enabled:
|
||||
self.mox.StubOutWithMock(api.neutron, 'agent_list')
|
||||
self.mox.StubOutWithMock(api.neutron, 'is_extension_supported')
|
||||
api.neutron.is_extension_supported(IsA(http.HttpRequest),
|
||||
'agent').AndReturn(True)
|
||||
|
||||
api.neutron.agent_list(IsA(http.HttpRequest)).AndReturn([])
|
||||
|
||||
self.mox.StubOutWithMock(api.neutron, 'is_extension_supported')
|
||||
api.neutron.is_extension_supported(IsA(http.HttpRequest),
|
||||
'security-group').AndReturn(neutron_sg_enabled)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user