Merge "FC Eliminate the need to return devices list"

This commit is contained in:
Jenkins 2015-07-01 21:10:22 +00:00 committed by Gerrit Code Review
commit f3d2dae4cb
2 changed files with 10 additions and 7 deletions

View File

@ -860,21 +860,15 @@ class FibreChannelConnector(InitiatorConnector):
LOG.debug("Multipath device discovered %(device)s",
{'device': mdev_info['device']})
device_path = mdev_info['device']
devices = mdev_info['devices']
device_info['multipath_id'] = mdev_info['id']
else:
# we didn't find a multipath device.
# so we assume the kernel only sees 1 device
device_path = self.host_device
dev_info = self._linuxscsi.get_device_info(self.device_name)
devices = [dev_info]
else:
device_path = self.host_device
dev_info = self._linuxscsi.get_device_info(self.device_name)
devices = [dev_info]
device_info['path'] = device_path
device_info['devices'] = devices
return device_info
def _get_host_devices(self, possible_devs, lun):
@ -929,7 +923,6 @@ class FibreChannelConnector(InitiatorConnector):
target_wwn - iSCSI Qualified Name
target_lun - LUN id of the volume
"""
devices = device_info['devices']
# If this is a multipath device, we need to search again
# and make sure we remove all the devices. Some of them
@ -940,6 +933,15 @@ class FibreChannelConnector(InitiatorConnector):
devices = mdev_info['devices']
LOG.debug("devices to remove = %s", devices)
self._linuxscsi.flush_multipath_device(multipath_id)
else:
device = device_info['path']
# now resolve this to a /dev/sdX path
if os.path.exists(device):
# get the /dev/sdX device from the
# /dev/disk/by-path entry
dev_name = os.path.realpath(device)
dev_info = self._linuxscsi.get_device_info(dev_name)
devices = [dev_info]
self._remove_devices(connection_properties, devices)

View File

@ -942,6 +942,7 @@ class FibreChannelConnectorTestCase(ConnectorTestCase):
exp_wwn)
self.assertEqual(dev_info['type'], 'block')
self.assertEqual(dev_info['path'], dev_str)
self.assertTrue('devices' not in dev_info)
self.connector.disconnect_volume(connection_info['data'], dev_info)
expected_commands = []