summaryrefslogtreecommitdiff
path: root/nova/api/openstack/compute
diff options
context:
space:
mode:
authorJohn Garbutt <john@johngarbutt.com>2020-03-10 17:27:53 +0000
committermelanie witt <melwittt@gmail.com>2022-02-24 16:21:02 +0000
commit94f9e443f2bde7edf63676ad9a8b2eefd9b68692 (patch)
tree1dfe9b43cb2c1294d89355d6615c6d5c7fcbd9d2 /nova/api/openstack/compute
parent4207493829a1b1877f643c4a49cd2e079f23859d (diff)
downloadnova-94f9e443f2bde7edf63676ad9a8b2eefd9b68692.tar.gz
Update quota_class APIs for db and api limits
Implement a unified limits specific version of get_class_quotas as used by the quota_class API. This simply returns the limits defined in keystone that are now enforced when you enable unified limits. Note: this will need to be updated again once we add limits to things that use things like resource_class, etc. blueprint unified-limits-nova Change-Id: If9901662d30d15da13303a3da051e1b9fded72c0
Diffstat (limited to 'nova/api/openstack/compute')
-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,