diff --git a/openstack_dashboard/api/neutron.py b/openstack_dashboard/api/neutron.py index cdd0c4072..3ca9f77ea 100644 --- a/openstack_dashboard/api/neutron.py +++ b/openstack_dashboard/api/neutron.py @@ -1058,6 +1058,12 @@ def list_dhcp_agent_hosting_networks(request, network, **params): return [Agent(a) for a in agents['agents']] +def list_l3_agent_hosting_router(request, router, **params): + agents = neutronclient(request).list_l3_agent_hosting_routers(router, + **params) + return [Agent(a) for a in agents['agents']] + + def add_network_to_dhcp_agent(request, dhcp_agent, network_id): body = {'network_id': network_id} return neutronclient(request).add_network_to_dhcp_agent(dhcp_agent, body) diff --git a/openstack_dashboard/dashboards/admin/routers/tests.py b/openstack_dashboard/dashboards/admin/routers/tests.py index 7ee8772f2..39a0c9654 100644 --- a/openstack_dashboard/dashboards/admin/routers/tests.py +++ b/openstack_dashboard/dashboards/admin/routers/tests.py @@ -28,6 +28,11 @@ class RouterTests(test.BaseAdminViewTests, r_test.RouterTests): INDEX_URL = reverse('horizon:%s:routers:index' % DASHBOARD) DETAIL_PATH = 'horizon:%s:routers:detail' % DASHBOARD + def _get_detail(self, router, extraroute=True): + res = super(RouterTests, self)._get_detail(router, extraroute, + lookup_l3=True) + return res + @test.create_stubs({api.neutron: ('router_list', 'network_list'), api.keystone: ('tenant_list',)}) def test_index(self): diff --git a/openstack_dashboard/dashboards/admin/routers/views.py b/openstack_dashboard/dashboards/admin/routers/views.py index ec1da4d2a..f348edd5b 100644 --- a/openstack_dashboard/dashboards/admin/routers/views.py +++ b/openstack_dashboard/dashboards/admin/routers/views.py @@ -71,7 +71,17 @@ class DetailView(r_views.DetailView): context = super(DetailView, self).get_context_data(**kwargs) table = rtbl.RoutersTable(self.request) context["url"] = self.failure_url - context["actions"] = table.render_row_actions(context["router"]) + router = context["router"] + # try to lookup the l3 agent location so we know where to troubleshoot + try: + agents = api.neutron.list_l3_agent_hosting_router(self.request, + router.id) + router.l3_host_agents = agents + except Exception: + exceptions.handle(self.request, + _('The L3 agent information could not ' + 'be located.')) + context["actions"] = table.render_row_actions(router) return context diff --git a/openstack_dashboard/dashboards/project/routers/tabs.py b/openstack_dashboard/dashboards/project/routers/tabs.py index 04046eb75..bec790364 100644 --- a/openstack_dashboard/dashboards/project/routers/tabs.py +++ b/openstack_dashboard/dashboards/project/routers/tabs.py @@ -16,6 +16,7 @@ from django.utils.translation import ugettext_lazy as _ from horizon import tabs +from openstack_dashboard import api from openstack_dashboard.dashboards.project.routers.extensions.extraroutes\ import tabs as er_tabs from openstack_dashboard.dashboards.project.routers.extensions.routerrules\ @@ -29,7 +30,10 @@ class OverviewTab(tabs.Tab): template_name = "project/routers/_detail_overview.html" def get_context_data(self, request): - return {"router": self.tab_group.kwargs['router']} + return {"router": self.tab_group.kwargs['router'], + 'ha_supported': api.neutron. + get_feature_permission(self.request, "l3-ha", "get") + } class InterfacesTab(tabs.TableTab): diff --git a/openstack_dashboard/dashboards/project/routers/templates/routers/_detail_overview.html b/openstack_dashboard/dashboards/project/routers/templates/routers/_detail_overview.html index 3f511b9d7..ed353626a 100644 --- a/openstack_dashboard/dashboards/project/routers/templates/routers/_detail_overview.html +++ b/openstack_dashboard/dashboards/project/routers/templates/routers/_detail_overview.html @@ -20,6 +20,33 @@
{% trans "Host" %} | +{% trans "ID" %} | + {% if ha_supported %} +{% trans "High Availability Status" %} | + {% endif %} +
---|---|---|
{{ agent.host }} | +{{ agent.id }} | + {% if ha_supported %} +{{ agent.ha_state|default:_("None") }} | + {% endif %} +