summaryrefslogtreecommitdiff
path: root/nova/api
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-02-26 09:08:43 +0000
committerGerrit Code Review <review@openstack.org>2022-02-26 09:08:43 +0000
commit7e85ef916676e6298474f9d5fddc175a4ddd1c37 (patch)
tree5815e1592ec563448eebbea64966dc85f88e6c59 /nova/api
parentf28ea8fdc74d3386402b7214041690f71b0be0a1 (diff)
parent94f9e443f2bde7edf63676ad9a8b2eefd9b68692 (diff)
downloadnova-7e85ef916676e6298474f9d5fddc175a4ddd1c37.tar.gz
Merge "Update quota_class APIs for db and api limits"
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/quota_classes.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/nova/api/openstack/compute/quota_classes.py b/nova/api/openstack/compute/quota_classes.py
index 741ce5f848..942fa71f32 100644
--- a/nova/api/openstack/compute/quota_classes.py
+++ b/nova/api/openstack/compute/quota_classes.py
@@ -20,6 +20,7 @@ from nova.api.openstack.compute.schemas import quota_classes
from nova.api.openstack import wsgi
from nova.api import validation
from nova import exception
+from nova.limit import utils as limit_utils
from nova import objects
from nova.policies import quota_class_sets as qcs_policies
from nova import quota
@@ -129,11 +130,20 @@ class QuotaClassSetsController(wsgi.Controller):
quota_class = id
- for key, value in body['quota_class_set'].items():
- try:
- objects.Quotas.update_class(context, quota_class, key, value)
- except exception.QuotaClassNotFound:
- objects.Quotas.create_class(context, quota_class, key, value)
+ quota_updates = body['quota_class_set'].items()
+ # TODO(johngarbutt) eventually cores, ram and instances changes will
+ # get sent to keystone when using unified limits, but only when the
+ # quota_class == "default".
+ if not limit_utils.use_unified_limits():
+ # When not unified limits, keep updating the database, even though
+ # the noop driver doesn't read these values
+ for key, value in quota_updates:
+ try:
+ objects.Quotas.update_class(
+ context, quota_class, key, value)
+ except exception.QuotaClassNotFound:
+ objects.Quotas.create_class(
+ context, quota_class, key, value)
values = QUOTAS.get_class_quotas(context, quota_class)
return self._format_quota_set(None, values, filtered_quotas,