Merge "iSCSI detect multipath DM with no WWN"
This commit is contained in:
commit
6974808cb5
|
@ -738,10 +738,10 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector):
|
||||||
# We have devices but we don't know the wwn yet
|
# We have devices but we don't know the wwn yet
|
||||||
if not wwn and found:
|
if not wwn and found:
|
||||||
wwn = self._linuxscsi.get_sysfs_wwn(found)
|
wwn = self._linuxscsi.get_sysfs_wwn(found)
|
||||||
# We have the wwn but not a multipath
|
if not mpath and found:
|
||||||
if wwn and not mpath:
|
|
||||||
mpath = self._linuxscsi.find_sysfs_multipath_dm(found)
|
mpath = self._linuxscsi.find_sysfs_multipath_dm(found)
|
||||||
if not (mpath or wwn_added):
|
# We have the wwn but not a multipath
|
||||||
|
if wwn and not(mpath or wwn_added):
|
||||||
# Tell multipathd that this wwn is a multipath and hint
|
# Tell multipathd that this wwn is a multipath and hint
|
||||||
# multipathd to recheck all the devices we have just
|
# multipathd to recheck all the devices we have just
|
||||||
# connected. We only do this once, since for any new
|
# connected. We only do this once, since for any new
|
||||||
|
|
|
@ -1211,6 +1211,42 @@ Setting up iSCSI targets: unused
|
||||||
self.assertGreaterEqual(find_dm_mock.call_count, 2)
|
self.assertGreaterEqual(find_dm_mock.call_count, 2)
|
||||||
self.assertEqual(4, connect_mock.call_count)
|
self.assertEqual(4, connect_mock.call_count)
|
||||||
|
|
||||||
|
@mock.patch.object(linuxscsi.LinuxSCSI, 'find_sysfs_multipath_dm',
|
||||||
|
side_effect=[None, 'dm-0'])
|
||||||
|
@mock.patch.object(linuxscsi.LinuxSCSI, 'get_sysfs_wwn', return_value='')
|
||||||
|
@mock.patch.object(linuxscsi.LinuxSCSI, 'multipath_add_path')
|
||||||
|
@mock.patch.object(linuxscsi.LinuxSCSI, 'multipath_add_wwid')
|
||||||
|
@mock.patch.object(iscsi.ISCSIConnector, '_connect_vol')
|
||||||
|
@mock.patch('os_brick.utils._time_sleep')
|
||||||
|
def test_connect_multipath_volume_no_wwid(self, sleep_mock, connect_mock,
|
||||||
|
add_wwid_mock, add_path_mock,
|
||||||
|
get_wwn_mock, find_dm_mock):
|
||||||
|
# Even if we don't have the wwn we'll be able to find the multipath
|
||||||
|
def my_connect(rescans, props, data):
|
||||||
|
devs = {'tgt1': 'sda', 'tgt2': 'sdb', 'tgt3': 'sdc', 'tgt4': 'sdd'}
|
||||||
|
data['stopped_threads'] += 1
|
||||||
|
data['num_logins'] += 1
|
||||||
|
dev = devs[props['target_iqn']]
|
||||||
|
data['found_devices'].append(dev)
|
||||||
|
data['just_added_devices'].append(dev)
|
||||||
|
|
||||||
|
connect_mock.side_effect = my_connect
|
||||||
|
|
||||||
|
res = self.connector._connect_multipath_volume(self.CON_PROPS)
|
||||||
|
|
||||||
|
expected = {'type': 'block', 'scsi_wwn': '', 'multipath_id': '',
|
||||||
|
'path': '/dev/dm-0'}
|
||||||
|
self.assertEqual(expected, res)
|
||||||
|
|
||||||
|
self.assertEqual(2, get_wwn_mock.call_count)
|
||||||
|
result = list(get_wwn_mock.call_args[0][0])
|
||||||
|
result.sort()
|
||||||
|
self.assertEqual(['sda', 'sdb', 'sdc', 'sdd'], result)
|
||||||
|
add_wwid_mock.assert_not_called()
|
||||||
|
add_path_mock.assert_not_called()
|
||||||
|
self.assertGreaterEqual(find_dm_mock.call_count, 2)
|
||||||
|
self.assertEqual(4, connect_mock.call_count)
|
||||||
|
|
||||||
@mock.patch.object(linuxscsi.LinuxSCSI, 'find_sysfs_multipath_dm',
|
@mock.patch.object(linuxscsi.LinuxSCSI, 'find_sysfs_multipath_dm',
|
||||||
side_effect=[None, 'dm-0'])
|
side_effect=[None, 'dm-0'])
|
||||||
@mock.patch.object(linuxscsi.LinuxSCSI, 'get_sysfs_wwn',
|
@mock.patch.object(linuxscsi.LinuxSCSI, 'get_sysfs_wwn',
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Improve iSCSI multipath detection to work even if we cannot find the
|
||||||
|
volume's WWN in sysfs.
|
||||||
|
(bug 1881619).
|
Loading…
Reference in New Issue