]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
More validation logic for VNX CG creation
authorJeegn Chen <jeegn.chen@emc.com>
Wed, 4 Mar 2015 13:10:34 +0000 (21:10 +0800)
committerJeegn Chen <jeegn.chen@emc.com>
Wed, 4 Mar 2015 13:10:34 +0000 (21:10 +0800)
In VNX array, compressed LUNs cannot be added into a Consistency Group.

VNX Cinder Driver should check the volume types.
If storagetype:provisioning=compressed is specified,
VNX Cinder Driver should reject the CG creation operation.

When parsing group['volume_type_id'], the trailing comma should be
considered.

Change-Id: Ie683935f8aa03f04e0c353bdebadc0f410ada08e
Closes-Bug: #1421163

cinder/tests/test_emc_vnxdirect.py
cinder/volume/drivers/emc/emc_vnx_cli.py

index 89b2bbae4c6ea77fca34300e29a45638a62c61fe..a0fa20a8b393082273020431379ea42b73345cae 100644 (file)
@@ -318,7 +318,7 @@ class EMCVNXCLIDriverTestData():
                          'status': 'creating',
                          'volume_type_id':
                          'abc1-2320-9013-8813-8941-1374-8112-1231,'
-                         '19fdd0dd-03b3-4d7c-b541-f4df46f308c8'}
+                         '19fdd0dd-03b3-4d7c-b541-f4df46f308c8,'}
 
     test_cgsnapshot = {
         'consistencygroup_id': 'consistencygroup_id',
index 705354c86bd30eb3282080c4950e4d965556630f..e1fa4fa968a863307468755e0ba3f977ea31df70 100644 (file)
@@ -2163,13 +2163,15 @@ class EMCVnxCliBase(object):
 
         if group.get('volume_type_id') is not None:
             for id in group['volume_type_id'].split(","):
-                provisioning, tiering = self._get_extra_spec_value(
-                    volume_types.get_volume_type_extra_specs(id))
-                if provisioning == 'compressed':
-                    msg = _("Failed to create consistency group %s "
-                            "because VNX consistency group cannot "
-                            "accept compressed LUNs as members.") % group['id']
-                    raise exception.VolumeBackendAPIException(data=msg)
+                if id:
+                    provisioning, tiering = self._get_extra_spec_value(
+                        volume_types.get_volume_type_extra_specs(id))
+                    if provisioning == 'compressed':
+                        msg = _("Failed to create consistency group %s "
+                                "because VNX consistency group cannot "
+                                "accept compressed LUNs as members."
+                                ) % group['id']
+                        raise exception.VolumeBackendAPIException(data=msg)
 
     def create_consistencygroup(self, context, group):
         """Creates a consistency group."""