From 876e891a8bf5a1a7cdb857c7cefa946c418272f0 Mon Sep 17 00:00:00 2001 From: Jeegn Chen Date: Wed, 4 Mar 2015 21:10:34 +0800 Subject: [PATCH] More validation logic for VNX CG creation 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 | 2 +- cinder/volume/drivers/emc/emc_vnx_cli.py | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cinder/tests/test_emc_vnxdirect.py b/cinder/tests/test_emc_vnxdirect.py index 89b2bbae4..a0fa20a8b 100644 --- a/cinder/tests/test_emc_vnxdirect.py +++ b/cinder/tests/test_emc_vnxdirect.py @@ -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', diff --git a/cinder/volume/drivers/emc/emc_vnx_cli.py b/cinder/volume/drivers/emc/emc_vnx_cli.py index 705354c86..e1fa4fa96 100644 --- a/cinder/volume/drivers/emc/emc_vnx_cli.py +++ b/cinder/volume/drivers/emc/emc_vnx_cli.py @@ -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.""" -- 2.45.2