'online': True, 'pool-name': 'default',
'size': 1073741824, 'quota': 1073741824,
'perfpol-name': 'default', 'description': '',
- 'agent-type': 5, 'encryptionAttr': {'cipher': 3}},
+ 'agent-type': 5, 'encryptionAttr': {'cipher': 3},
+ 'multi-initiator': 'false'},
'sid': 'a9b9aba7'})
@mock.patch(NIMBLE_URLLIB2)
mock.Mock(return_value=[]))
@mock.patch.object(volume_types, 'get_volume_type_extra_specs',
mock.Mock(type_id=FAKE_TYPE_ID, return_value={
- 'nimble:perfpol-name': 'default',
- 'nimble:encryption': 'yes'}))
+ 'nimble:perfpol-name': 'default',
+ 'nimble:encryption': 'yes',
+ 'nimble:multi-initiator': 'false'}))
@NimbleDriverBaseTestCase.client_mock_decorator(create_configuration(
'nimble', 'nimble_pass', '10.18.108.55', 'default', '*'))
def test_create_volume_encryption_positive(self):
'online': True, 'pool-name': 'default',
'size': 1073741824, 'quota': 1073741824,
'perfpol-name': 'default', 'description': '',
- 'agent-type': 5, 'encryptionAttr': {'cipher': 2}},
+ 'agent-type': 5, 'encryptionAttr': {'cipher': 2},
+ 'multi-initiator': 'false'},
'sid': 'a9b9aba7'})
@mock.patch(NIMBLE_URLLIB2)
mock.Mock(return_value=[]))
@mock.patch.object(volume_types, 'get_volume_type_extra_specs',
mock.Mock(type_id=FAKE_TYPE_ID, return_value={
- 'nimble:perfpol-name': 'VMware ESX',
- 'nimble:encryption': 'no'}))
+ 'nimble:perfpol-name': 'VMware ESX',
+ 'nimble:encryption': 'no',
+ 'nimble:multi-initiator': 'false'}))
@NimbleDriverBaseTestCase.client_mock_decorator(create_configuration(
'nimble', 'nimble_pass', '10.18.108.55', 'default', '*'))
def test_create_volume_perfpolicy_positive(self):
'online': True, 'pool-name': 'default',
'size': 1073741824, 'quota': 1073741824,
'perfpol-name': 'VMware ESX', 'description': '',
- 'agent-type': 5, 'encryptionAttr': {'cipher': 3}},
+ 'agent-type': 5, 'encryptionAttr': {'cipher': 3},
+ 'multi-initiator': 'false'},
+ 'sid': 'a9b9aba7'})
+
+ @mock.patch(NIMBLE_URLLIB2)
+ @mock.patch(NIMBLE_CLIENT)
+ @mock.patch.object(obj_volume.VolumeList, 'get_all',
+ mock.Mock(return_value=[]))
+ @mock.patch.object(volume_types, 'get_volume_type_extra_specs',
+ mock.Mock(type_id=FAKE_TYPE_ID, return_value={
+ 'nimble:perfpol-name': 'default',
+ 'nimble:encryption': 'no',
+ 'nimble:multi-initiator': 'true'}))
+ @NimbleDriverBaseTestCase.client_mock_decorator(create_configuration(
+ 'nimble', 'nimble_pass', '10.18.108.55', 'default', '*'))
+ def test_create_volume_multi_initiator_positive(self):
+ self.mock_client_service.service.createVol.return_value = \
+ FAKE_CREATE_VOLUME_POSITIVE_RESPONSE_PERFPOLICY
+ self.mock_client_service.service.getVolInfo.return_value = \
+ FAKE_GET_VOL_INFO_RESPONSE
+ self.mock_client_service.service.getNetConfig.return_value = \
+ FAKE_POSITIVE_NETCONFIG_RESPONSE
+
+ self.assertEqual(
+ {'provider_location': '172.18.108.21:3260 iqn.test 0',
+ 'provider_auth': None},
+ self.driver.create_volume({'name': 'testvolume-perfpolicy',
+ 'size': 1,
+ 'volume_type_id': FAKE_TYPE_ID,
+ 'display_name': '',
+ 'display_description': ''}))
+
+ mock_volume_type = volume_types.get_volume_type_extra_specs
+ mock_volume_type.assert_called_once_with(FAKE_TYPE_ID)
+
+ self.mock_client_service.service.createVol.assert_called_once_with(
+ request={
+ 'attr': {'snap-quota': sys.maxsize,
+ 'warn-level': 858993459,
+ 'name': 'testvolume-perfpolicy', 'reserve': 0,
+ 'online': True, 'pool-name': 'default',
+ 'size': 1073741824, 'quota': 1073741824,
+ 'perfpol-name': 'default', 'description': '',
+ 'agent-type': 5, 'encryptionAttr': {'cipher': 3},
+ 'multi-initiator': 'true'},
'sid': 'a9b9aba7'})
@mock.patch(NIMBLE_URLLIB2)
DEFAULT_CIPHER = 3
EXTRA_SPEC_ENCRYPTION = 'nimble:encryption'
EXTRA_SPEC_PERF_POLICY = 'nimble:perfpol-name'
+EXTRA_SPEC_MULTI_INITIATOR = 'nimble:multi-initiator'
DEFAULT_PERF_POLICY_SETTING = 'default'
DEFAULT_ENCRYPTION_SETTING = 'no'
+DEFAULT_MULTI_INITIATOR_SETTING = 'false'
DEFAULT_SNAP_QUOTA = sys.maxsize
VOL_EDIT_MASK = 4 + 16 + 32 + 64 + 256 + 512
MANAGE_EDIT_MASK = 1 + 262144
DEFAULT_PERF_POLICY_SETTING)
encryption = extra_specs.get(EXTRA_SPEC_ENCRYPTION,
DEFAULT_ENCRYPTION_SETTING)
+ multi_initiator = extra_specs.get(EXTRA_SPEC_MULTI_INITIATOR,
+ DEFAULT_MULTI_INITIATOR_SETTING)
+ extra_specs_map = {}
+ extra_specs_map[EXTRA_SPEC_PERF_POLICY] = perf_policy_name
+ extra_specs_map[EXTRA_SPEC_ENCRYPTION] = encryption
+ extra_specs_map[EXTRA_SPEC_MULTI_INITIATOR] = multi_initiator
- return perf_policy_name, encryption
+ return extra_specs_map
@_connection_checker
@_response_checker
description = description[:254]
specs = self._get_volumetype_extraspecs(volume)
- perf_policy_name, encrypt = self._get_extra_spec_values(specs)
+ extra_specs_map = self._get_extra_spec_values(specs)
+ perf_policy_name = extra_specs_map[EXTRA_SPEC_PERF_POLICY]
+ encrypt = extra_specs_map[EXTRA_SPEC_ENCRYPTION]
+ multi_initiator = extra_specs_map[EXTRA_SPEC_MULTI_INITIATOR]
# default value of cipher for encryption
cipher = DEFAULT_CIPHER
if encrypt.lower() == 'yes':
' description=%(description)s with Extra Specs'
' perfpol-name=%(perfpol-name)s'
' encryption=%(encryption)s cipher=%(cipher)s'
- ' agent-type=%(agent-type)s',
+ ' agent-type=%(agent-type)s'
+ ' multi-initiator=%(multi-initiator)s',
{'vol': volume['name'],
'size': volume_size,
'reserve': reserve,
'perfpol-name': perf_policy_name,
'encryption': encrypt,
'cipher': cipher,
- 'agent-type': AGENT_TYPE_OPENSTACK})
+ 'agent-type': AGENT_TYPE_OPENSTACK,
+ 'multi-initiator': multi_initiator})
return self.client.service.createVol(
request={'sid': self.sid,
'pool-name': pool_name,
'agent-type': AGENT_TYPE_OPENSTACK,
'perfpol-name': perf_policy_name,
- 'encryptionAttr': {'cipher': cipher}}})
+ 'encryptionAttr': {'cipher': cipher},
+ 'multi-initiator': multi_initiator}})
def create_vol(self, volume, pool_name, reserve):
"""Execute createVol API."""