Merge "Add config for cinder mounting needs"
This commit is contained in:
commit
286ae5a990
|
@ -332,6 +332,15 @@ Possible values:
|
||||||
Related options:
|
Related options:
|
||||||
* cinder_enforce_multipath
|
* 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
|
self.conf, self.backend_group).cinder_use_multipath
|
||||||
enforce_multipath = getattr(
|
enforce_multipath = getattr(
|
||||||
self.conf, self.backend_group).cinder_enforce_multipath
|
self.conf, self.backend_group).cinder_enforce_multipath
|
||||||
|
mount_point_base = getattr(
|
||||||
|
self.conf, self.backend_group).cinder_mount_point_base
|
||||||
else:
|
else:
|
||||||
use_multipath = self.conf.glance_store.cinder_use_multipath
|
use_multipath = self.conf.glance_store.cinder_use_multipath
|
||||||
enforce_multipath = self.conf.glance_store.cinder_enforce_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(
|
properties = connector.get_connector_properties(
|
||||||
root_helper, host, use_multipath, enforce_multipath)
|
root_helper, host, use_multipath, enforce_multipath)
|
||||||
|
@ -548,6 +560,9 @@ class Store(glance_store.driver.Store):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection_info = volume.initialize_connection(volume, properties)
|
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(
|
conn = connector.InitiatorConnector.factory(
|
||||||
connection_info['driver_volume_type'], root_helper,
|
connection_info['driver_volume_type'], root_helper,
|
||||||
conn=connection_info)
|
conn=connection_info)
|
||||||
|
|
|
@ -148,6 +148,7 @@ class TestCinderStore(base.StoreBaseTest,
|
||||||
def _test_open_cinder_volume(self, open_mode, attach_mode, error,
|
def _test_open_cinder_volume(self, open_mode, attach_mode, error,
|
||||||
multipath_supported=False,
|
multipath_supported=False,
|
||||||
enforce_multipath=False):
|
enforce_multipath=False):
|
||||||
|
self.config(cinder_mount_point_base=None)
|
||||||
fake_volume = mock.MagicMock(id=str(uuid.uuid4()), status='available')
|
fake_volume = mock.MagicMock(id=str(uuid.uuid4()), status='available')
|
||||||
fake_volumes = FakeObject(get=lambda id: fake_volume,
|
fake_volumes = FakeObject(get=lambda id: fake_volume,
|
||||||
detach=mock.Mock())
|
detach=mock.Mock())
|
||||||
|
|
|
@ -168,6 +168,7 @@ class TestMultiCinderStore(base.MultiStoreBaseTest,
|
||||||
def _test_open_cinder_volume(self, open_mode, attach_mode, error,
|
def _test_open_cinder_volume(self, open_mode, attach_mode, error,
|
||||||
multipath_supported=False,
|
multipath_supported=False,
|
||||||
enforce_multipath=False):
|
enforce_multipath=False):
|
||||||
|
self.config(cinder_mount_point_base=None, group='cinder1')
|
||||||
fake_volume = mock.MagicMock(id=str(uuid.uuid4()), status='available')
|
fake_volume = mock.MagicMock(id=str(uuid.uuid4()), status='available')
|
||||||
fake_volumes = FakeObject(get=lambda id: fake_volume,
|
fake_volumes = FakeObject(get=lambda id: fake_volume,
|
||||||
detach=mock.Mock())
|
detach=mock.Mock())
|
||||||
|
|
|
@ -75,6 +75,7 @@ class OptsTestCase(base.StoreBaseTest):
|
||||||
'cinder_catalog_info',
|
'cinder_catalog_info',
|
||||||
'cinder_endpoint_template',
|
'cinder_endpoint_template',
|
||||||
'cinder_http_retries',
|
'cinder_http_retries',
|
||||||
|
'cinder_mount_point_base',
|
||||||
'cinder_os_region_name',
|
'cinder_os_region_name',
|
||||||
'cinder_state_transition_timeout',
|
'cinder_state_transition_timeout',
|
||||||
'cinder_store_auth_address',
|
'cinder_store_auth_address',
|
||||||
|
|
Loading…
Reference in New Issue