Merge "Fix iSCSI disconnect_volume when flush fails"
This commit is contained in:
commit
cbf014a08a
@ -956,13 +956,18 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector):
|
||||
self._disconnect_connection(connection_properties, disconnect, force,
|
||||
exc)
|
||||
|
||||
# If flushing the multipath failed before, try now after we have
|
||||
# removed the devices and we may have even logged off (only reaches
|
||||
# here with multipath_name if force=True).
|
||||
# If flushing the multipath failed before, remove the multipath device
|
||||
# map from multipathd monitoring (only reaches here with multipath_name
|
||||
# if force=True).
|
||||
if multipath_name:
|
||||
LOG.debug('Flushing again multipath %s now that we removed the '
|
||||
'devices.', multipath_name)
|
||||
self._linuxscsi.flush_multipath_device(multipath_name)
|
||||
LOG.debug('Removing multipath device map %s to stop multipathd '
|
||||
'from monitoring the device.', multipath_name)
|
||||
# We are passing sysfs mpath name here (dm-*) which is used
|
||||
# in the multipath_del_map method to fetch the DM name (multipath
|
||||
# device name i.e. SCSI WWID if user friendly names are OFF else
|
||||
# the configured user friendly name).
|
||||
with exc.context(force, 'Deleting map %s failed', multipath_name):
|
||||
self._linuxscsi.multipath_del_map(multipath_name)
|
||||
|
||||
if exc:
|
||||
LOG.warning('There were errors removing %s, leftovers may remain '
|
||||
|
@ -721,11 +721,12 @@ class ISCSIConnectorTestCase(test_connector.ConnectorTestCase):
|
||||
mock.Mock(return_value=True))
|
||||
@mock.patch.object(iscsi.ISCSIConnector, '_disconnect_connection')
|
||||
@mock.patch.object(iscsi.ISCSIConnector, '_get_connection_devices')
|
||||
@mock.patch.object(linuxscsi.LinuxSCSI, 'flush_multipath_device')
|
||||
@mock.patch.object(linuxscsi.LinuxSCSI, 'remove_connection',
|
||||
return_value=mock.sentinel.mp_name)
|
||||
def test_cleanup_connection_force_failure(self, remove_mock, flush_mock,
|
||||
con_devs_mock, discon_mock):
|
||||
@mock.patch.object(linuxscsi.LinuxSCSI, 'multipath_del_map')
|
||||
def test_cleanup_connection_force_failure(self, remove_map_mock,
|
||||
remove_mock, con_devs_mock,
|
||||
discon_mock):
|
||||
|
||||
# Return an ordered dicts instead of normal dict for discon_mock.assert
|
||||
con_devs_mock.return_value = collections.OrderedDict((
|
||||
@ -749,7 +750,7 @@ class ISCSIConnectorTestCase(test_connector.ConnectorTestCase):
|
||||
self.CON_PROPS,
|
||||
[('ip1:port1', 'tgt1'), ('ip3:port3', 'tgt3')],
|
||||
mock.sentinel.force, mock.ANY)
|
||||
flush_mock.assert_called_once_with(mock.sentinel.mp_name)
|
||||
remove_map_mock.assert_called_once_with(mock.sentinel.mp_name)
|
||||
|
||||
def test_cleanup_connection_no_data_discoverydb(self):
|
||||
self.connector.use_multipath = True
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
`Bug #2012251 <https://bugs.launchpad.net/os-brick/+bug/2012251>`_: Fixed
|
||||
issue when disconnecting iSCSI volume when ``force`` and ``ignore_errors``
|
||||
are set to ``True`` and flushing multipath device fails.
|
Loading…
Reference in New Issue
Block a user