summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2020-03-30 11:41:38 +0000
committerGerrit Code Review <review@openstack.org>2020-03-30 11:41:38 +0000
commit286ae5a99081a911463a28f19a4279c4ef97f36a (patch)
treedcbe944f089ac28c0ad474b73dc646f811ae74ed
parent1262d212784ff3579f073b197a2e42be915bf07e (diff)
parent1a656163c9d68520ab26035d350f2568cbfb881f (diff)
downloadglance_store-286ae5a99081a911463a28f19a4279c4ef97f36a.tar.gz
Merge "Add config for cinder mounting needs"
-rw-r--r--glance_store/_drivers/cinder.py15
-rw-r--r--glance_store/tests/unit/test_cinder_store.py1
-rw-r--r--glance_store/tests/unit/test_multistore_cinder.py1
-rw-r--r--glance_store/tests/unit/test_opts.py1
4 files changed, 18 insertions, 0 deletions
diff --git a/glance_store/_drivers/cinder.py b/glance_store/_drivers/cinder.py
index e8572b6..3350e39 100644
--- a/glance_store/_drivers/cinder.py
+++ b/glance_store/_drivers/cinder.py
@@ -333,6 +333,15 @@ Related options:
* cinder_enforce_multipath
"""),
+ cfg.StrOpt('cinder_mount_point_base',
+ default='/var/lib/glance/mnt',
+ help="""
+Directory where the NFS volume is mounted on the glance node.
+
+Possible values:
+
+* A string representing absolute path of mount point.
+"""),
]
@@ -531,9 +540,12 @@ class Store(glance_store.driver.Store):
self.conf, self.backend_group).cinder_use_multipath
enforce_multipath = getattr(
self.conf, self.backend_group).cinder_enforce_multipath
+ mount_point_base = getattr(
+ self.conf, self.backend_group).cinder_mount_point_base
else:
use_multipath = self.conf.glance_store.cinder_use_multipath
enforce_multipath = self.conf.glance_store.cinder_enforce_multipath
+ mount_point_base = self.conf.glance_store.cinder_mount_point_base
properties = connector.get_connector_properties(
root_helper, host, use_multipath, enforce_multipath)
@@ -548,6 +560,9 @@ class Store(glance_store.driver.Store):
try:
connection_info = volume.initialize_connection(volume, properties)
+ if connection_info['driver_volume_type'] == 'nfs':
+ connection_info['mount_point_base'] = os.path.join(
+ mount_point_base, 'nfs')
conn = connector.InitiatorConnector.factory(
connection_info['driver_volume_type'], root_helper,
conn=connection_info)
diff --git a/glance_store/tests/unit/test_cinder_store.py b/glance_store/tests/unit/test_cinder_store.py
index 8850cef..b7dea33 100644
--- a/glance_store/tests/unit/test_cinder_store.py
+++ b/glance_store/tests/unit/test_cinder_store.py
@@ -148,6 +148,7 @@ class TestCinderStore(base.StoreBaseTest,
def _test_open_cinder_volume(self, open_mode, attach_mode, error,
multipath_supported=False,
enforce_multipath=False):
+ self.config(cinder_mount_point_base=None)
fake_volume = mock.MagicMock(id=str(uuid.uuid4()), status='available')
fake_volumes = FakeObject(get=lambda id: fake_volume,
detach=mock.Mock())
diff --git a/glance_store/tests/unit/test_multistore_cinder.py b/glance_store/tests/unit/test_multistore_cinder.py
index 12ae713..4b546da 100644
--- a/glance_store/tests/unit/test_multistore_cinder.py
+++ b/glance_store/tests/unit/test_multistore_cinder.py
@@ -168,6 +168,7 @@ class TestMultiCinderStore(base.MultiStoreBaseTest,
def _test_open_cinder_volume(self, open_mode, attach_mode, error,
multipath_supported=False,
enforce_multipath=False):
+ self.config(cinder_mount_point_base=None, group='cinder1')
fake_volume = mock.MagicMock(id=str(uuid.uuid4()), status='available')
fake_volumes = FakeObject(get=lambda id: fake_volume,
detach=mock.Mock())
diff --git a/glance_store/tests/unit/test_opts.py b/glance_store/tests/unit/test_opts.py
index 0edea02..5ec31a4 100644
--- a/glance_store/tests/unit/test_opts.py
+++ b/glance_store/tests/unit/test_opts.py
@@ -75,6 +75,7 @@ class OptsTestCase(base.StoreBaseTest):
'cinder_catalog_info',
'cinder_endpoint_template',
'cinder_http_retries',
+ 'cinder_mount_point_base',
'cinder_os_region_name',
'cinder_state_transition_timeout',
'cinder_store_auth_address',