diff options
author | eric <eric.peterson1@twcable.com> | 2016-09-19 08:50:15 -0600 |
---|---|---|
committer | eric <eric.peterson1@twcable.com> | 2016-09-19 08:50:15 -0600 |
commit | 5d64e2db73a4b4602c1104e62752740c1d49bc45 (patch) | |
tree | 71a0eda3147c0a614a9990cd4024730fe0eee6c9 | |
parent | 90d7a3f79fe3e585bdf36cef660d092797ae5e1f (diff) | |
download | horizon-5d64e2db73a4b4602c1104e62752740c1d49bc45.tar.gz |
Quota cleanup of dynamic methods
Removing the usage of calling dynamic methods within the
quotas code. This makes it difficult to support and see
who is calling what code.
Change-Id: Ie2c6be3233dd2cff16eb2271e2ac3f4b04d6e2b5
Implements: blueprint make-quotas-great-again
-rw-r--r-- | openstack_dashboard/usage/quotas.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/openstack_dashboard/usage/quotas.py b/openstack_dashboard/usage/quotas.py index dfacd58b8..dd9c61d68 100644 --- a/openstack_dashboard/usage/quotas.py +++ b/openstack_dashboard/usage/quotas.py @@ -136,7 +136,7 @@ class QuotaUsage(dict): self.usages[name]['available'] = available -def _get_quota_data(request, method_name, disabled_quotas=None, +def _get_quota_data(request, tenant_mode=True, disabled_quotas=None, tenant_id=None): quotasets = [] if not tenant_id: @@ -147,11 +147,17 @@ def _get_quota_data(request, method_name, disabled_quotas=None, qs = base.QuotaSet() if 'instances' not in disabled_quotas: - quotasets.append(getattr(nova, method_name)(request, tenant_id)) + if tenant_mode: + quotasets.append(nova.tenant_quota_get(request, tenant_id)) + else: + quotasets.append(nova.default_quota_get(request, tenant_id)) if 'volumes' not in disabled_quotas: try: - quotasets.append(getattr(cinder, method_name)(request, tenant_id)) + if tenant_mode: + quotasets.append(cinder.tenant_quota_get(request, tenant_id)) + else: + quotasets.append(cinder.default_quota_get(request, tenant_id)) except cinder.cinder_exception.ClientException: disabled_quotas.update(CINDER_QUOTA_FIELDS) msg = _("Unable to retrieve volume limit information.") @@ -164,14 +170,14 @@ def _get_quota_data(request, method_name, disabled_quotas=None, def get_default_quota_data(request, disabled_quotas=None, tenant_id=None): return _get_quota_data(request, - "default_quota_get", + tenant_mode=False, disabled_quotas=disabled_quotas, tenant_id=tenant_id) def get_tenant_quota_data(request, disabled_quotas=None, tenant_id=None): qs = _get_quota_data(request, - "tenant_quota_get", + tenant_mode=True, disabled_quotas=disabled_quotas, tenant_id=tenant_id) |