From 66520dcf6c1815f555eed4a241edf475d6ed0fee Mon Sep 17 00:00:00 2001 From: Gorka Eguileor Date: Wed, 12 Jul 2017 20:04:57 +0200 Subject: [PATCH] Return WWN in multipath_id When we refactored the iSCSI connect mechanism we inadvertently changed the value returned for the "multipath_id" key. This patch fixes this and return the WWN as the value again. This value is used by the encryption mechanism and expects it to be the WWN. Related-Bug: #1703954 Change-Id: Ia6d96a1e3a71488b44b3ca2323610a8f0a7cf675 --- os_brick/initiator/connectors/iscsi.py | 2 +- os_brick/tests/initiator/connectors/test_iscsi.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/os_brick/initiator/connectors/iscsi.py b/os_brick/initiator/connectors/iscsi.py index 599d22664..116fb5d9b 100644 --- a/os_brick/initiator/connectors/iscsi.py +++ b/os_brick/initiator/connectors/iscsi.py @@ -542,7 +542,7 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector): result = {'type': 'block', 'scsi_wwn': wwn, 'path': device} if mpath: - result['multipath_id'] = mpath + result['multipath_id'] = wwn return result @utils.retry(exceptions=(exception.VolumeDeviceNotFound)) diff --git a/os_brick/tests/initiator/connectors/test_iscsi.py b/os_brick/tests/initiator/connectors/test_iscsi.py index 07d0a360b..3cf42eeae 100644 --- a/os_brick/tests/initiator/connectors/test_iscsi.py +++ b/os_brick/tests/initiator/connectors/test_iscsi.py @@ -1107,7 +1107,7 @@ Setting up iSCSI targets: unused res = self.connector._connect_multipath_volume(self.CON_PROPS) - expected = {'type': 'block', 'scsi_wwn': 'wwn', 'multipath_id': 'dm-0', + expected = {'type': 'block', 'scsi_wwn': 'wwn', 'multipath_id': 'wwn', 'path': '/dev/dm-0'} self.assertEqual(expected, res) @@ -1176,7 +1176,7 @@ Setting up iSCSI targets: unused res = self.connector._connect_multipath_volume(self.CON_PROPS) - expected = {'type': 'block', 'scsi_wwn': 'wwn', 'multipath_id': 'dm-0', + expected = {'type': 'block', 'scsi_wwn': 'wwn', 'multipath_id': 'wwn', 'path': '/dev/dm-0'} self.assertEqual(expected, res) self.assertEqual(1, get_wwn_mock.call_count) @@ -1386,7 +1386,7 @@ Setting up iSCSI targets: unused res = self.connector._get_connect_result(props, 'wwn', ['sda', 'sdb'], 'mpath') expected = {'type': 'block', 'scsi_wwn': 'wwn', 'path': '/dev/mpath', - 'multipath_id': 'mpath'} + 'multipath_id': 'wwn'} self.assertDictEqual(expected, res) get_link_mock.assert_not_called()