diff options
author | Matt Riedemann <mriedem@us.ibm.com> | 2014-05-29 08:05:49 -0700 |
---|---|---|
committer | Matt Riedemann <mriedem@us.ibm.com> | 2014-05-29 13:12:16 -0700 |
commit | 86d0cf46715d3c98a49ec08086e7005a12ec5976 (patch) | |
tree | 22701bd0db69c99cc1bc1991aad507cd6bdd25c9 /nova/quota.py | |
parent | fc6c14738d2b5e4858977e64fdfba53ea7c07e81 (diff) | |
download | nova-86d0cf46715d3c98a49ec08086e7005a12ec5976.tar.gz |
Revert "Remove quota_class params from rest of nova.quota"
This reverts commit d1442a6aec5e1e20cb35627b77739dbe92770e7a.
The quota_classes API was used to set default quota values
so it shouldn't have been removed, so reverting a series
of changes that removed the API and it's internal code.
Related mailing list thread on the topic:
http://lists.openstack.org/pipermail/openstack-dev/2014-May/035383.html
Partial-Bug: #1299517
Change-Id: I839bb6570f5c189e04e284eda8cde7bc2ac29fdb
Diffstat (limited to 'nova/quota.py')
-rw-r--r-- | nova/quota.py | 61 |
1 files changed, 47 insertions, 14 deletions
diff --git a/nova/quota.py b/nova/quota.py index ed36d2d4f2..5c22505c76 100644 --- a/nova/quota.py +++ b/nova/quota.py @@ -121,7 +121,8 @@ class DbQuotaDriver(object): return quotas def _process_quotas(self, context, resources, project_id, quotas, - defaults=True, usages=None, remains=False): + quota_class=None, defaults=True, usages=None, + remains=False): modified_quotas = {} default_quotas = self.get_defaults(context, resources) @@ -157,7 +158,8 @@ class DbQuotaDriver(object): return modified_quotas def get_user_quotas(self, context, resources, project_id, user_id, - defaults=True, usages=True, project_quotas=None, + quota_class=None, defaults=True, + usages=True, project_quotas=None, user_quotas=None): """Given a list of resources, retrieve the quotas for the given user and project. @@ -166,6 +168,11 @@ class DbQuotaDriver(object): :param resources: A dictionary of the registered resources. :param project_id: The ID of the project to return quotas for. :param user_id: The ID of the user to return quotas for. + :param quota_class: If project_id != context.project_id, the + quota class cannot be determined. This + parameter allows it to be specified. It + will be ignored if project_id == + context.project_id. :param defaults: If True, the quota class value (or the default value, if there is no value from the quota class) will be reported if there is no @@ -190,18 +197,23 @@ class DbQuotaDriver(object): project_id, user_id) return self._process_quotas(context, resources, project_id, - user_quotas, defaults=defaults, - usages=user_usages) + user_quotas, quota_class, + defaults=defaults, usages=user_usages) def get_project_quotas(self, context, resources, project_id, - defaults=True, usages=True, remains=False, - project_quotas=None): + quota_class=None, defaults=True, + usages=True, remains=False, project_quotas=None): """Given a list of resources, retrieve the quotas for the given project. :param context: The request context, for access checks. :param resources: A dictionary of the registered resources. :param project_id: The ID of the project to return quotas for. + :param quota_class: If project_id != context.project_id, the + quota class cannot be determined. This + parameter allows it to be specified. It + will be ignored if project_id == + context.project_id. :param defaults: If True, the quota class value (or the default value, if there is no value from the quota class) will be reported if there is no @@ -219,7 +231,7 @@ class DbQuotaDriver(object): project_usages = db.quota_usage_get_all_by_project(context, project_id) return self._process_quotas(context, resources, project_id, - project_quotas, + project_quotas, quota_class, defaults=defaults, usages=project_usages, remains=remains) @@ -326,12 +338,13 @@ class DbQuotaDriver(object): # Grab and return the quotas (without usages) quotas = self.get_user_quotas(context, sub_resources, project_id, user_id, - usages=False, + None, usages=False, project_quotas=project_quotas) else: # Grab and return the quotas (without usages) quotas = self.get_project_quotas(context, sub_resources, project_id, + None, usages=False, project_quotas=project_quotas) @@ -637,7 +650,8 @@ class NoopQuotaDriver(object): return quotas def get_user_quotas(self, context, resources, project_id, user_id, - defaults=True, usages=True): + quota_class=None, defaults=True, + usages=True): """Given a list of resources, retrieve the quotas for the given user and project. @@ -645,6 +659,11 @@ class NoopQuotaDriver(object): :param resources: A dictionary of the registered resources. :param project_id: The ID of the project to return quotas for. :param user_id: The ID of the user to return quotas for. + :param quota_class: If project_id != context.project_id, the + quota class cannot be determined. This + parameter allows it to be specified. It + will be ignored if project_id == + context.project_id. :param defaults: If True, the quota class value (or the default value, if there is no value from the quota class) will be reported if there is no @@ -655,13 +674,19 @@ class NoopQuotaDriver(object): return self._get_noop_quotas(resources, usages=usages) def get_project_quotas(self, context, resources, project_id, - defaults=True, usages=True, remains=False): + quota_class=None, defaults=True, + usages=True, remains=False): """Given a list of resources, retrieve the quotas for the given project. :param context: The request context, for access checks. :param resources: A dictionary of the registered resources. :param project_id: The ID of the project to return quotas for. + :param quota_class: If project_id != context.project_id, the + quota class cannot be determined. This + parameter allows it to be specified. It + will be ignored if project_id == + context.project_id. :param defaults: If True, the quota class value (or the default value, if there is no value from the quota class) will be reported if there is no @@ -1015,13 +1040,16 @@ class QuotaEngine(object): return self._driver.get_defaults(context, self._resources) - def get_user_quotas(self, context, project_id, user_id, defaults=True, - usages=True): + def get_user_quotas(self, context, project_id, user_id, quota_class=None, + defaults=True, usages=True): """Retrieve the quotas for the given user and project. :param context: The request context, for access checks. :param project_id: The ID of the project to return quotas for. :param user_id: The ID of the user to return quotas for. + :param quota_class: If project_id != context.project_id, the + quota class cannot be determined. This + parameter allows it to be specified. :param defaults: If True, the quota class value (or the default value, if there is no value from the quota class) will be reported if there is no @@ -1032,15 +1060,19 @@ class QuotaEngine(object): return self._driver.get_user_quotas(context, self._resources, project_id, user_id, + quota_class=quota_class, defaults=defaults, usages=usages) - def get_project_quotas(self, context, project_id, defaults=True, - usages=True, remains=False): + def get_project_quotas(self, context, project_id, quota_class=None, + defaults=True, usages=True, remains=False): """Retrieve the quotas for the given project. :param context: The request context, for access checks. :param project_id: The ID of the project to return quotas for. + :param quota_class: If project_id != context.project_id, the + quota class cannot be determined. This + parameter allows it to be specified. :param defaults: If True, the quota class value (or the default value, if there is no value from the quota class) will be reported if there is no @@ -1053,6 +1085,7 @@ class QuotaEngine(object): return self._driver.get_project_quotas(context, self._resources, project_id, + quota_class=quota_class, defaults=defaults, usages=usages, remains=remains) |