Browse Source

Add config for cinder mounting needs

This patch adds a config option 'mount_point_base' by which we can
provide the mount point for *fs volumes.
The different types of FS drivers will have separate directory for
mounting their volumes,
Eg: <mount_point_base>/nfs, <mount_point_base>/xyzfs etc.
The default mount point for *fs volumes is /var/lib/glance/mnt/*fs.

Closes-Bug: #1866966

Change-Id: I10b5ea4943ad9388ce1962eae9204b905c8ff24a
(cherry picked from commit 1a656163c9)
changes/48/726648/2
Rajat Dhasmana 7 months ago
committed by Cyril Roelandt
parent
commit
c6b7be68f8
4 changed files with 18 additions and 0 deletions
  1. +15
    -0
      glance_store/_drivers/cinder.py
  2. +1
    -0
      glance_store/tests/unit/test_cinder_store.py
  3. +1
    -0
      glance_store/tests/unit/test_multistore_cinder.py
  4. +1
    -0
      glance_store/tests/unit/test_opts.py

+ 15
- 0
glance_store/_drivers/cinder.py View File

@@ -332,6 +332,15 @@ Possible values:
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)


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

@@ -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())


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

@@ -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())


+ 1
- 0
glance_store/tests/unit/test_opts.py View File

@@ -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',


Loading…
Cancel
Save