Add initiator target map in EMC SMI-S FC driver.
This patch add the initiator target map in initialize_connection and terminate_connection as it is required by the FC Zone Manager. Change-Id: I84729968b8e4e6ee74536fb28d3d921a9baf9f6e Closes-Bug: #1286694
This commit is contained in:
parent
6c346e848a
commit
f7d99b07f7
|
@ -1186,17 +1186,58 @@ class EMCSMISFCDriverTestCase(test.TestCase):
|
|||
self.data.test_volume['volume_type_id'] = None
|
||||
self.driver.create_volume(self.data.test_volume)
|
||||
|
||||
output = {'driver_volume_type': 'fibre_channel',
|
||||
'data': {'target_lun': 0,
|
||||
'target_wwn': ['1234567890123', '0987654321321'],
|
||||
'target_discovered': True}}
|
||||
output = {
|
||||
'driver_volume_type': 'fibre_channel',
|
||||
'data': {
|
||||
'target_lun': 0,
|
||||
'target_wwn': ['1234567890123', '0987654321321'],
|
||||
'target_discovered': True,
|
||||
'initiator_target_map': {'123456789012345':
|
||||
['1234567890123', '0987654321321'],
|
||||
'123456789054321':
|
||||
['1234567890123', '0987654321321'],
|
||||
}}}
|
||||
|
||||
connection_info = self.driver.initialize_connection(
|
||||
self.data.test_volume,
|
||||
self.data.connector)
|
||||
self.assertEqual(connection_info, output)
|
||||
|
||||
self.driver.terminate_connection(self.data.test_volume,
|
||||
self.data.connector)
|
||||
connection_info = self.driver.terminate_connection(
|
||||
self.data.test_volume,
|
||||
self.data.connector)
|
||||
|
||||
# Verify calls in terminate_connection are executed
|
||||
conf_service = {}
|
||||
conf_service['SystemName'] = self.data.storage_system
|
||||
conf_service['CreationClassName'] =\
|
||||
self.data.ctrlconf_service_creationclass
|
||||
|
||||
vol_instance = self.driver.common._find_lun(self.data.test_volume)
|
||||
|
||||
expected = [
|
||||
mock.call._get_ecom_connection(),
|
||||
mock.call.find_device_number(self.data.test_volume),
|
||||
mock.call._find_lun(self.data.test_volume),
|
||||
mock.call.self._find_controller_configuration_service(
|
||||
self.data.storage_system),
|
||||
mock.call._remove_members(conf_service, vol_instance),
|
||||
mock.call.get_target_wwns(
|
||||
self.data.storage_system,
|
||||
self.data.connector)]
|
||||
|
||||
output = {
|
||||
'driver_volume_type': 'fibre_channel',
|
||||
'data': {
|
||||
'target_wwn': ['1234567890123', '0987654321321'],
|
||||
'initiator_target_map': {'123456789012345':
|
||||
['1234567890123', '0987654321321'],
|
||||
'123456789054321':
|
||||
['1234567890123', '0987654321321'],
|
||||
}}}
|
||||
|
||||
self.assertEqual(connection_info, output)
|
||||
|
||||
self.driver.delete_volume(self.data.test_volume)
|
||||
|
||||
def test_create_volume_failed(self):
|
|
@ -157,12 +157,14 @@ class EMCSMISFCDriver(driver.FibreChannelDriver):
|
|||
connector)
|
||||
device_number = device_info['hostlunid']
|
||||
storage_system = device_info['storagesystem']
|
||||
ports = self.common.get_target_wwns(storage_system, connector)
|
||||
target_wwns, init_targ_map = self._build_initiator_target_map(
|
||||
storage_system, connector)
|
||||
|
||||
data = {'driver_volume_type': 'fibre_channel',
|
||||
'data': {'target_lun': device_number,
|
||||
'target_discovered': True,
|
||||
'target_wwn': ports}}
|
||||
'target_wwn': target_wwns,
|
||||
'initiator_target_map': init_targ_map}}
|
||||
|
||||
LOG.debug(_('Return FC data: %(data)s.')
|
||||
% {'data': data})
|
||||
|
@ -173,6 +175,33 @@ class EMCSMISFCDriver(driver.FibreChannelDriver):
|
|||
"""Disallow connection from connector."""
|
||||
self.common.terminate_connection(volume, connector)
|
||||
|
||||
loc = volume['provider_location']
|
||||
name = eval(loc)
|
||||
storage_system = name['keybindings']['SystemName']
|
||||
target_wwns, init_targ_map = self._build_initiator_target_map(
|
||||
storage_system, connector)
|
||||
data = {'driver_volume_type': 'fibre_channel',
|
||||
'data': {'target_wwn': target_wwns,
|
||||
'initiator_target_map': init_targ_map}}
|
||||
|
||||
LOG.debug(_('Return FC data: %(data)s.')
|
||||
% {'data': data})
|
||||
|
||||
return data
|
||||
|
||||
def _build_initiator_target_map(self, storage_system, connector):
|
||||
"""Build the target_wwns and the initiator target map."""
|
||||
|
||||
target_wwns = self.common.get_target_wwns(storage_system, connector)
|
||||
|
||||
initiator_wwns = connector['wwpns']
|
||||
|
||||
init_targ_map = {}
|
||||
for initiator in initiator_wwns:
|
||||
init_targ_map[initiator] = target_wwns
|
||||
|
||||
return target_wwns, init_targ_map
|
||||
|
||||
def extend_volume(self, volume, new_size):
|
||||
"""Extend an existing volume."""
|
||||
self.common.extend_volume(volume, new_size)
|
||||
|
|
Loading…
Reference in New Issue