From: Cory Stone Date: Thu, 5 Sep 2013 16:27:27 +0000 (-0500) Subject: Remove quota fetch race condition X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=4fe60f6192abdf154cbf7f65021a47d7e339aa76;p=openstack-build%2Fcinder-build.git Remove quota fetch race condition When displaying quotas, we shouldn't pull the latest resources just to convert the results to the dict. Closes-Bug: #1220436 Change-Id: Id01a310481353b272e103643d053957b65cd4ce3 --- diff --git a/cinder/api/contrib/quota_classes.py b/cinder/api/contrib/quota_classes.py index 597ccd004..d68f13e6b 100644 --- a/cinder/api/contrib/quota_classes.py +++ b/cinder/api/contrib/quota_classes.py @@ -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): diff --git a/cinder/api/contrib/quotas.py b/cinder/api/contrib/quotas.py index 892861763..954f5fb48 100644 --- a/cinder/api/contrib/quotas.py +++ b/cinder/api/contrib/quotas.py @@ -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):