]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Create CG needs extra specs
authorXing Yang <xing.yang@emc.com>
Tue, 18 Aug 2015 18:13:36 +0000 (14:13 -0400)
committerXing Yang <xing.yang@emc.com>
Tue, 18 Aug 2015 18:13:36 +0000 (14:13 -0400)
Get volume types no longer returns extra specs for non-admin users.
This breaks CG creation which needs extra specs. This patch fixes it
by elevating the context when getting volume types for CG creation.

Change-Id: I610149e8bf9a067f78a9ad52eb02b2da41dc64f6
Closes-Bug: #1495758

cinder/consistencygroup/api.py

index 77d1d7f7c0e8fca814dab756be3db03fd841a5ca..ebf4d8cc85f236508e55a1ccea7d41fc0c553b10 100644 (file)
@@ -115,8 +115,9 @@ class API(base.Base):
         volume_type_list = cg_volume_types.split(',')
 
         req_volume_types = []
+        # NOTE: Admin context is required to get extra_specs of volume_types.
         req_volume_types = (self.db.volume_types_get_by_name_or_id(
-            context, volume_type_list))
+            context.elevated(), volume_type_list))
 
         req_volume_type_ids = ""
         for voltype in req_volume_types: