Browse Source

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
tags/mitaka-eol^0
Gorka Eguileor 3 years ago
parent
commit
b59e1224c7
2 changed files with 3 additions and 3 deletions
  1. 1
    1
      os_brick/initiator/linuxscsi.py
  2. 2
    2
      os_brick/tests/initiator/test_linuxscsi.py

+ 1
- 1
os_brick/initiator/linuxscsi.py View File

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

+ 2
- 2
os_brick/tests/initiator/test_linuxscsi.py View File

@@ -165,11 +165,11 @@ class LinuxSCSITestCase(base.TestCase):
165 165
 
166 166
         self.linuxscsi.remove_multipath_device('/dev/dm-3')
167 167
         expected_commands = [
168
+            ('multipath -f 350002ac20398383d'),
168 169
             ('blockdev --flushbufs /dev/sde'),
169 170
             ('tee -a /sys/block/sde/device/delete'),
170 171
             ('blockdev --flushbufs /dev/sdf'),
171
-            ('tee -a /sys/block/sdf/device/delete'),
172
-            ('multipath -f 350002ac20398383d'), ]
172
+            ('tee -a /sys/block/sdf/device/delete'), ]
173 173
         self.assertEqual(expected_commands, self.cmds)
174 174
 
175 175
     def test_find_multipath_device_3par_ufn(self):

Loading…
Cancel
Save