summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwhoami-rajat <rajatdhasmana@gmail.com>2021-04-14 10:40:45 -0400
committerRajat Dhasmana <rajatdhasmana@gmail.com>2021-08-17 07:42:03 +0000
commite43a56fb9b772703214e39f3371cc2ff00e06d4d (patch)
treecfd04a73bbe462ca137105b6727de21f41b7675b
parentff8df6dc0e56e5c8305176140eb783bd9765b695 (diff)
downloadglance_store-stable/victoria.tar.gz
Pass multipath config while creating connector objectvictoria-em2.3.1stable/victoria
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 04e5ead7c000211a4c10104ed2bb65c9df7681ae) (cherry picked from commit 9bb857097e8847bf8c9c722f7ff5990dccb391cf)
-rw-r--r--glance_store/_drivers/cinder.py2
-rw-r--r--glance_store/tests/unit/test_cinder_store.py5
-rw-r--r--glance_store/tests/unit/test_multistore_cinder.py5
3 files changed, 9 insertions, 3 deletions
diff --git a/glance_store/_drivers/cinder.py b/glance_store/_drivers/cinder.py
index 2754017..b84c8b9 100644
--- a/glance_store/_drivers/cinder.py
+++ b/glance_store/_drivers/cinder.py
@@ -640,7 +640,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)
diff --git a/glance_store/tests/unit/test_cinder_store.py b/glance_store/tests/unit/test_cinder_store.py
index 4c4d0d6..3e52e0a 100644
--- a/glance_store/tests/unit/test_cinder_store.py
+++ b/glance_store/tests/unit/test_cinder_store.py
@@ -188,7 +188,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:
@@ -223,6 +223,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)
diff --git a/glance_store/tests/unit/test_multistore_cinder.py b/glance_store/tests/unit/test_multistore_cinder.py
index 484fd4c..9ab9746 100644
--- a/glance_store/tests/unit/test_multistore_cinder.py
+++ b/glance_store/tests/unit/test_multistore_cinder.py
@@ -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)