diff --git a/openstack_dashboard/dashboards/project/access_and_security/floating_ips/tests.py b/openstack_dashboard/dashboards/project/access_and_security/floating_ips/tests.py index a13e7ef438..cac4de3281 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/floating_ips/tests.py +++ b/openstack_dashboard/dashboards/project/access_and_security/floating_ips/tests.py @@ -390,8 +390,10 @@ class FloatingIpNeutronViewTests(FloatingIpViewTests): .AndReturn(self.neutron_quotas.first()) api.neutron.router_list(IsA(http.HttpRequest)) \ .AndReturn(self.routers.list()) - api.neutron.subnet_list(IsA(http.HttpRequest)) \ + api.neutron.subnet_list(IsA(http.HttpRequest), shared=False) \ .AndReturn(self.subnets.list()) + api.neutron.subnet_list(IsA(http.HttpRequest), shared=True) \ + .AndReturn(list()) api.neutron.network_list(IsA(http.HttpRequest), shared=False) \ .AndReturn(self.networks.list()) api.neutron.network_list(IsA(http.HttpRequest), shared=True) \ @@ -449,7 +451,9 @@ class FloatingIpNeutronViewTests(FloatingIpViewTests): .AndReturn(self.neutron_quotas.first()) api.neutron.router_list(IsA(http.HttpRequest)) \ .AndReturn(self.routers.list()) - api.neutron.subnet_list(IsA(http.HttpRequest)) \ + api.neutron.subnet_list(IsA(http.HttpRequest), shared=False) \ + .AndReturn(list()) + api.neutron.subnet_list(IsA(http.HttpRequest), shared=True) \ .AndReturn(self.subnets.list()) api.neutron.network_list(IsA(http.HttpRequest), shared=False) \ .AndReturn(list()) diff --git a/openstack_dashboard/usage/quotas.py b/openstack_dashboard/usage/quotas.py index 492d07e4c1..48f01fceee 100644 --- a/openstack_dashboard/usage/quotas.py +++ b/openstack_dashboard/usage/quotas.py @@ -324,9 +324,15 @@ def _get_tenant_network_usages(request, usages, disabled_quotas, tenant_id): usages.tally('networks', len(shared_networks)) if 'subnet' not in disabled_quotas: - subnets = [] - subnets = neutron.subnet_list(request) - usages.tally('subnets', len(subnets)) + subnets = neutron.subnet_list(request, shared=False) + if tenant_id: + subnets = [sub for sub in subnets if sub.tenant_id == tenant_id] + # get shared subnets + shared_subnets = neutron.subnet_list(request, shared=True) + if tenant_id: + shared_subnets = [subnet for subnet in shared_subnets + if subnet.tenant_id == tenant_id] + usages.tally('subnets', len(subnets) + len(shared_subnets)) if 'router' not in disabled_quotas: routers = []