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/1.6.0
Gorka Eguileor 3 years ago
parent
commit
53173f78ef
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

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

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

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

Loading…
Cancel
Save