From: Helen Walsh Date: Wed, 18 Nov 2015 16:11:30 +0000 (+0000) Subject: EMC VMAX - Change naming convention for MV and SG for FAST X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=751281a4eb1f2dcb3788c92f2cac242827537db1;p=openstack-build%2Fcinder-build.git EMC VMAX - Change naming convention for MV and SG for FAST Up until now we assumed a one to one relationship between FAST policy and Pool. This does not have to be the case. A FAST policy can span multiple pools. To ensure uniqueness we will change the SG nand MV name to contain the FAST policy and not the pool name. Change-Id: I4d7cc4f8922d08b886b8eb3eb9b1a2b3f4340cc1 Closes-Bug: #1515181 --- diff --git a/cinder/tests/unit/test_emc_vmax.py b/cinder/tests/unit/test_emc_vmax.py index 021e57a75..d28ebac54 100644 --- a/cinder/tests/unit/test_emc_vmax.py +++ b/cinder/tests/unit/test_emc_vmax.py @@ -1840,6 +1840,65 @@ class EMCVMAXISCSIDriverNoFastTestCase(test.TestCase): def fake_is_v3(self, conn, serialNumber): return False + def populate_masking_dict_setup(self): + extraSpecs = {'storagetype:pool': u'gold_pool', + 'volume_backend_name': 'GOLD_POOL_BE', + 'storagetype:array': u'1234567891011', + 'isV3': False, + 'portgroupname': u'OS-portgroup-PG', + 'storagetype:fastpolicy': u'GOLD'} + vol = {'SystemName': self.data.storage_system} + self.driver.common._find_lun = mock.Mock( + return_value=vol) + self.driver.common.utils.find_controller_configuration_service = ( + mock.Mock(return_value=None)) + return extraSpecs + + def test_populate_masking_dict_fast(self): + extraSpecs = self.populate_masking_dict_setup() + # If fast is enabled it will uniquely determine the SG and MV + # on the host along with the protocol(iSCSI) e.g. I + maskingViewDict = self.driver.common._populate_masking_dict( + self.data.test_volume, self.data.connector, extraSpecs) + self.assertEqual( + 'OS-fakehost-GOLD-FP-I-SG', maskingViewDict['sgGroupName']) + self.assertEqual( + 'OS-fakehost-GOLD-FP-I-MV', maskingViewDict['maskingViewName']) + + def test_populate_masking_dict_fast_more_than_14chars(self): + # If the length of the FAST policy name is greater than 14 chars + extraSpecs = self.populate_masking_dict_setup() + extraSpecs['storagetype:fastpolicy'] = 'GOLD_MORE_THAN_FOURTEEN_CHARS' + maskingViewDict = self.driver.common._populate_masking_dict( + self.data.test_volume, self.data.connector, extraSpecs) + self.assertEqual( + 'OS-fakehost-GOLD_MO__CHARS-FP-I-SG', + maskingViewDict['sgGroupName']) + self.assertEqual( + 'OS-fakehost-GOLD_MO__CHARS-FP-I-MV', + maskingViewDict['maskingViewName']) + + def test_populate_masking_dict_no_fast(self): + # If fast isn't enabled the pool will uniquely determine the SG and MV + # on the host along with the protocol(iSCSI) e.g. I + extraSpecs = self.populate_masking_dict_setup() + extraSpecs['storagetype:fastpolicy'] = None + maskingViewDict = self.driver.common._populate_masking_dict( + self.data.test_volume, self.data.connector, extraSpecs) + self.assertEqual( + 'OS-fakehost-gold_pool-I-SG', maskingViewDict['sgGroupName']) + self.assertEqual( + 'OS-fakehost-gold_pool-I-MV', maskingViewDict['maskingViewName']) + + # If the length of the FAST policy name is greater than 14 chars and + # the length of the short host is more than 38 characters + connector = {'host': 'SHORT_HOST_MORE_THEN THIRTY_EIGHT_CHARACTERS'} + extraSpecs['storagetype:fastpolicy'] = ( + 'GOLD_MORE_THAN_FOURTEEN_CHARACTERS') + maskingViewDict = self.driver.common._populate_masking_dict( + self.data.test_volume, connector, extraSpecs) + self.assertLessEqual(64, len(maskingViewDict['sgGroupName'])) + def test_generate_unique_trunc_pool(self): pool_under_16_chars = 'pool_under_16' pool1 = self.driver.utils.generate_unique_trunc_pool( diff --git a/cinder/volume/drivers/emc/emc_vmax_common.py b/cinder/volume/drivers/emc/emc_vmax_common.py index f7c51d9c4..f1935fe54 100644 --- a/cinder/volume/drivers/emc/emc_vmax_common.py +++ b/cinder/volume/drivers/emc/emc_vmax_common.py @@ -1752,12 +1752,15 @@ class EMCVMAXCommon(object): 'slo': slo, 'workload': workload})) else: + maskingViewDict['fastPolicy'] = extraSpecs[FASTPOLICY] + if maskingViewDict['fastPolicy']: + uniqueName = self.utils.generate_unique_trunc_fastpolicy( + maskingViewDict['fastPolicy']) + '-FP' prefix = ( ("OS-%(shortHostName)s-%(poolName)s-%(protocol)s" % {'shortHostName': shortHostName, 'poolName': uniqueName, 'protocol': protocol})) - maskingViewDict['fastPolicy'] = extraSpecs[FASTPOLICY] maskingViewDict['sgGroupName'] = ("%(prefix)s-SG" % {'prefix': prefix}) diff --git a/cinder/volume/drivers/emc/emc_vmax_fc.py b/cinder/volume/drivers/emc/emc_vmax_fc.py index 3c16d7e0d..a30b8f88a 100644 --- a/cinder/volume/drivers/emc/emc_vmax_fc.py +++ b/cinder/volume/drivers/emc/emc_vmax_fc.py @@ -42,9 +42,10 @@ class EMCVMAXFCDriver(driver.FibreChannelDriver): 2.2.2 - Update Consistency Group 2.2.3 - Pool aware scheduler(multi-pool) support 2.2.4 - Create CG from CG snapshot + 2.3 - Name change for MV and SG for FAST (bug #1515181) """ - VERSION = "2.2.4" + VERSION = "2.3" def __init__(self, *args, **kwargs): diff --git a/cinder/volume/drivers/emc/emc_vmax_iscsi.py b/cinder/volume/drivers/emc/emc_vmax_iscsi.py index f0ceb187e..30a819a71 100644 --- a/cinder/volume/drivers/emc/emc_vmax_iscsi.py +++ b/cinder/volume/drivers/emc/emc_vmax_iscsi.py @@ -50,9 +50,10 @@ class EMCVMAXISCSIDriver(driver.ISCSIDriver): 2.2.2 - Update Consistency Group 2.2.3 - Pool aware scheduler(multi-pool) support 2.2.4 - Create CG from CG snapshot + 2.3 - Name change for MV and SG for FAST (bug #1515181) """ - VERSION = "2.2.4" + VERSION = "2.3" def __init__(self, *args, **kwargs): diff --git a/cinder/volume/drivers/emc/emc_vmax_utils.py b/cinder/volume/drivers/emc/emc_vmax_utils.py index 1abc04819..cd139dfc8 100644 --- a/cinder/volume/drivers/emc/emc_vmax_utils.py +++ b/cinder/volume/drivers/emc/emc_vmax_utils.py @@ -2377,6 +2377,20 @@ class EMCVMAXUtils(object): else: return poolName + def generate_unique_trunc_fastpolicy(self, fastPolicyName): + """Create a unique fast policy name under 14 chars + + :param fastPolicyName: long fast policy name + :returns: truncated fast policy name + """ + if fastPolicyName and len(fastPolicyName) > 14: + return ( + ("%(first)s_%(last)s" + % {'first': fastPolicyName[:7], + 'last': fastPolicyName[-6:]})) + else: + return fastPolicyName + def get_iscsi_protocol_endpoints(self, conn, portgroupinstancename): """Get the iscsi protocol endpoints of a port group.