From 4fe60f6192abdf154cbf7f65021a47d7e339aa76 Mon Sep 17 00:00:00 2001 From: Cory Stone Date: Thu, 5 Sep 2013 11:27:27 -0500 Subject: [PATCH] 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 --- cinder/api/contrib/quota_classes.py | 7 ++----- cinder/api/contrib/quotas.py | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) 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): -- 2.45.2