Browse Source

Pass multipath config while creating connector object

Currently we only pass the configured multipath option when getting
the connector properties and do not pass it when creating the
connector object which in turn does the multipathing in os-brick.
So we are only passing multipathing option to cinder for exporting &
mapping the volume to paths but not while creating the connector object
and hence doing multipathing partially.
This patch passes that option and fixes the stated issue.

Related-Bug: #1863983

Co-Authored-By: Gorka Eguileor <geguileo@redhat.com>

Change-Id: I82979c47ec9ec1dd6cc864d3827ab219177251f8
(cherry picked from commit 04e5ead7c0)
changes/20/786420/1
whoami-rajat 1 month ago
committed by Rajat Dhasmana
parent
commit
9bb857097e
3 changed files with 9 additions and 3 deletions
  1. +1
    -1
      glance_store/_drivers/cinder.py
  2. +4
    -1
      glance_store/tests/unit/test_cinder_store.py
  3. +4
    -1
      glance_store/tests/unit/test_multistore_cinder.py

+ 1
- 1
glance_store/_drivers/cinder.py View File

@ -628,7 +628,7 @@ class Store(glance_store.driver.Store):
connection_info = volume.initialize_connection(volume, properties)
conn = connector.InitiatorConnector.factory(
connection_info['driver_volume_type'], root_helper,
conn=connection_info)
conn=connection_info, use_multipath=use_multipath)
if connection_info['driver_volume_type'] == 'nfs':
if volume.encrypted:
volume.unreserve(volume)


+ 4
- 1
glance_store/tests/unit/test_cinder_store.py View File

@ -189,7 +189,7 @@ class TestCinderStore(base.StoreBaseTest,
mock.patch.object(cinder.Store, 'get_root_helper',
return_value=root_helper), \
mock.patch.object(connector.InitiatorConnector, 'factory',
side_effect=fake_factory):
side_effect=fake_factory) as fake_conn_obj:
with mock.patch.object(connector,
'get_connector_properties') as mock_conn:
@ -224,6 +224,9 @@ class TestCinderStore(base.StoreBaseTest,
None, 'glance_store', attach_mode,
host_name=socket.gethostname())
fake_volumes.detach.assert_called_once_with(fake_volume)
fake_conn_obj.assert_called_once_with(
mock.ANY, root_helper, conn=mock.ANY,
use_multipath=multipath_supported)
def test_open_cinder_volume_rw(self):
self._test_open_cinder_volume('wb', 'rw', None)


+ 4
- 1
glance_store/tests/unit/test_multistore_cinder.py View File

@ -219,7 +219,7 @@ class TestMultiCinderStore(base.MultiStoreBaseTest,
mock.patch.object(cinder.Store, 'get_root_helper',
return_value=root_helper), \
mock.patch.object(connector.InitiatorConnector, 'factory',
side_effect=fake_factory):
side_effect=fake_factory) as fake_conn_obj:
with mock.patch.object(connector,
'get_connector_properties') as mock_conn:
@ -238,6 +238,9 @@ class TestMultiCinderStore(base.MultiStoreBaseTest,
None, 'glance_store', attach_mode,
host_name=socket.gethostname())
fake_volumes.detach.assert_called_once_with(fake_volume)
fake_conn_obj.assert_called_once_with(
mock.ANY, root_helper, conn=mock.ANY,
use_multipath=multipath_supported)
def test_open_cinder_volume_rw(self):
self._test_open_cinder_volume('wb', 'rw', None)


Loading…
Cancel
Save