]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Remove quota fetch race condition
authorCory Stone <corystone@gmail.com>
Thu, 5 Sep 2013 16:27:27 +0000 (11:27 -0500)
committerCory Stone <corystone@gmail.com>
Thu, 5 Sep 2013 17:00:13 +0000 (12:00 -0500)
When displaying quotas, we shouldn't pull the latest resources
just to convert the results to the dict.

Closes-Bug: #1220436

Change-Id: Id01a310481353b272e103643d053957b65cd4ce3

cinder/api/contrib/quota_classes.py
cinder/api/contrib/quotas.py

index 597ccd004c540df511397a4a44de6c18d1126a9d..d68f13e6bc06d9dca18c35bfdcd0470b499bc3e9 100644 (file)
@@ -47,12 +47,9 @@ class QuotaClassSetsController(object):
     def _format_quota_set(self, quota_class, quota_set):
         """Convert the quota object to a result dict"""
 
-        result = dict(id=str(quota_class))
+        quota_set['id'] = str(quota_class)
 
-        for resource in QUOTAS.resources:
-            result[resource] = quota_set[resource]
-
-        return dict(quota_class_set=result)
+        return dict(quota_class_set=quota_set)
 
     @wsgi.serializers(xml=QuotaClassTemplate)
     def show(self, req, id):
index 892861763bdbe0b16324f9d8a30d09cae1bc7fb7..954f5fb486a67be7ec8aa518c3b860507e8b5746 100644 (file)
@@ -50,12 +50,9 @@ class QuotaSetsController(object):
     def _format_quota_set(self, project_id, quota_set):
         """Convert the quota object to a result dict"""
 
-        result = dict(id=str(project_id))
+        quota_set['id'] = str(project_id)
 
-        for resource in QUOTAS.resources:
-            result[resource] = quota_set[resource]
-
-        return dict(quota_set=result)
+        return dict(quota_set=quota_set)
 
     def _validate_quota_limit(self, limit):
         if not isinstance(limit, int):