diff --git a/openstack_dashboard/api/neutron.py b/openstack_dashboard/api/neutron.py index 7a19605345..ba007996bd 100644 --- a/openstack_dashboard/api/neutron.py +++ b/openstack_dashboard/api/neutron.py @@ -1454,6 +1454,13 @@ def tenant_quota_detail_get(request, tenant_id=None): return response['quota'] +@profiler.trace +def default_quota_get(request, tenant_id=None): + tenant_id = tenant_id or request.user.tenant_id + response = neutronclient(request).show_quota_default(tenant_id) + return base.QuotaSet(response['quota']) + + @profiler.trace def agent_list(request, **params): agents = neutronclient(request).list_agents(**params) diff --git a/openstack_dashboard/usage/quotas.py b/openstack_dashboard/usage/quotas.py index b560385772..fc38e99e9b 100644 --- a/openstack_dashboard/usage/quotas.py +++ b/openstack_dashboard/usage/quotas.py @@ -183,11 +183,9 @@ def get_default_quota_data(request, disabled_quotas=None, tenant_id=None): exceptions.handle(request, msg) if NEUTRON_QUOTA_FIELDS - disabled_quotas: - # TODO(jpichon): There is no API to access the Neutron default quotas - # (LP#1204956). For now, use the values from the current project. try: - quotasets.append(neutron.tenant_quota_get(request, - tenant_id=tenant_id)) + quotasets.append(neutron.default_quota_get(request, + tenant_id=tenant_id)) except Exception: disabled_quotas.update(NEUTRON_QUOTA_FIELDS) msg = _('Unable to retrieve Neutron quota information.') diff --git a/releasenotes/notes/neutron-default-quotas-ddd237af2935fde3.yaml b/releasenotes/notes/neutron-default-quotas-ddd237af2935fde3.yaml new file mode 100644 index 0000000000..1f0eb44bc6 --- /dev/null +++ b/releasenotes/notes/neutron-default-quotas-ddd237af2935fde3.yaml @@ -0,0 +1,9 @@ +--- +fixes: + - | + [:bug:`1337473`] The default quotas of neutron resource for a new project + are no longer got from the quotas of the current project. + Neutron did not provide a way to retrieve the default quotas and horizon + used the quotas of the current project as the default quotas for a new + project as a workaround. Neutron implemented an API to retrieve default + quotas since newton and horizon now consumes it.