VMAX Driver - disable initiator check by default
For each existing masking view we check if the initiator group matches with the initiators of the compute host. The is a very expensive check and should be turned off by default. To turn it back on we will put a initiator_check flag in the cinder.conf Change-Id: Ia0677bafe9d586e9e65cd0d63924259f9a2e6ee8 Closes-Bug: #1663312
This commit is contained in:
parent
b877bca044
commit
81aae7f712
|
@ -10133,3 +10133,91 @@ class EMCV3ReplicationTest(test.TestCase):
|
|||
self.assertRaises(exception.VolumeBackendAPIException,
|
||||
self.driver.failover_host,
|
||||
'context', volumes, 'default')
|
||||
|
||||
|
||||
class VMAXInitiatorCheckFalseTest(test.TestCase):
|
||||
def setUp(self):
|
||||
self.data = VMAXCommonData()
|
||||
|
||||
super(VMAXInitiatorCheckFalseTest, self).setUp()
|
||||
|
||||
configuration = mock.Mock()
|
||||
configuration.safe_get.return_value = 'initiatorCheckTest'
|
||||
configuration.config_group = 'initiatorCheckTest'
|
||||
|
||||
common.VMAXCommon._gather_info = mock.Mock()
|
||||
instancename = FakeCIMInstanceName()
|
||||
self.mock_object(utils.VMAXUtils, 'get_instance_name',
|
||||
instancename.fake_getinstancename)
|
||||
self.mock_object(common.VMAXCommon, '_get_ecom_connection',
|
||||
FakeEcomConnection())
|
||||
self.mock_object(utils.VMAXUtils,
|
||||
'find_controller_configuration_service',
|
||||
return_value=None)
|
||||
driver = iscsi.VMAXISCSIDriver(configuration=configuration)
|
||||
driver.db = FakeDB()
|
||||
self.driver = driver
|
||||
|
||||
@mock.patch.object(
|
||||
common.VMAXCommon,
|
||||
'_find_lun',
|
||||
return_value=(
|
||||
{'SystemName': VMAXCommonData.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 = VMAXCommonData()
|
||||
|
||||
super(VMAXInitiatorCheckTrueTest, self).setUp()
|
||||
|
||||
self.configuration = mock.Mock(
|
||||
replication_device={},
|
||||
initiator_check='True',
|
||||
config_group='initiatorCheckTest')
|
||||
|
||||
def safe_get(key):
|
||||
return getattr(self.configuration, key)
|
||||
self.configuration.safe_get = safe_get
|
||||
common.VMAXCommon._gather_info = mock.Mock()
|
||||
instancename = FakeCIMInstanceName()
|
||||
self.mock_object(utils.VMAXUtils, 'get_instance_name',
|
||||
instancename.fake_getinstancename)
|
||||
self.mock_object(common.VMAXCommon, '_get_ecom_connection',
|
||||
FakeEcomConnection())
|
||||
self.mock_object(utils.VMAXUtils,
|
||||
'find_controller_configuration_service',
|
||||
return_value=None)
|
||||
driver = iscsi.VMAXISCSIDriver(configuration=self.configuration)
|
||||
driver.db = FakeDB()
|
||||
self.driver = driver
|
||||
|
||||
@mock.patch.object(
|
||||
common.VMAXCommon,
|
||||
'_find_lun',
|
||||
return_value=(
|
||||
{'SystemName': VMAXCommonData.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'])
|
||||
|
|
|
@ -95,7 +95,11 @@ emc_opts = [
|
|||
cfg.StrOpt('multi_pool_support',
|
||||
default=False,
|
||||
help='Use this value to specify '
|
||||
'multi-pool support for VMAX3')]
|
||||
'multi-pool support for VMAX3'),
|
||||
cfg.StrOpt('initiator_check',
|
||||
default=False,
|
||||
help='Use this value to enable '
|
||||
'the initiator_check')]
|
||||
|
||||
CONF.register_opts(emc_opts)
|
||||
|
||||
|
@ -155,6 +159,7 @@ class VMAXCommon(object):
|
|||
self.failover = False
|
||||
self._get_replication_info()
|
||||
self.multiPoolSupportEnabled = False
|
||||
self.initiatorCheck = False
|
||||
self._gather_info()
|
||||
|
||||
def _gather_info(self):
|
||||
|
@ -1635,7 +1640,7 @@ class VMAXCommon(object):
|
|||
return extraSpecs, configurationFile, qosSpecs
|
||||
|
||||
def _get_multi_pool_support_enabled_flag(self):
|
||||
"""Reads the configuration fpr multi pool support flag.
|
||||
"""Reads the configuration for multi pool support flag.
|
||||
|
||||
:returns: MultiPoolSupportEnabled flag
|
||||
"""
|
||||
|
@ -1649,6 +1654,21 @@ class VMAXCommon(object):
|
|||
retVal = True
|
||||
return retVal
|
||||
|
||||
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):
|
||||
"""Get the ecom connection.
|
||||
|
||||
|
@ -2247,6 +2267,10 @@ class VMAXCommon(object):
|
|||
maskingViewDict['volumeInstance'] = volumeInstance
|
||||
maskingViewDict['volumeName'] = volumeName
|
||||
maskingViewDict['storageSystemName'] = storageSystemName
|
||||
if self._get_initiator_check_flag():
|
||||
maskingViewDict['initiatorCheck'] = True
|
||||
else:
|
||||
maskingViewDict['initiatorCheck'] = False
|
||||
|
||||
return maskingViewDict
|
||||
|
||||
|
|
|
@ -343,14 +343,16 @@ class VMAXMasking(object):
|
|||
connector = maskingViewDict['connector']
|
||||
storageSystemName = maskingViewDict['storageSystemName']
|
||||
maskingViewName = maskingViewDict['maskingViewName']
|
||||
checkInitiator = maskingViewDict['initiatorCheck']
|
||||
|
||||
# First verify that the initiator group matches the initiators.
|
||||
errorMessage = self._check_existing_initiator_group(
|
||||
conn, controllerConfigService, maskingViewName,
|
||||
connector, storageSystemName, igGroupName, extraSpecs)
|
||||
if checkInitiator:
|
||||
errorMessage = self._check_existing_initiator_group(
|
||||
conn, controllerConfigService, maskingViewName,
|
||||
connector, storageSystemName, igGroupName, extraSpecs)
|
||||
|
||||
if errorMessage:
|
||||
return storageGroupInstanceName, errorMessage
|
||||
if errorMessage:
|
||||
return storageGroupInstanceName, errorMessage
|
||||
|
||||
storageGroupInstanceName, errorMessage = (
|
||||
self._check_existing_storage_group(
|
||||
|
|
Loading…
Reference in New Issue