Merge "EMC VMAX - Change naming convention for MV and SG for FAST"
This commit is contained in:
commit
ff3a937252
@ -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(
|
||||
|
@ -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})
|
||||
|
@ -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):
|
||||
|
||||
|
@ -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):
|
||||
|
||||
|
@ -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.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user