]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
EMC VMAX - Limit SG and MV to 64 characters
authorHelen Walsh <helen.walsh@emc.com>
Tue, 26 Jan 2016 23:12:37 +0000 (23:12 +0000)
committerHelen Walsh <helen.walsh@emc.com>
Wed, 2 Mar 2016 01:51:00 +0000 (01:51 +0000)
VMAX restricts storage group and masking view names to a maximum
length of 64 characters. This patch only adds extra unit tests to
prove that both MV and SG names are below the 64 chars in all
scenarios.

Change-Id: I72917a56083eb25f876b9cdeaa30511793922497

cinder/tests/unit/test_emc_vmax.py
cinder/volume/drivers/emc/emc_vmax_utils.py

index bd87d3474d484a9f4e100221e1a7e813b07a2193..ad02ca296508818c61d92f71fb0c76383acd5e1e 100644 (file)
@@ -1933,14 +1933,30 @@ class EMCVMAXISCSIDriverNoFastTestCase(test.TestCase):
         self.assertEqual(
             'OS-fakehost-gold_pool-I-MV', maskingViewDict['maskingViewName'])
 
+    def test_populate_masking_dict_fast_both_exceeding(self):
         # 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
+        extraSpecs = self.populate_masking_dict_setup()
         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']))
+        self.assertLessEqual(len(maskingViewDict['sgGroupName']), 64)
+        self.assertLessEqual(len(maskingViewDict['maskingViewName']), 64)
+
+    def test_populate_masking_dict_no_fast_both_exceeding(self):
+        # 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
+        extraSpecs = self.populate_masking_dict_setup()
+        connector = {'host': 'SHORT_HOST_MORE_THEN THIRTY_EIGHT_CHARACTERS'}
+        extraSpecs['storagetype:pool'] = (
+            'GOLD_POOL_MORE_THAN_SIXTEEN_CHARACTERS')
+        extraSpecs['storagetype:fastpolicy'] = None
+        maskingViewDict = self.driver.common._populate_masking_dict(
+            self.data.test_volume, connector, extraSpecs)
+        self.assertLessEqual(len(maskingViewDict['sgGroupName']), 64)
+        self.assertLessEqual(len(maskingViewDict['maskingViewName']), 64)
 
     def test_filter_list(self):
         portgroupnames = ['pg3', 'pg1', 'pg4', 'pg2']
index a065a2505433aa9ac303470ad5305ca1f3540293..ba71670358e6f22595a68201694eec014af25cd3 100644 (file)
@@ -40,6 +40,8 @@ except ImportError:
 STORAGEGROUPTYPE = 4
 POSTGROUPTYPE = 3
 CLONE_REPLICATION_TYPE = 10
+MAX_POOL_LENGTH = 16
+MAX_FASTPOLICY_LENGTH = 14
 
 EMC_ROOT = 'root/emc'
 CONCATENATED = 'concatenated'
@@ -2363,7 +2365,7 @@ class EMCVMAXUtils(object):
         :param poolName: long pool name
         :returns: truncated pool name
         """
-        if poolName and len(poolName) > 16:
+        if poolName and len(poolName) > MAX_POOL_LENGTH:
             return (
                 ("%(first)s_%(last)s"
                  % {'first': poolName[:8],
@@ -2377,7 +2379,7 @@ class EMCVMAXUtils(object):
         :param fastPolicyName: long fast policy name
         :returns: truncated fast policy name
         """
-        if fastPolicyName and len(fastPolicyName) > 14:
+        if fastPolicyName and len(fastPolicyName) > MAX_FASTPOLICY_LENGTH:
             return (
                 ("%(first)s_%(last)s"
                  % {'first': fastPolicyName[:7],