]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
EMC VMAX - Change naming convention for MV and SG for FAST
authorHelen Walsh <helen.walsh@emc.com>
Wed, 18 Nov 2015 16:11:30 +0000 (16:11 +0000)
committerHelen Walsh <helen.walsh@emc.com>
Mon, 23 Nov 2015 23:24:12 +0000 (23:24 +0000)
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

cinder/tests/unit/test_emc_vmax.py
cinder/volume/drivers/emc/emc_vmax_common.py
cinder/volume/drivers/emc/emc_vmax_fc.py
cinder/volume/drivers/emc/emc_vmax_iscsi.py
cinder/volume/drivers/emc/emc_vmax_utils.py

index 021e57a75be9e52a80d8e35cb4442cb47eb3bd0a..d28ebac5491c0f715cc286d1223e041e11a3742f 100644 (file)
@@ -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(
index f7c51d9c43c89394b7ee0a317cc253d8ce47986c..f1935fe54a9dc928e00ababc87fff50f1b2d1c4f 100644 (file)
@@ -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})
index 3c16d7e0dca87bdbbab3f913728e47c0dacfb8ca..a30b8f88a277d3afec54e60699c2a8997c7d5674 100644 (file)
@@ -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):
 
index f0ceb187e7efb0d3a11460a1c3e8f5a77637b5c6..30a819a71906176d417300b74836ee81dacb62c4 100644 (file)
@@ -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):
 
index 1abc04819f4c6ee040401744ac03b3b0f49927d6..cd139dfc8f0e3441908a6bd24accd588bca4b401 100644 (file)
@@ -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.