FC Eliminate the need to return devices list
This patch removes the need to build the list of devices found when multipath was not being used. At disconnect_volume time for FC, we now use the device path to discover the actual device information to remove the SCSI device from the system instead of relying on the devices list, which isn't used by multipath anymore. Change-Id: I5357c8cdf0976eee80120636f0a53f711db23016 Related-Bug: 1406161
This commit is contained in:
parent
fe28f0cb37
commit
f38a27f8c9
|
@ -853,21 +853,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):
|
||||
|
@ -922,7 +916,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
|
||||
|
@ -933,6 +926,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)
|
||||
|
||||
|
|
|
@ -941,6 +941,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 = []
|
||||
|
|
Loading…
Reference in New Issue