Fix iSCSI multipath cleanup

Cleanup order for multipath in remove_multipath_device should be:
- Flush multipath (multipath -f device)
- Flush blockdev devices (blockdev --flushbufs device)
- Remove paths

But now we have:
- Flush blockdev devices (blockdev --flushbufs device)
- Flush multipath (multipath -f device)
- Remove paths

This patch sets the right order.

Closes-Bug: #1502999
backport: liberty
Change-Id: If9dc8f3450ed473393bdb76fe34d5ab78cf9306c
This commit is contained in:
Gorka Eguileor 2015-10-05 20:31:38 +02:00
parent 87e8f36293
commit 53173f78ef
2 changed files with 3 additions and 3 deletions

View File

@ -119,11 +119,11 @@ class LinuxSCSI(executor.Executor):
LOG.debug("remove multipath device %s", device) LOG.debug("remove multipath device %s", device)
mpath_dev = self.find_multipath_device(device) mpath_dev = self.find_multipath_device(device)
if mpath_dev: if mpath_dev:
self.flush_multipath_device(mpath_dev['id'])
devices = mpath_dev['devices'] devices = mpath_dev['devices']
LOG.debug("multipath LUNs to remove %s", devices) LOG.debug("multipath LUNs to remove %s", devices)
for device in devices: for device in devices:
self.remove_scsi_device(device['device']) self.remove_scsi_device(device['device'])
self.flush_multipath_device(mpath_dev['id'])
def flush_device_io(self, device): def flush_device_io(self, device):
"""This is used to flush any remaining IO in the buffers.""" """This is used to flush any remaining IO in the buffers."""

View File

@ -164,11 +164,11 @@ class LinuxSCSITestCase(base.TestCase):
self.linuxscsi.remove_multipath_device('/dev/dm-3') self.linuxscsi.remove_multipath_device('/dev/dm-3')
expected_commands = [ expected_commands = [
('multipath -f 350002ac20398383d'),
('blockdev --flushbufs /dev/sde'), ('blockdev --flushbufs /dev/sde'),
('tee -a /sys/block/sde/device/delete'), ('tee -a /sys/block/sde/device/delete'),
('blockdev --flushbufs /dev/sdf'), ('blockdev --flushbufs /dev/sdf'),
('tee -a /sys/block/sdf/device/delete'), ('tee -a /sys/block/sdf/device/delete'), ]
('multipath -f 350002ac20398383d'), ]
self.assertEqual(expected_commands, self.cmds) self.assertEqual(expected_commands, self.cmds)
def test_find_multipath_device_3par_ufn(self): def test_find_multipath_device_3par_ufn(self):