diff -Nru python-os-brick-1.2.0/debian/changelog python-os-brick-1.2.0/debian/changelog --- python-os-brick-1.2.0/debian/changelog 2016-04-04 17:09:28.000000000 -0300 +++ python-os-brick-1.2.0/debian/changelog 2016-11-07 11:32:40.000000000 -0300 @@ -1,3 +1,10 @@ +python-os-brick (1.2.0-3ubuntu0.1) xenial; urgency=medium + + * d/p/fix-wrong-path-used-in-iscsi-multipath-l.patch: Backport + fix for ERROR "can't get udev device" when iscsi multipath enabled (LP: #1585940). + + -- Edward Hope-Morley Thu, 27 Oct 2016 16:14:42 +0100 + python-os-brick (1.2.0-2) unstable; urgency=medium * Uploading to unstable. diff -Nru python-os-brick-1.2.0/debian/patches/fix-wrong-path-used-in-iscsi-multipath-l.patch python-os-brick-1.2.0/debian/patches/fix-wrong-path-used-in-iscsi-multipath-l.patch --- python-os-brick-1.2.0/debian/patches/fix-wrong-path-used-in-iscsi-multipath-l.patch 1969-12-31 21:00:00.000000000 -0300 +++ python-os-brick-1.2.0/debian/patches/fix-wrong-path-used-in-iscsi-multipath-l.patch 2016-11-03 11:38:12.000000000 -0300 @@ -0,0 +1,96 @@ +From b56ca528dd6a6644992cfc818fad1140b1ab22c2 Mon Sep 17 00:00:00 2001 +From: Peter Wang +Date: Thu, 2 Jun 2016 01:57:01 +0000 +Subject: [PATCH] Fix wrong path used in iscsi "multipath -l" + +When iSCSI multipath device path was not found via LUN wwn, +os-brick would use device path like below: +/dev/disk/by-path/ip-192.168.3.52:3260-iscsi-iqn.1992-04.com.emc:cx.apm00153906536.b5-lun-155 +to detch multipath id via 'multipath -l'. +This causes error: "can't get udev device" + +This fix will use path like '/dev/sda' to discover mpath id. + +Closes-bug: #1585940 +(cherry picked from commit 30f4fc763ea5c7298cd51398fa7464524531140b) +Change-Id: I1177d846a9f6f28b2276aae2ff91af9d4ea5849e +--- + os_brick/initiator/connector.py | 8 +++++--- + os_brick/tests/initiator/test_connector.py | 33 ++++++++++++++++++++++++++++++ + 2 files changed, 38 insertions(+), 3 deletions(-) + +diff --git a/os_brick/initiator/connector.py b/os_brick/initiator/connector.py +index f6ef172..c7eb8bf 100644 +--- a/os_brick/initiator/connector.py ++++ b/os_brick/initiator/connector.py +@@ -311,18 +311,20 @@ class InitiatorConnector(executor.Executor): + multipath_id = None + + if path is None: ++ # find_multipath_device only accept realpath not symbolic path ++ device_realpath = os.path.realpath(device_name) + mpath_info = self._linuxscsi.find_multipath_device( +- device_name) ++ device_realpath) + if mpath_info: + device_path = mpath_info['device'] + multipath_id = device_wwn + else: + # we didn't find a multipath device. + # so we assume the kernel only sees 1 device +- device_path = self.host_device ++ device_path = device_name + LOG.debug("Unable to find multipath device name for " + "volume. Using path %(device)s for volume.", +- {'device': self.host_device}) ++ {'device': device_path}) + else: + device_path = path + multipath_id = device_wwn +diff --git a/os_brick/tests/initiator/test_connector.py b/os_brick/tests/initiator/test_connector.py +index 9c33463..df49787 100644 +--- a/os_brick/tests/initiator/test_connector.py ++++ b/os_brick/tests/initiator/test_connector.py +@@ -364,6 +364,39 @@ class ISCSIConnectorTestCase(ConnectorTestCase): + 'multipath_id': FAKE_SCSI_WWN} + self.assertEqual(expected_result, result) + ++ @mock.patch.object(linuxscsi.LinuxSCSI, 'find_multipath_device_path') ++ @mock.patch.object(linuxscsi.LinuxSCSI, 'find_multipath_device') ++ @mock.patch.object(os.path, 'realpath') ++ def test_discover_mpath_device_by_realpath(self, mock_realpath, ++ mock_multipath_device, ++ mock_multipath_device_path): ++ location1 = '10.0.2.15:3260' ++ location2 = '[2001:db8::1]:3260' ++ name1 = 'volume-00000001-1' ++ name2 = 'volume-00000001-2' ++ iqn1 = 'iqn.2010-10.org.openstack:%s' % name1 ++ iqn2 = 'iqn.2010-10.org.openstack:%s' % name2 ++ fake_multipath_dev = None ++ fake_raw_dev = '/dev/disk/by-path/fake-raw-lun' ++ vol = {'id': 1, 'name': name1} ++ connection_properties = self.iscsi_connection_multipath( ++ vol, [location1, location2], [iqn1, iqn2], [1, 2]) ++ mock_multipath_device_path.return_value = fake_multipath_dev ++ mock_multipath_device.return_value = { ++ 'device': '/dev/mapper/%s' % FAKE_SCSI_WWN} ++ mock_realpath.return_value = '/dev/sdvc' ++ (result_path, result_mpath_id) = ( ++ self.connector_with_multipath._discover_mpath_device( ++ FAKE_SCSI_WWN, ++ connection_properties['data'], ++ fake_raw_dev)) ++ mock_multipath_device.assert_called_with('/dev/sdvc') ++ result = {'path': result_path, 'multipath_id': result_mpath_id} ++ expected_result = {'path': '/dev/mapper/%s' % FAKE_SCSI_WWN, ++ 'multipath_id': FAKE_SCSI_WWN} ++ self.assertEqual(expected_result, result) ++ ++ @mock.patch('time.sleep', mock.Mock()) + def _test_connect_volume(self, extra_props, additional_commands, + transport=None, disconnect_mock=None): + # for making sure the /dev/disk/by-path is gone +-- +2.7.4 + diff -Nru python-os-brick-1.2.0/debian/patches/series python-os-brick-1.2.0/debian/patches/series --- python-os-brick-1.2.0/debian/patches/series 2016-04-04 17:09:28.000000000 -0300 +++ python-os-brick-1.2.0/debian/patches/series 2016-11-03 11:38:12.000000000 -0300 @@ -1,2 +1,3 @@ drop-reno-sphinxext.patch removes-privacy-breach-in-docs.patch +fix-wrong-path-used-in-iscsi-multipath-l.patch