Merge "VMAX Driver - disable initiator check by default" into stable/newton
This commit is contained in:
commit
df539f51d4
|
@ -5854,7 +5854,7 @@ class EMCV3DriverTestCase(test.TestCase):
|
||||||
def set_configuration(self):
|
def set_configuration(self):
|
||||||
configuration = mock.Mock()
|
configuration = mock.Mock()
|
||||||
configuration.cinder_emc_config_file = self.config_file_path
|
configuration.cinder_emc_config_file = self.config_file_path
|
||||||
configuration.safe_get.return_value = 3
|
configuration.safe_get.return_value = 'EMCV3DriverTests'
|
||||||
configuration.config_group = 'V3'
|
configuration.config_group = 'V3'
|
||||||
|
|
||||||
self.mock_object(emc_vmax_common.EMCVMAXCommon, '_get_ecom_connection',
|
self.mock_object(emc_vmax_common.EMCVMAXCommon, '_get_ecom_connection',
|
||||||
|
@ -6076,8 +6076,8 @@ class EMCV3DriverTestCase(test.TestCase):
|
||||||
emc_vmax_utils.EMCVMAXUtils,
|
emc_vmax_utils.EMCVMAXUtils,
|
||||||
'find_storageSystem',
|
'find_storageSystem',
|
||||||
return_value={'Name': EMCVMAXCommonData.storage_system_v3})
|
return_value={'Name': EMCVMAXCommonData.storage_system_v3})
|
||||||
def test_get_volume_stats_v3(
|
def test_get_volume_stats_v3(self, mock_storage_system):
|
||||||
self, mock_storage_system):
|
self.driver.common.pool_info['reserved_percentage'] = 5
|
||||||
self.driver.get_volume_stats(True)
|
self.driver.get_volume_stats(True)
|
||||||
|
|
||||||
@mock.patch.object(
|
@mock.patch.object(
|
||||||
|
@ -8818,3 +8818,91 @@ class EMCVMAXISCSITest(test.TestCase):
|
||||||
properties['target_iqns'])
|
properties['target_iqns'])
|
||||||
self.assertEqual(['10.10.0.50:3260', '10.10.0.51:3260'],
|
self.assertEqual(['10.10.0.50:3260', '10.10.0.51:3260'],
|
||||||
properties['target_portals'])
|
properties['target_portals'])
|
||||||
|
|
||||||
|
|
||||||
|
class VMAXInitiatorCheckFalseTest(test.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.data = EMCVMAXCommonData()
|
||||||
|
|
||||||
|
super(VMAXInitiatorCheckFalseTest, self).setUp()
|
||||||
|
|
||||||
|
configuration = mock.Mock()
|
||||||
|
configuration.safe_get.return_value = 'initiatorCheckTest'
|
||||||
|
configuration.config_group = 'initiatorCheckTest'
|
||||||
|
|
||||||
|
emc_vmax_common.EMCVMAXCommon._gather_info = mock.Mock()
|
||||||
|
instancename = FakeCIMInstanceName()
|
||||||
|
self.mock_object(emc_vmax_utils.EMCVMAXUtils, 'get_instance_name',
|
||||||
|
instancename.fake_getinstancename)
|
||||||
|
self.mock_object(emc_vmax_common.EMCVMAXCommon, '_get_ecom_connection',
|
||||||
|
FakeEcomConnection())
|
||||||
|
self.mock_object(emc_vmax_utils.EMCVMAXUtils,
|
||||||
|
'find_controller_configuration_service',
|
||||||
|
return_value=None)
|
||||||
|
driver = emc_vmax_iscsi.EMCVMAXISCSIDriver(configuration=configuration)
|
||||||
|
driver.db = FakeDB()
|
||||||
|
self.driver = driver
|
||||||
|
|
||||||
|
@mock.patch.object(
|
||||||
|
emc_vmax_common.EMCVMAXCommon,
|
||||||
|
'_find_lun',
|
||||||
|
return_value=(
|
||||||
|
{'SystemName': EMCVMAXCommonData.storage_system}))
|
||||||
|
def test_populate_masking_dict(self, mock_find_lun):
|
||||||
|
extraSpecs = {'storagetype:pool': u'SRP_1',
|
||||||
|
'volume_backend_name': 'INITIATOR_BE',
|
||||||
|
'storagetype:array': u'1234567891011',
|
||||||
|
'isV3': True,
|
||||||
|
'portgroupname': u'OS-portgroup-PG',
|
||||||
|
'storagetype:slo': u'Diamond',
|
||||||
|
'storagetype:workload': u'DSS'}
|
||||||
|
connector = self.data.connector
|
||||||
|
maskingViewDict = self.driver.common._populate_masking_dict(
|
||||||
|
self.data.test_volume, connector, extraSpecs)
|
||||||
|
self.assertFalse(maskingViewDict['initiatorCheck'])
|
||||||
|
|
||||||
|
|
||||||
|
class VMAXInitiatorCheckTrueTest(test.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.data = EMCVMAXCommonData()
|
||||||
|
|
||||||
|
super(VMAXInitiatorCheckTrueTest, self).setUp()
|
||||||
|
|
||||||
|
self.configuration = mock.Mock(
|
||||||
|
initiator_check='True',
|
||||||
|
config_group='initiatorCheckTest')
|
||||||
|
|
||||||
|
def safe_get(key):
|
||||||
|
return getattr(self.configuration, key)
|
||||||
|
self.configuration.safe_get = safe_get
|
||||||
|
emc_vmax_common.EMCVMAXCommon._gather_info = mock.Mock()
|
||||||
|
instancename = FakeCIMInstanceName()
|
||||||
|
self.mock_object(emc_vmax_utils.EMCVMAXUtils, 'get_instance_name',
|
||||||
|
instancename.fake_getinstancename)
|
||||||
|
self.mock_object(emc_vmax_common.EMCVMAXCommon, '_get_ecom_connection',
|
||||||
|
FakeEcomConnection())
|
||||||
|
self.mock_object(emc_vmax_utils.EMCVMAXUtils,
|
||||||
|
'find_controller_configuration_service',
|
||||||
|
return_value=None)
|
||||||
|
driver = emc_vmax_iscsi.EMCVMAXISCSIDriver(
|
||||||
|
configuration=self.configuration)
|
||||||
|
driver.db = FakeDB()
|
||||||
|
self.driver = driver
|
||||||
|
|
||||||
|
@mock.patch.object(
|
||||||
|
emc_vmax_common.EMCVMAXCommon,
|
||||||
|
'_find_lun',
|
||||||
|
return_value=(
|
||||||
|
{'SystemName': EMCVMAXCommonData.storage_system}))
|
||||||
|
def test_populate_masking_dict(self, mock_find_lun):
|
||||||
|
extraSpecs = {'storagetype:pool': u'SRP_1',
|
||||||
|
'volume_backend_name': 'INITIATOR_BE',
|
||||||
|
'storagetype:array': u'1234567891011',
|
||||||
|
'isV3': True,
|
||||||
|
'portgroupname': u'OS-portgroup-PG',
|
||||||
|
'storagetype:slo': u'Diamond',
|
||||||
|
'storagetype:workload': u'DSS'}
|
||||||
|
connector = self.data.connector
|
||||||
|
maskingViewDict = self.driver.common._populate_masking_dict(
|
||||||
|
self.data.test_volume, connector, extraSpecs)
|
||||||
|
self.assertTrue(maskingViewDict['initiatorCheck'])
|
||||||
|
|
|
@ -77,8 +77,12 @@ SNAPVX_REPLICATION_TYPE = 6
|
||||||
emc_opts = [
|
emc_opts = [
|
||||||
cfg.StrOpt('cinder_emc_config_file',
|
cfg.StrOpt('cinder_emc_config_file',
|
||||||
default=CINDER_EMC_CONFIG_FILE,
|
default=CINDER_EMC_CONFIG_FILE,
|
||||||
help='use this file for cinder emc plugin '
|
help='Use this file for cinder emc plugin '
|
||||||
'config data'), ]
|
'config data'),
|
||||||
|
cfg.StrOpt('initiator_check',
|
||||||
|
default=False,
|
||||||
|
help='Use this value to enable '
|
||||||
|
'the initiator_check')]
|
||||||
|
|
||||||
CONF.register_opts(emc_opts)
|
CONF.register_opts(emc_opts)
|
||||||
|
|
||||||
|
@ -127,6 +131,7 @@ class EMCVMAXCommon(object):
|
||||||
self.provision = emc_vmax_provision.EMCVMAXProvision(prtcl)
|
self.provision = emc_vmax_provision.EMCVMAXProvision(prtcl)
|
||||||
self.provisionv3 = emc_vmax_provision_v3.EMCVMAXProvisionV3(prtcl)
|
self.provisionv3 = emc_vmax_provision_v3.EMCVMAXProvisionV3(prtcl)
|
||||||
self.version = version
|
self.version = version
|
||||||
|
self.initiatorCheck = False
|
||||||
self._gather_info()
|
self._gather_info()
|
||||||
|
|
||||||
def _gather_info(self):
|
def _gather_info(self):
|
||||||
|
@ -1355,6 +1360,21 @@ class EMCVMAXCommon(object):
|
||||||
configGroup)
|
configGroup)
|
||||||
return extraSpecs, configurationFile, qosSpecs
|
return extraSpecs, configurationFile, qosSpecs
|
||||||
|
|
||||||
|
def _get_initiator_check_flag(self):
|
||||||
|
"""Reads the configuration for initator_check flag.
|
||||||
|
|
||||||
|
:returns: flag
|
||||||
|
"""
|
||||||
|
|
||||||
|
confString = (
|
||||||
|
self.configuration.safe_get('initiator_check'))
|
||||||
|
retVal = False
|
||||||
|
stringTrue = "True"
|
||||||
|
if confString:
|
||||||
|
if confString.lower() == stringTrue.lower():
|
||||||
|
retVal = True
|
||||||
|
return retVal
|
||||||
|
|
||||||
def _get_ecom_connection(self):
|
def _get_ecom_connection(self):
|
||||||
"""Get the ecom connection.
|
"""Get the ecom connection.
|
||||||
|
|
||||||
|
@ -1925,6 +1945,10 @@ class EMCVMAXCommon(object):
|
||||||
maskingViewDict['volumeInstance'] = volumeInstance
|
maskingViewDict['volumeInstance'] = volumeInstance
|
||||||
maskingViewDict['volumeName'] = volumeName
|
maskingViewDict['volumeName'] = volumeName
|
||||||
maskingViewDict['storageSystemName'] = storageSystemName
|
maskingViewDict['storageSystemName'] = storageSystemName
|
||||||
|
if self._get_initiator_check_flag():
|
||||||
|
maskingViewDict['initiatorCheck'] = True
|
||||||
|
else:
|
||||||
|
maskingViewDict['initiatorCheck'] = False
|
||||||
|
|
||||||
return maskingViewDict
|
return maskingViewDict
|
||||||
|
|
||||||
|
|
|
@ -335,8 +335,10 @@ class EMCVMAXMasking(object):
|
||||||
connector = maskingViewDict['connector']
|
connector = maskingViewDict['connector']
|
||||||
storageSystemName = maskingViewDict['storageSystemName']
|
storageSystemName = maskingViewDict['storageSystemName']
|
||||||
maskingViewName = maskingViewDict['maskingViewName']
|
maskingViewName = maskingViewDict['maskingViewName']
|
||||||
|
checkInitiator = maskingViewDict['initiatorCheck']
|
||||||
|
|
||||||
# First verify that the initiator group matches the initiators.
|
# First verify that the initiator group matches the initiators.
|
||||||
|
if checkInitiator:
|
||||||
errorMessage = self._check_existing_initiator_group(
|
errorMessage = self._check_existing_initiator_group(
|
||||||
conn, controllerConfigService, maskingViewName,
|
conn, controllerConfigService, maskingViewName,
|
||||||
connector, storageSystemName, igGroupName, extraSpecs)
|
connector, storageSystemName, igGroupName, extraSpecs)
|
||||||
|
|
Loading…
Reference in New Issue