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
This commit is contained in:
parent
ae73287c7b
commit
1a656163c9
|
@ -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)
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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…
Reference in New Issue