Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Cloud:OpenStack:Icehouse
openstack-cinder-doc
0001-remove_multipath_device-is-used-incorrectl...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-remove_multipath_device-is-used-incorrectly.patch of Package openstack-cinder-doc
From eda5d4e0ed6af371d861fa52e106e55873babf2e Mon Sep 17 00:00:00 2001 From: Jeegn Chen <jeegn.chen@emc.com> Date: Thu, 7 Aug 2014 18:44:58 +0800 Subject: [PATCH] remove_multipath_device is used incorrectly In cinder/brick/initiator/connector.py, here is how remove_multipath_device is used in ISCSIConnector.disconnect_volume. remove_multipath_device will do nothing due to this use. multipath_device = self._get_multipath_device_name(host_device) if multipath_device: device_realpath = os.path.realpath(host_device) self._linuxscsi.remove_multipath_device(device_realpath) But LinuxSCSI.remove_multipath_device is expecting a device UUID instead of device_realpath. The code should be changed to multipath_device = self._get_multipath_device_name(host_device) if multipath_device: self._linuxscsi.remove_multipath_device( multipath_device.split('/')[-1]) Change-Id: Ifc081f58eecae4398ea87e216c3e13c1e1b90e07 Closes-Bug: #1353889 --- cinder/brick/initiator/connector.py | 5 +++-- cinder/tests/brick/test_brick_connector.py | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) Index: cinder-2014.1.3.dev3.g110fa78/cinder/brick/initiator/connector.py =================================================================== --- cinder-2014.1.3.dev3.g110fa78.orig/cinder/brick/initiator/connector.py +++ cinder-2014.1.3.dev3.g110fa78/cinder/brick/initiator/connector.py @@ -272,10 +272,11 @@ class ISCSIConnector(InitiatorConnector) multipath_device = None if self.use_multipath: self._rescan_multipath() + # multipath_device == None or /dev/mapper/<multipath_id> multipath_device = self._get_multipath_device_name(host_device) if multipath_device: - device_realpath = os.path.realpath(host_device) - self._linuxscsi.remove_multipath_device(device_realpath) + self._linuxscsi.remove_multipath_device( + multipath_device.split('/')[-1]) return self._disconnect_volume_multipath_iscsi( connection_properties, multipath_device) Index: cinder-2014.1.3.dev3.g110fa78/cinder/tests/brick/test_brick_connector.py =================================================================== --- cinder-2014.1.3.dev3.g110fa78.orig/cinder/tests/brick/test_brick_connector.py +++ cinder-2014.1.3.dev3.g110fa78/cinder/tests/brick/test_brick_connector.py @@ -314,6 +314,31 @@ class ISCSIConnectorTestCase(ConnectorTe # Target in use by other mp devices, don't disconnect self.assertEqual([], result) + def test_disconnect_volume_using_remove_multipath_device(self): + mdev_id = '3600508e000000000c57de73d39c00b0e' + + def fake_remove_multipath_device(multipath_name): + if multipath_name != mdev_id: + raise Exception("Invalid multipath id") + self.connector_with_multipath =\ + connector.ISCSIConnector(None, use_multipath=True) + self.stubs.Set(self.connector_with_multipath, + '_rescan_iscsi', lambda: None) + self.stubs.Set(self.connector_with_multipath, + '_get_device_path', lambda x: None) + self.stubs.Set(self.connector_with_multipath, + '_rescan_multipath', lambda: None) + self.stubs.Set(self.connector_with_multipath, + '_get_multipath_device_name', + lambda x: '/dev/mapper/' + mdev_id) + self.stubs.Set(self.connector_with_multipath._linuxscsi, + 'remove_multipath_device', + fake_remove_multipath_device) + self.stubs.Set(self.connector_with_multipath, + '_disconnect_volume_multipath_iscsi', + lambda x, y: None) + self.connector_with_multipath.disconnect_volume(None, None) + def test_disconnect_volume_multipath_iscsi_without_other_mp_devices(self): result = []
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor