Merge "Fix getting wwpn information in infortrend driver for DS4000"

This commit is contained in:
Jenkins 2015-07-24 00:49:01 +00:00 committed by Gerrit Code Review
commit 1a75c9f12f
5 changed files with 141 additions and 2 deletions

View File

@ -1539,6 +1539,69 @@ Return: 0x0000
"""
return msg
def get_test_show_channel_r_model_diff_target_id(self):
return (0, [{
'Mode': 'Host',
'AID': '32',
'defClock': 'Auto',
'MCS': 'N/A',
'Ch': '0',
'BID': '33',
'curClock': '---',
'Width': '---',
'Type': 'FIBRE',
}, {
'Mode': 'Host',
'AID': '0',
'defClock': 'Auto',
'MCS': '0',
'Ch': '1',
'BID': '1',
'curClock': '---',
'Width': 'iSCSI',
'Type': 'NETWORK',
}, {
'Mode': 'Host',
'AID': '0',
'defClock': 'Auto',
'MCS': '1',
'Ch': '2',
'BID': '1',
'curClock': '---',
'Width': 'iSCSI',
'Type': 'NETWORK',
}, {
'Mode': 'Drive',
'AID': '---',
'defClock': '6.0 Gbps',
'MCS': 'N/A',
'Ch': '3',
'BID': '---',
'curClock': '6.0 Gbps',
'Width': 'SAS',
'Type': 'SAS',
}, {
'Mode': 'Host',
'AID': '0',
'defClock': 'Auto',
'MCS': '2',
'Ch': '4',
'BID': '1',
'curClock': '---',
'Width': 'iSCSI',
'Type': 'NETWORK',
}, {
'Mode': 'Host',
'AID': '48',
'defClock': 'Auto',
'MCS': 'N/A',
'Ch': '5',
'BID': '49',
'curClock': '---',
'Width': '---',
'Type': 'FIBRE',
}])
def get_test_show_channel_r_model(self):
return (0, [{
'Mode': 'Host',
@ -1821,6 +1884,29 @@ Return: 0x0000
'WWNN': self.fake_target_wwnns[0],
}])
def get_test_show_wwn_with_diff_target_id(self):
return (0, [{
'ID': 'AID:32',
'WWPN': self.fake_target_wwpns[0],
'CH': '0',
'WWNN': self.fake_target_wwnns[0],
}, {
'ID': 'BID:33',
'WWPN': self.fake_target_wwpns[2],
'CH': '0',
'WWNN': self.fake_target_wwnns[1],
}, {
'ID': 'AID:48',
'WWPN': self.fake_target_wwpns[1],
'CH': '5',
'WWNN': self.fake_target_wwnns[0],
}, {
'ID': 'BID:49',
'WWPN': self.fake_target_wwpns[3],
'CH': '5',
'WWNN': self.fake_target_wwnns[1],
}])
def get_test_show_wwn(self):
return (0, [{
'ID': 'AID:112',

View File

@ -356,6 +356,56 @@ class InfortrendFCCommonTestCase(InfortrendTestCass):
self.assertDictMatch(
properties, self.cli_data.test_fc_properties_zoning_r_model)
@mock.patch.object(common_cli.LOG, 'info', mock.Mock())
def test_initialize_connection_with_zoning_r_model_diff_target_id(self):
test_volume = self.cli_data.test_volume
test_connector = self.cli_data.test_connector_fc
test_initiator_wwpns = test_connector['wwpns']
test_partition_id = self.cli_data.fake_partition_id[0]
test_all_target_wwpns = self.cli_data.fake_target_wwpns[:]
test_all_target_wwpns[1] = self.cli_data.fake_target_wwpns[2]
test_all_target_wwpns[2] = self.cli_data.fake_target_wwpns[1]
test_lookup_map = self.cli_data.fake_lookup_map_r_model
mock_commands = {
'ShowChannel':
self.cli_data.get_test_show_channel_r_model_diff_target_id(),
'ShowMap': self.cli_data.get_test_show_map(),
'CreateMap': SUCCEED,
'ShowWWN': self.cli_data.get_test_show_wwn_with_diff_target_id(),
}
self._driver_setup(mock_commands)
self.driver.fc_lookup_service = mock.Mock()
get_device_mapping_from_network = (
self.driver.fc_lookup_service.get_device_mapping_from_network
)
get_device_mapping_from_network.return_value = test_lookup_map
properties = self.driver.initialize_connection(
test_volume, test_connector)
get_device_mapping_from_network.assert_has_calls(
[mock.call(test_connector['wwpns'], test_all_target_wwpns)])
expect_cli_cmd = [
mock.call('ShowChannel'),
mock.call('ShowMap'),
mock.call('ShowWWN'),
mock.call('CreateMap', 'part', test_partition_id, '5', '48', '0',
'wwn=%s' % test_initiator_wwpns[0]),
mock.call('CreateMap', 'part', test_partition_id, '0', '33', '0',
'wwn=%s' % test_initiator_wwpns[0]),
mock.call('CreateMap', 'part', test_partition_id, '5', '48', '0',
'wwn=%s' % test_initiator_wwpns[1]),
mock.call('CreateMap', 'part', test_partition_id, '0', '33', '0',
'wwn=%s' % test_initiator_wwpns[1]),
]
self._assert_cli_has_calls(expect_cli_cmd)
self.assertDictMatch(
properties, self.cli_data.test_fc_properties_zoning_r_model)
@mock.patch.object(common_cli.LOG, 'info', mock.Mock())
def test_terminate_connection(self):

View File

@ -155,9 +155,10 @@ class InfortrendCommon(object):
Version history:
1.0.0 - Initial driver
1.0.1 - Support DS4000
"""
VERSION = '1.0.0'
VERSION = '1.0.1'
constants = {
'ISCSI_PORT': 3260,
@ -1466,7 +1467,7 @@ class InfortrendCommon(object):
for entry in wwn_list:
channel_id = entry['CH']
if 'BID:113' == entry['ID']:
if 'BID' in entry['ID']:
slot_name = 'slot_b'
else:
slot_name = 'slot_a'

View File

@ -32,6 +32,7 @@ class InfortrendCLIFCDriver(driver.FibreChannelDriver):
Version history:
1.0.0 - Initial driver
1.0.1 - Support DS4000
"""
def __init__(self, *args, **kwargs):

View File

@ -30,6 +30,7 @@ class InfortrendCLIISCSIDriver(driver.ISCSIDriver):
Version history:
1.0.0 - Initial driver
1.0.1 - Support DS4000
"""
def __init__(self, *args, **kwargs):