diff --git a/cinder/config/generate_cinder_opts.py b/cinder/config/generate_cinder_opts.py index 69a2081a184..eb2c95e706d 100644 --- a/cinder/config/generate_cinder_opts.py +++ b/cinder/config/generate_cinder_opts.py @@ -17,6 +17,8 @@ import os import subprocess import textwrap +from cinder.volume import configuration + OrderedDict = collections.OrderedDict BASEDIR = os.path.split(os.path.realpath(__file__))[0] + "/../../" @@ -208,6 +210,12 @@ if __name__ == "__main__": ', group=\"\'', '').replace( ', group=', '').strip( "\'\")").upper() + + # NOTE(dulek): Hack to resolve constants manually. + if (group_name.endswith('SHARED_CONF_GROUP') + or group_name.lower() == 'backend_defaults'): + group_name = configuration.SHARED_CONF_GROUP + if group_name in registered_opts_dict: line = key + "." + formatted_opt registered_opts_dict[group_name].append(line) diff --git a/cinder/opts.py b/cinder/opts.py index 6b3a20f47f1..5ec19e7ab67 100644 --- a/cinder/opts.py +++ b/cinder/opts.py @@ -277,6 +277,29 @@ def list_opts(): [cinder_volume_api.volume_host_opt], [cinder_volume_api.volume_same_az_opt], [cinder_volume_api.az_cache_time_opt], + cinder_volume_driver.volume_opts, + cinder_volume_driver.iser_opts, + cinder_volume_manager.volume_manager_opts, + cinder_wsgi_eventletserver.socket_opts, + )), + ('FC-ZONE-MANAGER', + itertools.chain( + cinder_zonemanager_drivers_brocade_brcdfczonedriver.brcd_opts, + cinder_zonemanager_drivers_cisco_ciscofczonedriver.cisco_opts, + cinder_zonemanager_fczonemanager.zone_manager_opts, + )), + ('KEY_MANAGER', + itertools.chain( + cinder_keymgr_confkeymgr.key_mgr_opts, + )), + ('NOVA_GROUP', + itertools.chain( + cinder_compute_nova.nova_opts, + cinder_compute_nova.nova_session_opts, + cinder_compute_nova.nova_auth_opts, + )), + ('backend_defaults', + itertools.chain( cinder_volume_driver.volume_opts, cinder_volume_driver.iser_opts, cinder_volume_drivers_blockdevice.volume_opts, @@ -384,23 +407,6 @@ def list_opts(): cinder_volume_drivers_zfssa_zfssaiscsi.ZFSSA_OPTS, cinder_volume_drivers_zfssa_zfssanfs.ZFSSA_OPTS, cinder_volume_drivers_zte_zteks.zte_opts, - cinder_volume_manager.volume_manager_opts, - cinder_wsgi_eventletserver.socket_opts, - )), - ('FC-ZONE-MANAGER', - itertools.chain( - cinder_zonemanager_drivers_brocade_brcdfczonedriver.brcd_opts, - cinder_zonemanager_drivers_cisco_ciscofczonedriver.cisco_opts, - cinder_zonemanager_fczonemanager.zone_manager_opts, - )), - ('KEY_MANAGER', - itertools.chain( - cinder_keymgr_confkeymgr.key_mgr_opts, - )), - ('NOVA_GROUP', - itertools.chain( - cinder_compute_nova.nova_opts, - cinder_compute_nova.nova_session_opts, - cinder_compute_nova.nova_auth_opts, + cinder_volume_manager.volume_backend_opts, )), ] diff --git a/cinder/tests/functional/functional_helpers.py b/cinder/tests/functional/functional_helpers.py index 8e9e4df28e5..64b890b19b3 100644 --- a/cinder/tests/functional/functional_helpers.py +++ b/cinder/tests/functional/functional_helpers.py @@ -68,7 +68,8 @@ class _FunctionalTestBase(test.TestCase): super(_FunctionalTestBase, self).setUp() f = self._get_flags() - self.flags(**f) + for k, value_dict in f.items(): + self.override_config(k, value_dict['v'], value_dict.get('g')) for var in ('http_proxy', 'HTTP_PROXY'): self.useFixture(fixtures.EnvironmentVariable(var)) @@ -107,15 +108,15 @@ class _FunctionalTestBase(test.TestCase): f = {} # Ensure tests only listen on localhost - f['osapi_volume_listen'] = '127.0.0.1' + f['osapi_volume_listen'] = {'v': '127.0.0.1'} # Auto-assign ports to allow concurrent tests - f['osapi_volume_listen_port'] = 0 + f['osapi_volume_listen_port'] = {'v': 0} # Use simple scheduler to avoid complications - we test schedulers # separately - f['scheduler_driver'] = ('cinder.scheduler.filter_scheduler.FilterSche' - 'duler') + f['scheduler_driver'] = {'v': ('cinder.scheduler.filter_scheduler.' + 'FilterScheduler')} return f diff --git a/cinder/tests/functional/test_extensions.py b/cinder/tests/functional/test_extensions.py index 96d9cccba7c..06589d4f59b 100644 --- a/cinder/tests/functional/test_extensions.py +++ b/cinder/tests/functional/test_extensions.py @@ -32,8 +32,8 @@ CONF = cfg.CONF class ExtensionTestCase(functional_helpers._FunctionalTestBase): def _get_flags(self): f = super(ExtensionTestCase, self)._get_flags() - f['osapi_volume_extension'] = CONF.osapi_volume_extension[:] - f['osapi_volume_extension'].append( + f['osapi_volume_extension'] = {'v': CONF.osapi_volume_extension[:]} + f['osapi_volume_extension']['v'].append( 'cinder.tests.functional.api.foxinsocks.Foxinsocks') return f diff --git a/cinder/tests/functional/test_group_replication.py b/cinder/tests/functional/test_group_replication.py index 2de51099f98..05e01d66dd2 100644 --- a/cinder/tests/functional/test_group_replication.py +++ b/cinder/tests/functional/test_group_replication.py @@ -17,6 +17,7 @@ from oslo_utils import uuidutils from cinder.objects import fields from cinder.tests.functional import functional_helpers +from cinder.volume import configuration class GroupReplicationTest(functional_helpers._FunctionalTestBase): @@ -41,9 +42,10 @@ class GroupReplicationTest(functional_helpers._FunctionalTestBase): def _get_flags(self): f = super(GroupReplicationTest, self)._get_flags() f['volume_driver'] = ( - 'cinder.tests.fake_driver.FakeLoggingVolumeDriver') - f['default_volume_type'] = self._vol_type_name - f['default_group_type'] = self._grp_type_name + {'v': 'cinder.tests.fake_driver.FakeLoggingVolumeDriver', + 'g': configuration.SHARED_CONF_GROUP}) + f['default_volume_type'] = {'v': self._vol_type_name} + f['default_group_type'] = {'v': self._grp_type_name} return f def test_group_replication(self): diff --git a/cinder/tests/functional/test_group_snapshots.py b/cinder/tests/functional/test_group_snapshots.py index e84127cec4b..1535523b7c5 100644 --- a/cinder/tests/functional/test_group_snapshots.py +++ b/cinder/tests/functional/test_group_snapshots.py @@ -16,6 +16,7 @@ from oslo_utils import uuidutils from cinder.tests.functional import functional_helpers +from cinder.volume import configuration class GroupSnapshotsTest(functional_helpers._FunctionalTestBase): @@ -32,9 +33,10 @@ class GroupSnapshotsTest(functional_helpers._FunctionalTestBase): def _get_flags(self): f = super(GroupSnapshotsTest, self)._get_flags() f['volume_driver'] = ( - 'cinder.tests.fake_driver.FakeLoggingVolumeDriver') - f['default_volume_type'] = self._vol_type_name - f['default_group_type'] = self._grp_type_name + {'v': 'cinder.tests.fake_driver.FakeLoggingVolumeDriver', + 'g': configuration.SHARED_CONF_GROUP}) + f['default_volume_type'] = {'v': self._vol_type_name} + f['default_group_type'] = {'v': self._grp_type_name} return f def test_get_group_snapshots_summary(self): diff --git a/cinder/tests/functional/test_groups.py b/cinder/tests/functional/test_groups.py index ffe1cfcfd2e..b5650f1a481 100644 --- a/cinder/tests/functional/test_groups.py +++ b/cinder/tests/functional/test_groups.py @@ -16,6 +16,7 @@ from oslo_utils import uuidutils from cinder.tests.functional import functional_helpers +from cinder.volume import configuration class GroupsTest(functional_helpers._FunctionalTestBase): @@ -35,9 +36,10 @@ class GroupsTest(functional_helpers._FunctionalTestBase): def _get_flags(self): f = super(GroupsTest, self)._get_flags() f['volume_driver'] = ( - 'cinder.tests.fake_driver.FakeLoggingVolumeDriver') - f['default_volume_type'] = self._vol_type_name - f['default_group_type'] = self._grp_type_name + {'v': 'cinder.tests.fake_driver.FakeLoggingVolumeDriver', + 'g': configuration.SHARED_CONF_GROUP}) + f['default_volume_type'] = {'v': self._vol_type_name} + f['default_group_type'] = {'v': self._grp_type_name} return f def test_get_groups_summary(self): diff --git a/cinder/tests/functional/test_quotas.py b/cinder/tests/functional/test_quotas.py index 5789e2b99f3..172de214a66 100644 --- a/cinder/tests/functional/test_quotas.py +++ b/cinder/tests/functional/test_quotas.py @@ -17,6 +17,7 @@ import uuid from cinder import quota from cinder.tests.functional.api import client from cinder.tests.functional import functional_helpers +from cinder.volume import configuration class NestedQuotasTest(functional_helpers._FunctionalTestBase): @@ -51,9 +52,10 @@ class NestedQuotasTest(functional_helpers._FunctionalTestBase): def _get_flags(self): f = super(NestedQuotasTest, self)._get_flags() - f['volume_driver'] = \ - 'cinder.tests.fake_driver.FakeLoggingVolumeDriver' - f['default_volume_type'] = self._vol_type_name + f['volume_driver'] = ( + {'v': 'cinder.tests.fake_driver.FakeLoggingVolumeDriver', + 'g': configuration.SHARED_CONF_GROUP}) + f['default_volume_type'] = {'v': self._vol_type_name} return f # Currently we use 413 error for over quota diff --git a/cinder/tests/functional/test_volumes.py b/cinder/tests/functional/test_volumes.py index 79642f230ab..4289ea2783e 100644 --- a/cinder/tests/functional/test_volumes.py +++ b/cinder/tests/functional/test_volumes.py @@ -16,6 +16,7 @@ from oslo_utils import uuidutils from cinder.tests.functional import functional_helpers +from cinder.volume import configuration class VolumesTest(functional_helpers._FunctionalTestBase): @@ -27,9 +28,10 @@ class VolumesTest(functional_helpers._FunctionalTestBase): def _get_flags(self): f = super(VolumesTest, self)._get_flags() - f['volume_driver'] = \ - 'cinder.tests.fake_driver.FakeLoggingVolumeDriver' - f['default_volume_type'] = self._vol_type_name + f['volume_driver'] = ( + {'v': 'cinder.tests.fake_driver.FakeLoggingVolumeDriver', + 'g': configuration.SHARED_CONF_GROUP}) + f['default_volume_type'] = {'v': self._vol_type_name} return f def test_get_volumes_summary(self): diff --git a/cinder/tests/unit/conf_fixture.py b/cinder/tests/unit/conf_fixture.py index e442bb8e68e..22464ee18bf 100644 --- a/cinder/tests/unit/conf_fixture.py +++ b/cinder/tests/unit/conf_fixture.py @@ -18,11 +18,13 @@ import os from oslo_config import cfg +from cinder.volume import configuration CONF = cfg.CONF CONF.import_opt('policy_file', 'cinder.policy', group='oslo_policy') -CONF.import_opt('volume_driver', 'cinder.volume.manager') +CONF.import_opt('volume_driver', 'cinder.volume.manager', + group=configuration.SHARED_CONF_GROUP) CONF.import_opt('backup_driver', 'cinder.backup.manager') CONF.import_opt('api_class', 'cinder.keymgr', group='key_manager') CONF.import_opt('fixed_key', 'cinder.keymgr.conf_key_mgr', group='key_manager') @@ -34,7 +36,8 @@ def_vol_type = 'fake_vol_type' def set_defaults(conf): conf.set_default('default_volume_type', def_vol_type) conf.set_default('volume_driver', - 'cinder.tests.fake_driver.FakeLoggingVolumeDriver') + 'cinder.tests.fake_driver.FakeLoggingVolumeDriver', + group=configuration.SHARED_CONF_GROUP) conf.set_default('iscsi_helper', 'fake') conf.set_default('rpc_backend', 'cinder.openstack.common.rpc.impl_fake') conf.set_default('connection', 'sqlite://', group='database') diff --git a/cinder/tests/unit/volume/drivers/dell_emc/scaleio/__init__.py b/cinder/tests/unit/volume/drivers/dell_emc/scaleio/__init__.py index aab8161e0bb..ad24802ef72 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/scaleio/__init__.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/scaleio/__init__.py @@ -18,6 +18,8 @@ import six from cinder import test from cinder.tests.unit.volume.drivers.dell_emc.scaleio import mocks +from cinder.volume import configuration as conf +from cinder.volume.drivers.dell_emc.scaleio import driver class CustomResponseMode(object): @@ -115,11 +117,37 @@ class TestScaleIODriver(test.TestCase): ``MockHTTPSResponse``'s instead. """ super(TestScaleIODriver, self).setUp() - self.driver = mocks.ScaleIODriver() + self.configuration = conf.Configuration(driver.scaleio_opts, + conf.SHARED_CONF_GROUP) + self._set_overrides() + self.driver = mocks.ScaleIODriver(configuration=self.configuration) self.mock_object(requests, 'get', self.do_request) self.mock_object(requests, 'post', self.do_request) + def _set_overrides(self): + # Override the defaults to fake values + self.override_config('san_ip', override='127.0.0.1', + group=conf.SHARED_CONF_GROUP) + self.override_config('sio_rest_server_port', override='8888', + group=conf.SHARED_CONF_GROUP) + self.override_config('san_login', override='test', + group=conf.SHARED_CONF_GROUP) + self.override_config('san_password', override='pass', + group=conf.SHARED_CONF_GROUP) + self.override_config('sio_storage_pool_id', override='test_pool', + group=conf.SHARED_CONF_GROUP) + self.override_config('sio_protection_domain_id', + override='test_domain', + group=conf.SHARED_CONF_GROUP) + self.override_config('sio_storage_pools', + override='test_domain:test_pool', + group=conf.SHARED_CONF_GROUP) + self.override_config('max_over_subscription_ratio', + override=5.0, group=conf.SHARED_CONF_GROUP) + self.override_config('sio_server_api_version', + override='2.0.0', group=conf.SHARED_CONF_GROUP) + def do_request(self, url, *args, **kwargs): """Do a fake GET/POST API request. diff --git a/cinder/tests/unit/volume/drivers/dell_emc/scaleio/mocks.py b/cinder/tests/unit/volume/drivers/dell_emc/scaleio/mocks.py index 7fa8bcc050a..dd3911ccebf 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/scaleio/mocks.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/scaleio/mocks.py @@ -16,47 +16,18 @@ import json import requests import six -from cinder.volume import configuration as conf -from cinder.volume.drivers.dell_emc.scaleio import driver from oslo_config import cfg +from cinder.volume.drivers.dell_emc.scaleio import driver + +CONF = cfg.CONF + class ScaleIODriver(driver.ScaleIODriver): """Mock ScaleIO Driver class. Provides some fake configuration options """ - def __init__(self, *args, **kwargs): - configuration = conf.Configuration( - [ - cfg.StrOpt('fake'), - ], - None - ) - - # Override the defaults to fake values - configuration.set_override('san_ip', override='127.0.0.1') - configuration.set_override('sio_rest_server_port', override='8888') - configuration.set_override('san_login', override='test') - configuration.set_override('san_password', override='pass') - configuration.set_override('sio_storage_pool_id', override='test_pool') - configuration.set_override('sio_protection_domain_id', - override='test_domain') - configuration.set_override('sio_storage_pools', - override='test_domain:test_pool') - configuration.set_override('max_over_subscription_ratio', - override=5.0) - configuration.set_override('sio_server_api_version', - override='2.0.0') - if 'san_thin_provision' in kwargs: - configuration.set_override( - 'san_thin_provision', - override=kwargs['san_thin_provision']) - - super(ScaleIODriver, self).__init__(configuration=configuration, - *args, - **kwargs) - def local_path(self, volume): pass diff --git a/cinder/tests/unit/volume/drivers/dell_emc/scaleio/test_delete_snapshot.py b/cinder/tests/unit/volume/drivers/dell_emc/scaleio/test_delete_snapshot.py index 7a1f8ce3473..217c738ee5c 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/scaleio/test_delete_snapshot.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/scaleio/test_delete_snapshot.py @@ -20,6 +20,7 @@ from cinder.tests.unit import fake_constants as fake from cinder.tests.unit.fake_snapshot import fake_snapshot_obj from cinder.tests.unit.volume.drivers.dell_emc import scaleio from cinder.tests.unit.volume.drivers.dell_emc.scaleio import mocks +from cinder.volume import configuration class TestDeleteSnapShot(scaleio.TestScaleIODriver): @@ -88,8 +89,7 @@ class TestDeleteSnapShot(scaleio.TestScaleIODriver): def test_delete_snapshot(self): """Setting the unmap volume before delete flag for tests """ - self.driver.configuration.set_override( - 'sio_unmap_volume_before_deletion', - override=True) + self.override_config('sio_unmap_volume_before_deletion', True, + configuration.SHARED_CONF_GROUP) self.set_https_response_mode(self.RESPONSE_MODE.Valid) self.driver.delete_snapshot(self.snapshot) diff --git a/cinder/tests/unit/volume/drivers/dell_emc/scaleio/test_delete_volume.py b/cinder/tests/unit/volume/drivers/dell_emc/scaleio/test_delete_volume.py index a3a4d983edf..aa55ca70d3c 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/scaleio/test_delete_volume.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/scaleio/test_delete_volume.py @@ -20,6 +20,7 @@ from cinder.tests.unit import fake_constants as fake from cinder.tests.unit import fake_volume from cinder.tests.unit.volume.drivers.dell_emc import scaleio from cinder.tests.unit.volume.drivers.dell_emc.scaleio import mocks +from cinder.volume import configuration class TestDeleteVolume(scaleio.TestScaleIODriver): @@ -76,7 +77,6 @@ class TestDeleteVolume(scaleio.TestScaleIODriver): def test_delete_volume(self): """Setting the unmap volume before delete flag for tests """ - self.driver.configuration.set_override( - 'sio_unmap_volume_before_deletion', - override=True) + self.override_config('sio_unmap_volume_before_deletion', True, + configuration.SHARED_CONF_GROUP) self.driver.delete_volume(self.volume) diff --git a/cinder/tests/unit/volume/drivers/dell_emc/scaleio/test_extend_volume.py b/cinder/tests/unit/volume/drivers/dell_emc/scaleio/test_extend_volume.py index 76ddef94829..90e1adcc503 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/scaleio/test_extend_volume.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/scaleio/test_extend_volume.py @@ -20,6 +20,7 @@ from cinder.tests.unit import fake_constants as fake from cinder.tests.unit.fake_volume import fake_volume_obj from cinder.tests.unit.volume.drivers.dell_emc import scaleio from cinder.tests.unit.volume.drivers.dell_emc.scaleio import mocks +from cinder.volume import configuration class TestExtendVolume(scaleio.TestScaleIODriver): @@ -91,14 +92,14 @@ class TestExtendVolume(scaleio.TestScaleIODriver): self.NEW_SIZE) def test_extend_volume_bad_size_no_round(self): - self.driver.configuration.set_override('sio_round_volume_capacity', - override=False) + self.override_config('sio_round_volume_capacity', False, + configuration.SHARED_CONF_GROUP) self.set_https_response_mode(self.RESPONSE_MODE.Valid) self.driver.extend_volume(self.volume, self.BAD_SIZE) def test_extend_volume_bad_size_round(self): - self.driver.configuration.set_override('sio_round_volume_capacity', - override=True) + self.override_config('sio_round_volume_capacity', True, + configuration.SHARED_CONF_GROUP) self.driver.extend_volume(self.volume, self.BAD_SIZE) def test_extend_volume(self): diff --git a/cinder/tests/unit/volume/drivers/dell_emc/scaleio/test_misc.py b/cinder/tests/unit/volume/drivers/dell_emc/scaleio/test_misc.py index 57ca5ae7877..5ba9f14fac5 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/scaleio/test_misc.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/scaleio/test_misc.py @@ -23,6 +23,7 @@ from cinder.tests.unit import fake_constants as fake from cinder.tests.unit import fake_volume from cinder.tests.unit.volume.drivers.dell_emc import scaleio from cinder.tests.unit.volume.drivers.dell_emc.scaleio import mocks +from cinder.volume import configuration @ddt.ddt @@ -133,8 +134,8 @@ class TestMisc(scaleio.TestScaleIODriver): self.driver._check_volume_size(1) def test_volume_size_round_false(self): - self.driver.configuration.set_override('sio_round_volume_capacity', - override=False) + self.override_config('sio_round_volume_capacity', False, + configuration.SHARED_CONF_GROUP) self.assertRaises(exception.VolumeBackendAPIException, self.driver._check_volume_size, 1) @@ -268,8 +269,9 @@ class TestMisc(scaleio.TestScaleIODriver): @ddt.unpack def test_default_provisioning_type_thin(self, config_provisioning_type, expected_provisioning_type): - self.driver = mocks.ScaleIODriver( - san_thin_provision=config_provisioning_type) + self.override_config('san_thin_provision', config_provisioning_type, + configuration.SHARED_CONF_GROUP) + self.driver = mocks.ScaleIODriver(configuration=self.configuration) empty_storage_type = {} self.assertEqual( expected_provisioning_type, diff --git a/cinder/tests/unit/volume/drivers/hitachi/test_hitachi_hnas_nfs.py b/cinder/tests/unit/volume/drivers/hitachi/test_hitachi_hnas_nfs.py index 5953a2473cb..f94aea7f842 100644 --- a/cinder/tests/unit/volume/drivers/hitachi/test_hitachi_hnas_nfs.py +++ b/cinder/tests/unit/volume/drivers/hitachi/test_hitachi_hnas_nfs.py @@ -129,6 +129,8 @@ class HNASNFSDriverTest(test.TestCase): self.configuration.hds_hnas_nfs_config_file = 'fake_config.xml' self.configuration.nfs_shares_config = 'fake_nfs_share.xml' self.configuration.num_shell_tries = 2 + self.configuration.nfs_mount_point_base = '%state_path/mnt' + self.configuration.nfs_mount_options = None self.driver = nfs.HNASNFSDriver(configuration=self.configuration) diff --git a/cinder/tests/unit/volume/drivers/hitachi/test_hitachi_hnas_utils.py b/cinder/tests/unit/volume/drivers/hitachi/test_hitachi_hnas_utils.py index 1ad11a4fc1d..730e0197186 100644 --- a/cinder/tests/unit/volume/drivers/hitachi/test_hitachi_hnas_utils.py +++ b/cinder/tests/unit/volume/drivers/hitachi/test_hitachi_hnas_utils.py @@ -151,15 +151,23 @@ class HNASUtilsTest(test.TestCase): def setUp(self): super(HNASUtilsTest, self).setUp() - self.fake_conf = conf.Configuration(hnas_utils.CONF) + self.fake_conf = conf.Configuration(hnas_utils.drivers_common_opts, + conf.SHARED_CONF_GROUP) - self.override_config('hnas_username', 'supervisor') - self.override_config('hnas_password', 'supervisor') - self.override_config('hnas_mgmt_ip0', '172.24.44.15') - self.override_config('hnas_svc0_pool_name', 'default') - self.override_config('hnas_svc0_hdp', 'easy-stack') - self.override_config('hnas_svc1_pool_name', 'FS-CinderDev1') - self.override_config('hnas_svc1_hdp', 'silver') + self.override_config('hnas_username', 'supervisor', + conf.SHARED_CONF_GROUP) + self.override_config('hnas_password', 'supervisor', + conf.SHARED_CONF_GROUP) + self.override_config('hnas_mgmt_ip0', '172.24.44.15', + conf.SHARED_CONF_GROUP) + self.override_config('hnas_svc0_pool_name', 'default', + conf.SHARED_CONF_GROUP) + self.override_config('hnas_svc0_hdp', 'easy-stack', + conf.SHARED_CONF_GROUP) + self.override_config('hnas_svc1_pool_name', 'FS-CinderDev1', + conf.SHARED_CONF_GROUP) + self.override_config('hnas_svc1_hdp', 'silver', + conf.SHARED_CONF_GROUP) self.context = context.get_admin_context() self.volume = fake_volume.fake_volume_obj(self.context, **_VOLUME) @@ -281,9 +289,9 @@ class HNASUtilsTest(test.TestCase): self.assertEqual(config_from_cinder_conf, out) def test_read_cinder_conf_break(self): - self.override_config('hnas_username', None) - self.override_config('hnas_password', None) - self.override_config('hnas_mgmt_ip0', None) + self.override_config('hnas_username', None, conf.SHARED_CONF_GROUP) + self.override_config('hnas_password', None, conf.SHARED_CONF_GROUP) + self.override_config('hnas_mgmt_ip0', None, conf.SHARED_CONF_GROUP) out = hnas_utils.read_cinder_conf(self.fake_conf) self.assertIsNone(out) @@ -291,7 +299,7 @@ class HNASUtilsTest(test.TestCase): 'hnas_mgmt_ip0', 'hnas_svc0_pool_name', 'hnas_svc0_hdp', ) def test_init_invalid_conf_parameters(self, attr_name): - self.override_config(attr_name, None) + self.override_config(attr_name, None, conf.SHARED_CONF_GROUP) self.assertRaises(exception.InvalidParameterValue, hnas_utils.read_cinder_conf, self.fake_conf) diff --git a/cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py b/cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py index cf34d2ceb29..0b47cf94fcf 100644 --- a/cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py +++ b/cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py @@ -27,6 +27,7 @@ import re import time from oslo_concurrency import processutils +from oslo_config import cfg from oslo_utils import importutils from oslo_utils import units import six @@ -55,6 +56,8 @@ from cinder.volume import volume_types SVC_POOLS = ['openstack', 'openstack1'] +CONF = cfg.CONF + def _get_test_pool(get_all=False): if get_all: @@ -2240,7 +2243,7 @@ class StorwizeSVCISCSIDriverTestCase(test.TestCase): self.USESIM = True if self.USESIM: self.iscsi_driver = StorwizeSVCISCSIFakeDriver( - configuration=conf.Configuration(None)) + configuration=conf.Configuration([], conf.SHARED_CONF_GROUP)) self._def_flags = {'san_ip': 'hostname', 'san_login': 'user', 'san_password': 'pass', @@ -2265,7 +2268,7 @@ class StorwizeSVCISCSIDriverTestCase(test.TestCase): self._reset_flags() self.ctxt = context.get_admin_context() - db_driver = self.iscsi_driver.configuration.db_driver + db_driver = CONF.db_driver self.db = importutils.import_module(db_driver) self.iscsi_driver.db = self.db self.iscsi_driver.do_setup(None) @@ -2274,10 +2277,10 @@ class StorwizeSVCISCSIDriverTestCase(test.TestCase): def _set_flag(self, flag, value): group = self.iscsi_driver.configuration.config_group - self.iscsi_driver.configuration.set_override(flag, value, group) + self.override_config(flag, value, group) def _reset_flags(self): - self.iscsi_driver.configuration.local_conf.reset() + CONF.reset() for k, v in self._def_flags.items(): self._set_flag(k, v) @@ -3436,7 +3439,8 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase): 'storwize_svc_flashcopy_timeout': 20, 'storwize_svc_flashcopy_rate': 49, 'storwize_svc_allow_tenant_qos': True} - config = conf.Configuration(None) + config = conf.Configuration(storwize_svc_common.storwize_svc_opts, + conf.SHARED_CONF_GROUP) # Override any configs that may get set in __init__ self._reset_flags(config) self.driver = StorwizeSVCISCSIFakeDriver( @@ -3460,7 +3464,7 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase): else: self._reset_flags() self.ctxt = context.get_admin_context() - db_driver = self.driver.configuration.db_driver + db_driver = CONF.db_driver self.db = importutils.import_module(db_driver) self.driver.db = self.db self.driver.do_setup(None) @@ -3474,12 +3478,12 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase): if not configuration: configuration = self.driver.configuration group = configuration.config_group - configuration.set_override(flag, value, group) + self.override_config(flag, value, group) def _reset_flags(self, configuration=None): if not configuration: configuration = self.driver.configuration - configuration.local_conf.reset() + CONF.reset() for k, v in self._def_flags.items(): self._set_flag(k, v, configuration) @@ -6183,7 +6187,6 @@ class StorwizeSVCReplicationTestCase(test.TestCase): self.driver.configuration.set_override(flag, value, group) def _reset_flags(self): - self.driver.configuration.local_conf.reset() for k, v in self._def_flags.items(): self._set_flag(k, v) self.driver.configuration.set_override('replication_device', @@ -6604,7 +6607,8 @@ class StorwizeSVCReplicationTestCase(test.TestCase): self.assertEqual({'_name_id': None}, model_update) rename_vdisk.reset_mock() - rename_vdisk.side_effect = exception.VolumeBackendAPIException + rename_vdisk.side_effect = exception.VolumeBackendAPIException( + data='foo') model_update = self.driver.update_migrated_volume(self.ctxt, volume, backend_volume, 'available') diff --git a/cinder/tests/unit/volume/drivers/infortrend/test_infortrend_common.py b/cinder/tests/unit/volume/drivers/infortrend/test_infortrend_common.py index 6da33f48277..c741a0560a3 100644 --- a/cinder/tests/unit/volume/drivers/infortrend/test_infortrend_common.py +++ b/cinder/tests/unit/volume/drivers/infortrend/test_infortrend_common.py @@ -37,7 +37,8 @@ class InfortrendTestCass(test.TestCase): super(InfortrendTestCass, self).setUp() self.cli_data = test_infortrend_cli.InfortrendCLITestData() - self.configuration = configuration.Configuration(None) + self.configuration = configuration.Configuration( + [], config_group=configuration.SHARED_CONF_GROUP) self.configuration.append_config_values = mock.Mock(return_value=0) self.configuration.safe_get = self._fake_safe_get diff --git a/cinder/tests/unit/volume/drivers/nexenta/test_nexenta5_nfs.py b/cinder/tests/unit/volume/drivers/nexenta/test_nexenta5_nfs.py index 0ec62130b83..1475adc04c6 100644 --- a/cinder/tests/unit/volume/drivers/nexenta/test_nexenta5_nfs.py +++ b/cinder/tests/unit/volume/drivers/nexenta/test_nexenta5_nfs.py @@ -73,6 +73,7 @@ class TestNexentaNfsDriver(test.TestCase): self.cfg.nexenta_dataset_dedup = 'off' self.cfg.nfs_mount_point_base = '/mnt/test' self.cfg.nfs_mount_attempts = 3 + self.cfg.nfs_mount_options = None self.cfg.nas_mount_options = 'vers=4' self.cfg.reserved_percentage = 20 self.cfg.nexenta_use_https = False diff --git a/cinder/tests/unit/volume/drivers/test_gpfs.py b/cinder/tests/unit/volume/drivers/test_gpfs.py index 1e4f21dbec7..006b25152ad 100644 --- a/cinder/tests/unit/volume/drivers/test_gpfs.py +++ b/cinder/tests/unit/volume/drivers/test_gpfs.py @@ -66,7 +66,8 @@ class GPFSDriverTestCase(test.TestCase): os.mkdir(self.images_dir) self.image_id = '70a599e0-31e7-49b7-b260-868f441e862b' - self.driver = gpfs.GPFSDriver(configuration=conf.Configuration(None)) + self.driver = gpfs.GPFSDriver( + configuration=conf.Configuration([], conf.SHARED_CONF_GROUP)) self.driver.gpfs_execute = self._execute_wrapper exec_patcher = mock.patch.object(self.driver, '_execute', self._execute_wrapper) @@ -77,8 +78,10 @@ class GPFSDriverTestCase(test.TestCase): self.driver._storage_pool = 'system' self.driver._encryption_state = 'yes' - self.flags(volume_driver=self.driver_name, - gpfs_mount_point_base=self.volumes_path) + self.override_config('volume_driver', self.driver_name, + conf.SHARED_CONF_GROUP) + self.override_config('gpfs_mount_point_base', self.volumes_path, + conf.SHARED_CONF_GROUP) self.context = context.get_admin_context() self.context.user_id = 'fake' @@ -533,104 +536,91 @@ class GPFSDriverTestCase(test.TestCase): # fail configuration.gpfs_mount_point_base is None org_value = self.driver.configuration.gpfs_mount_point_base - self.flags(volume_driver=self.driver_name, gpfs_mount_point_base=None) + self.override_config('gpfs_mount_point_base', None, + conf.SHARED_CONF_GROUP) mock_get_gpfs_fs_rel_lev.return_value = (fake_fs, fake_fs_release) self.assertRaises(exception.VolumeBackendAPIException, self.driver.check_for_setup_error) - self.flags(volume_driver=self.driver_name, - gpfs_mount_point_base=org_value) + self.override_config('gpfs_mount_point_base', org_value, + conf.SHARED_CONF_GROUP) # fail configuration.gpfs_images_share_mode and # configuration.gpfs_images_dir is None - org_value_share_mode = self.driver.configuration.gpfs_images_share_mode - self.flags(volume_driver=self.driver_name, - gpfs_images_share_mode='copy') - org_value_dir = CONF.gpfs_images_dir - CONF.gpfs_images_dir = None + self.override_config('gpfs_images_share_mode', 'copy', + conf.SHARED_CONF_GROUP) + self.override_config('gpfs_images_dir', None, conf.SHARED_CONF_GROUP) + org_value_dir = self.driver.configuration.gpfs_images_dir self.assertRaises(exception.VolumeBackendAPIException, self.driver.check_for_setup_error) - self.flags(volume_driver=self.driver_name, - gpfs_images_share_mode=org_value_share_mode) - CONF.gpfs_images_dir = org_value_dir + self.override_config('gpfs_images_dir', org_value_dir, + conf.SHARED_CONF_GROUP) # fail configuration.gpfs_images_share_mode == 'copy_on_write' and not # _same_filesystem(configuration.gpfs_mount_point_base, # configuration.gpfs_images_dir) - org_value = self.driver.configuration.gpfs_images_share_mode - self.flags(volume_driver=self.driver_name, - gpfs_images_share_mode='copy_on_write') + self.override_config('gpfs_images_share_mode', 'copy_on_write', + conf.SHARED_CONF_GROUP) with mock.patch('cinder.volume.drivers.ibm.gpfs._same_filesystem', return_value=False): self.assertRaises(exception.VolumeBackendAPIException, self.driver.check_for_setup_error) - self.flags(volume_driver=self.driver_name, - gpfs_images_share_mode=org_value) # fail self.configuration.gpfs_images_share_mode == 'copy_on_write' and # not self._is_same_fileset(self.configuration.gpfs_mount_point_base, # self.configuration.gpfs_images_dir) - org_value = self.driver.configuration.gpfs_images_share_mode - self.flags(volume_driver=self.driver_name, - gpfs_images_share_mode='copy_on_write') with mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver.' '_is_same_fileset', return_value=False): self.assertRaises(exception.VolumeBackendAPIException, self.driver.check_for_setup_error) - self.flags(volume_driver=self.driver_name, - gpfs_images_share_mode=org_value) # fail directory is None - org_value_share_mode = self.driver.configuration.gpfs_images_share_mode - self.flags(volume_driver=self.driver_name, - gpfs_images_share_mode=None) - org_value_dir = CONF.gpfs_images_dir - CONF.gpfs_images_dir = None + self.override_config('gpfs_images_share_mode', None, + conf.SHARED_CONF_GROUP) + org_value_dir = self.driver.configuration.gpfs_images_dir + self.override_config('gpfs_images_dir', None, conf.SHARED_CONF_GROUP) with mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver.' '_get_gpfs_cluster_release_level', return_value=fake_cluster_release): self.driver.check_for_setup_error() - self.flags(volume_driver=self.driver_name, - gpfs_images_share_mode=org_value_share_mode) - CONF.gpfs_images_dir = org_value_dir + self.override_config('gpfs_images_dir', org_value_dir, + conf.SHARED_CONF_GROUP) # fail directory.startswith('/') org_value_mount = self.driver.configuration.gpfs_mount_point_base - self.flags(volume_driver=self.driver_name, - gpfs_mount_point_base='_' + self.volumes_path) - org_value_dir = CONF.gpfs_images_dir - CONF.gpfs_images_dir = None + self.override_config('gpfs_mount_point_base', '_' + self.volumes_path, + conf.SHARED_CONF_GROUP) + self.override_config('gpfs_images_share_mode', None, + conf.SHARED_CONF_GROUP) with mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver.' '_get_gpfs_cluster_release_level', return_value=fake_cluster_release): self.assertRaises(exception.VolumeBackendAPIException, self.driver.check_for_setup_error) - self.flags(volume_driver=self.driver_name, - gpfs_mount_point_base=org_value_mount) - CONF.gpfs_images_dir = org_value_dir + self.override_config('gpfs_mount_point_base', org_value_mount, + conf.SHARED_CONF_GROUP) # fail os.path.isdir(directory) org_value_mount = self.driver.configuration.gpfs_mount_point_base - self.flags(volume_driver=self.driver_name, - gpfs_mount_point_base=self.volumes_path + '_') - org_value_dir = CONF.gpfs_images_dir - CONF.gpfs_images_dir = None + self.override_config('gpfs_mount_point_base', self.volumes_path + '_', + conf.SHARED_CONF_GROUP) + org_value_dir = self.driver.configuration.gpfs_images_dir + self.override_config('gpfs_images_dir', None, conf.SHARED_CONF_GROUP) with mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver.' '_get_gpfs_cluster_release_level', return_value=fake_cluster_release): self.assertRaises(exception.VolumeBackendAPIException, self.driver.check_for_setup_error) - self.flags(volume_driver=self.driver_name, - gpfs_mount_point_base=org_value_mount) - CONF.gpfs_images_dir = org_value_dir + self.override_config('gpfs_mount_point_base', org_value_mount, + conf.SHARED_CONF_GROUP) + self.override_config('gpfs_images_dir', org_value_dir, + conf.SHARED_CONF_GROUP) # fail not cluster release level >= GPFS_CLONE_MIN_RELEASE org_fake_cluster_release = fake_cluster_release fake_cluster_release = 1105 - org_value_mount = self.driver.configuration.gpfs_mount_point_base - self.flags(volume_driver=self.driver_name, - gpfs_mount_point_base=self.volumes_path) - org_value_dir = CONF.gpfs_images_dir - CONF.gpfs_images_dir = None + self.override_config('gpfs_mount_point_base', self.volumes_path, + conf.SHARED_CONF_GROUP) + self.override_config('gpfs_images_dir', None, conf.SHARED_CONF_GROUP) with mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver.' '_get_gpfs_cluster_release_level', return_value=fake_cluster_release): @@ -644,11 +634,9 @@ class GPFSDriverTestCase(test.TestCase): # fail not fs release level >= GPFS_CLONE_MIN_RELEASE org_fake_fs_release = fake_fs_release fake_fs_release = 1105 - org_value_mount = self.driver.configuration.gpfs_mount_point_base - self.flags(volume_driver=self.driver_name, - gpfs_mount_point_base=self.volumes_path) - org_value_dir = CONF.gpfs_images_dir - CONF.gpfs_images_dir = None + self.override_config('gpfs_mount_point_base', self.volumes_path, + conf.SHARED_CONF_GROUP) + self.override_config('gpfs_images_dir', None, conf.SHARED_CONF_GROUP) with mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver.' '_get_gpfs_cluster_release_level', return_value=fake_cluster_release): @@ -657,9 +645,6 @@ class GPFSDriverTestCase(test.TestCase): return_value=(fake_fs, fake_fs_release)): self.assertRaises(exception.VolumeBackendAPIException, self.driver.check_for_setup_error) - self.flags(volume_driver=self.driver_name, - gpfs_mount_point_base=org_value_mount) - CONF.gpfs_images_dir = org_value_dir fake_fs_release = org_fake_fs_release @mock.patch('cinder.utils.execute') @@ -698,20 +683,21 @@ class GPFSDriverTestCase(test.TestCase): def test_set_volume_attributes_no_attributes(self, mock_change_attributes): metadata = {} org_value = self.driver.configuration.gpfs_storage_pool - self.flags(volume_driver=self.driver_name, gpfs_storage_pool='system') + self.override_config('gpfs_storage_pool', 'system', + conf.SHARED_CONF_GROUP) self.driver._set_volume_attributes('', '', metadata) - self.flags(volume_driver=self.driver_name, - gpfs_storage_pool=org_value) + self.override_config('gpfs_storage_pool', org_value, + conf.SHARED_CONF_GROUP) @mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver.' '_gpfs_change_attributes') def test_set_volume_attributes_no_options(self, mock_change_attributes): metadata = {} org_value = self.driver.configuration.gpfs_storage_pool - self.flags(volume_driver=self.driver_name, gpfs_storage_pool='') + self.override_config('gpfs_storage_pool', '', conf.SHARED_CONF_GROUP) self.driver._set_volume_attributes('', '', metadata) - self.flags(volume_driver=self.driver_name, - gpfs_storage_pool=org_value) + self.override_config('gpfs_storage_pool', org_value, + conf.SHARED_CONF_GROUP) @mock.patch('cinder.utils.execute') @mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver.' @@ -739,10 +725,11 @@ class GPFSDriverTestCase(test.TestCase): value['value'] = 'test' org_value = self.driver.configuration.gpfs_sparse_volumes - self.flags(volume_driver=self.driver_name, gpfs_sparse_volumes=False) + self.override_config('gpfs_sparse_volumes', False, + conf.SHARED_CONF_GROUP) self.driver.create_volume(volume) - self.flags(volume_driver=self.driver_name, - gpfs_sparse_volumes=org_value) + self.override_config('gpfs_sparse_volumes', org_value, + conf.SHARED_CONF_GROUP) @mock.patch('cinder.utils.execute') @mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver.' @@ -770,10 +757,11 @@ class GPFSDriverTestCase(test.TestCase): value['value'] = 'test' org_value = self.driver.configuration.gpfs_sparse_volumes - self.flags(volume_driver=self.driver_name, gpfs_sparse_volumes=True) + self.override_config('gpfs_sparse_volumes', True, + conf.SHARED_CONF_GROUP) self.driver.create_volume(volume) - self.flags(volume_driver=self.driver_name, - gpfs_sparse_volumes=org_value) + self.override_config('gpfs_sparse_volumes', org_value, + conf.SHARED_CONF_GROUP) @mock.patch('cinder.utils.execute') @mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver.' @@ -803,12 +791,13 @@ class GPFSDriverTestCase(test.TestCase): metadata = {'fake_key': 'fake_value'} org_value = self.driver.configuration.gpfs_sparse_volumes - self.flags(volume_driver=self.driver_name, gpfs_sparse_volumes=False) + self.override_config('gpfs_sparse_volumes', True, + conf.SHARED_CONF_GROUP) self.driver.create_volume(volume) self.assertTrue(self.driver._set_volume_attributes(volume, 'test', metadata)) - self.flags(volume_driver=self.driver_name, - gpfs_sparse_volumes=org_value) + self.override_config('gpfs_sparse_volumes', org_value, + conf.SHARED_CONF_GROUP) @mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver.' '_resize_volume_file') @@ -991,48 +980,48 @@ class GPFSDriverTestCase(test.TestCase): @mock.patch('cinder.utils.execute') def test_gpfs_redirect_ok(self, mock_exec): org_value = self.driver.configuration.gpfs_max_clone_depth - self.flags(volume_driver=self.driver_name, gpfs_max_clone_depth=1) + self.override_config('gpfs_max_clone_depth', 1, conf.SHARED_CONF_GROUP) mock_exec.side_effect = [('Parent Depth Parent inode File name\n' '------ ----- -------------- ---------\n' ' no 2 148488 ' '/gpfs0/test.txt', ''), ('', '')] self.assertTrue(self.driver._gpfs_redirect('')) - self.flags(volume_driver=self.driver_name, gpfs_max_clone_depth=1) + self.override_config('gpfs_max_clone_depth', 1, conf.SHARED_CONF_GROUP) mock_exec.side_effect = [('Parent Depth Parent inode File name\n' '------ ----- -------------- ---------\n' ' no 1 148488 ' '/gpfs0/test.txt', ''), ('', '')] self.assertFalse(self.driver._gpfs_redirect('')) - self.flags(volume_driver=self.driver_name, - gpfs_max_clone_depth=org_value) + self.override_config('gpfs_max_clone_depth', org_value, + conf.SHARED_CONF_GROUP) @mock.patch('cinder.utils.execute') def test_gpfs_redirect_fail_depth(self, mock_exec): org_value = self.driver.configuration.gpfs_max_clone_depth - self.flags(volume_driver=self.driver_name, gpfs_max_clone_depth=0) + self.override_config('gpfs_max_clone_depth', 0, conf.SHARED_CONF_GROUP) mock_exec.side_effect = [('Parent Depth Parent inode File name\n' '------ ----- -------------- ---------\n' ' no 2 148488 ' '/gpfs0/test.txt', ''), ('', '')] self.assertFalse(self.driver._gpfs_redirect('')) - self.flags(volume_driver=self.driver_name, - gpfs_max_clone_depth=org_value) + self.override_config('gpfs_max_clone_depth', org_value, + conf.SHARED_CONF_GROUP) @mock.patch('cinder.utils.execute') def test_gpfs_redirect_fail_match(self, mock_exec): org_value = self.driver.configuration.gpfs_max_clone_depth - self.flags(volume_driver=self.driver_name, gpfs_max_clone_depth=1) + self.override_config('gpfs_max_clone_depth', 1, conf.SHARED_CONF_GROUP) mock_exec.side_effect = [('Parent Depth Parent inode File name\n' '------ ----- -------------- ---------\n' ' 148488 ' '/gpfs0/test.txt', ''), ('', '')] self.assertFalse(self.driver._gpfs_redirect('')) - self.flags(volume_driver=self.driver_name, - gpfs_max_clone_depth=org_value) + self.override_config('gpfs_max_clone_depth', org_value, + conf.SHARED_CONF_GROUP) @mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver._create_gpfs_snap') @mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver._create_gpfs_copy') @@ -1085,16 +1074,11 @@ class GPFSDriverTestCase(test.TestCase): mock_set_rw_permission, mock_gpfs_redirect, mock_vol_get_by_id): - org_value = self.driver.configuration.gpfs_mount_point_base mock_get_snapshot_path.return_value = "/tmp/fakepath" - self.flags(volume_driver=self.driver_name, - gpfs_mount_point_base=self.volumes_path) vol = self._fake_volume() mock_vol_get_by_id.return_value = vol self.driver.create_snapshot(self._fake_snapshot()) - self.flags(volume_driver=self.driver_name, - gpfs_mount_point_base=org_value) @mock.patch('cinder.utils.execute') @mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver.' @@ -1184,8 +1168,10 @@ class GPFSDriverTestCase(test.TestCase): @mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver._is_gpfs_path') def test_is_cloneable_ok(self, mock_is_gpfs_path): - self.flags(volume_driver=self.driver_name, - gpfs_images_share_mode='copy') + self.override_config('gpfs_images_share_mode', 'copy', + conf.SHARED_CONF_GROUP) + self.override_config('gpfs_images_dir', self.images_dir, + conf.SHARED_CONF_GROUP) CONF.gpfs_images_dir = self.images_dir mock_is_gpfs_path.return_value = None self.assertEqual((True, None, os.path.join(CONF.gpfs_images_dir, @@ -1194,8 +1180,8 @@ class GPFSDriverTestCase(test.TestCase): @mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver._is_gpfs_path') def test_is_cloneable_fail_path(self, mock_is_gpfs_path): - self.flags(volume_driver=self.driver_name, - gpfs_images_share_mode='copy') + self.override_config('gpfs_images_share_mode', 'copy', + conf.SHARED_CONF_GROUP) CONF.gpfs_images_dir = self.images_dir mock_is_gpfs_path.side_effect = ( processutils.ProcessExecutionError(stdout='test', stderr='test')) @@ -1275,14 +1261,14 @@ class GPFSDriverTestCase(test.TestCase): mock_qemu_img_info.return_value = self._fake_qemu_raw_image_info('') volume = self._fake_volume() org_value = self.driver.configuration.gpfs_images_share_mode - self.flags(volume_driver=self.driver_name, - gpfs_images_share_mode='copy_on_write') + self.override_config('gpfs_images_share_mode', 'copy_on_write', + conf.SHARED_CONF_GROUP) self.assertEqual(({'provider_location': None}, True), self.driver._clone_image(volume, '', 1)) mock_create_gpfs_snap.assert_called_once_with(self.images_dir) - self.flags(volume_driver=self.driver_name, - gpfs_images_share_mode=org_value) + self.override_config('gpfs_images_share_mode', org_value, + conf.SHARED_CONF_GROUP) @mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver.' '_resize_volume_file') @@ -1311,15 +1297,15 @@ class GPFSDriverTestCase(test.TestCase): volume = self._fake_volume() org_value = self.driver.configuration.gpfs_images_share_mode - self.flags(volume_driver=self.driver_name, - gpfs_images_share_mode='copy') + self.override_config('gpfs_images_share_mode', 'copy', + conf.SHARED_CONF_GROUP) self.assertEqual(({'provider_location': None}, True), self.driver._clone_image(volume, '', 1)) mock_copyfile.assert_called_once_with(self.images_dir, self.volumes_path) - self.flags(volume_driver=self.driver_name, - gpfs_images_share_mode=org_value) + self.override_config('gpfs_images_share_mode', org_value, + conf.SHARED_CONF_GROUP) @mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver.' '_resize_volume_file') diff --git a/cinder/tests/unit/volume/drivers/test_lvm_driver.py b/cinder/tests/unit/volume/drivers/test_lvm_driver.py index 2a944269fd6..1a7388925a1 100644 --- a/cinder/tests/unit/volume/drivers/test_lvm_driver.py +++ b/cinder/tests/unit/volume/drivers/test_lvm_driver.py @@ -689,6 +689,7 @@ class LVMVolumeDriverTestCase(test_driver.BaseDriverTestCase): def test_revert_snapshot(self): self._setup_stubs_for_manage_existing() + self.configuration.lvm_type = 'auto' fake_volume = tests_utils.create_volume(self.context, display_name='fake_volume') fake_snapshot = tests_utils.create_snapshot( diff --git a/cinder/tests/unit/volume/drivers/test_zfssa.py b/cinder/tests/unit/volume/drivers/test_zfssa.py index c966bfdc43e..7c260881cc2 100644 --- a/cinder/tests/unit/volume/drivers/test_zfssa.py +++ b/cinder/tests/unit/volume/drivers/test_zfssa.py @@ -924,6 +924,8 @@ class TestZFSSANFSDriver(test.TestCase): self.configuration.zfssa_enable_local_cache = True self.configuration.zfssa_cache_directory = zfssa_cache_dir self.configuration.nfs_sparsed_volumes = 'true' + self.configuration.nfs_mount_point_base = '$state_path/mnt' + self.configuration.nfs_mount_options = None self.configuration.zfssa_manage_policy = 'strict' def test_setup_nfs_client(self): diff --git a/cinder/tests/unit/volume/test_driver.py b/cinder/tests/unit/volume/test_driver.py index dc5f21e89ae..9925d21edc2 100644 --- a/cinder/tests/unit/volume/test_driver.py +++ b/cinder/tests/unit/volume/test_driver.py @@ -155,8 +155,10 @@ class BaseDriverTestCase(test.TestCase): def setUp(self): super(BaseDriverTestCase, self).setUp() vol_tmpdir = tempfile.mkdtemp() - self.flags(volume_driver=self.driver_name, - volumes_dir=vol_tmpdir) + self.override_config('volume_driver', self.driver_name, + conf.SHARED_CONF_GROUP) + self.override_config('volumes_dir', vol_tmpdir, + conf.SHARED_CONF_GROUP) self.volume = importutils.import_object(CONF.volume_manager) self.context = context.get_admin_context() self.output = "" diff --git a/cinder/volume/configuration.py b/cinder/volume/configuration.py index 12b07bd1080..61ff8fbfdaa 100644 --- a/cinder/volume/configuration.py +++ b/cinder/volume/configuration.py @@ -43,6 +43,7 @@ from oslo_config import cfg CONF = cfg.CONF +SHARED_CONF_GROUP = 'backend_defaults' class Configuration(object): diff --git a/cinder/volume/driver.py b/cinder/volume/driver.py index 6fb2e7ba5e9..01a21c8608c 100644 --- a/cinder/volume/driver.py +++ b/cinder/volume/driver.py @@ -31,6 +31,7 @@ from cinder.image import image_utils from cinder import objects from cinder.objects import fields from cinder import utils +from cinder.volume import configuration from cinder.volume import driver_utils from cinder.volume import rpcapi as volume_rpcapi from cinder.volume import throttling @@ -295,6 +296,8 @@ iser_opts = [ CONF = cfg.CONF +CONF.register_opts(volume_opts, group=configuration.SHARED_CONF_GROUP) +CONF.register_opts(iser_opts, group=configuration.SHARED_CONF_GROUP) CONF.register_opts(volume_opts) CONF.register_opts(iser_opts) CONF.import_opt('backup_use_same_host', 'cinder.backup.api') diff --git a/cinder/volume/drivers/block_device.py b/cinder/volume/drivers/block_device.py index 0f2c8e53900..043023562f8 100644 --- a/cinder/volume/drivers/block_device.py +++ b/cinder/volume/drivers/block_device.py @@ -28,6 +28,7 @@ from cinder.image import image_utils from cinder import interface from cinder import objects from cinder import utils +from cinder.volume import configuration from cinder.volume import driver from cinder.volume import utils as volutils @@ -41,7 +42,7 @@ volume_opts = [ ] CONF = cfg.CONF -CONF.register_opts(volume_opts) +CONF.register_opts(volume_opts, group=configuration.SHARED_CONF_GROUP) @interface.volumedriver diff --git a/cinder/volume/drivers/blockbridge.py b/cinder/volume/drivers/blockbridge.py index 39a85441c83..84936bca8d1 100644 --- a/cinder/volume/drivers/blockbridge.py +++ b/cinder/volume/drivers/blockbridge.py @@ -30,6 +30,7 @@ from cinder import context from cinder import exception from cinder.i18n import _ from cinder import interface +from cinder.volume import configuration from cinder.volume import driver from cinder.volume import utils as volume_utils @@ -63,7 +64,7 @@ blockbridge_opts = [ ] CONF = cfg.CONF -CONF.register_opts(blockbridge_opts) +CONF.register_opts(blockbridge_opts, group=configuration.SHARED_CONF_GROUP) class BlockbridgeAPIClient(object): diff --git a/cinder/volume/drivers/coho.py b/cinder/volume/drivers/coho.py index a8d64451e66..99dcd91bf90 100644 --- a/cinder/volume/drivers/coho.py +++ b/cinder/volume/drivers/coho.py @@ -28,6 +28,7 @@ from cinder import exception from cinder.i18n import _ from cinder import interface from cinder import utils +from cinder.volume import configuration from cinder.volume.drivers import nfs from cinder.volume import qos_specs from cinder.volume import volume_types @@ -307,7 +308,7 @@ coho_opts = [ ] CONF = cfg.CONF -CONF.register_opts(coho_opts) +CONF.register_opts(coho_opts, group=configuration.SHARED_CONF_GROUP) @interface.volumedriver diff --git a/cinder/volume/drivers/coprhd/common.py b/cinder/volume/drivers/coprhd/common.py index 083f48eb706..7c474e9936b 100644 --- a/cinder/volume/drivers/coprhd/common.py +++ b/cinder/volume/drivers/coprhd/common.py @@ -30,6 +30,7 @@ from cinder import context from cinder import exception from cinder.i18n import _ from cinder.objects import fields +from cinder.volume import configuration from cinder.volume.drivers.coprhd.helpers import ( authentication as coprhd_auth) from cinder.volume.drivers.coprhd.helpers import ( @@ -82,7 +83,7 @@ volume_opts = [ ] CONF = cfg.CONF -CONF.register_opts(volume_opts) +CONF.register_opts(volume_opts, group=configuration.SHARED_CONF_GROUP) URI_VPOOL_VARRAY_CAPACITY = '/block/vpools/{0}/varrays/{1}/capacity' URI_BLOCK_EXPORTS_FOR_INITIATORS = '/block/exports?initiators={0}' diff --git a/cinder/volume/drivers/coprhd/scaleio.py b/cinder/volume/drivers/coprhd/scaleio.py index 81e01b38bb7..23c56e168a9 100644 --- a/cinder/volume/drivers/coprhd/scaleio.py +++ b/cinder/volume/drivers/coprhd/scaleio.py @@ -26,6 +26,7 @@ from six.moves import urllib from cinder import exception from cinder.i18n import _ from cinder import interface +from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.coprhd import common as coprhd_common @@ -55,7 +56,7 @@ scaleio_opts = [ ] CONF = cfg.CONF -CONF.register_opts(scaleio_opts) +CONF.register_opts(scaleio_opts, group=configuration.SHARED_CONF_GROUP) @interface.volumedriver diff --git a/cinder/volume/drivers/datera/datera_iscsi.py b/cinder/volume/drivers/datera/datera_iscsi.py index 11a7cc9f653..ae270768ae6 100644 --- a/cinder/volume/drivers/datera/datera_iscsi.py +++ b/cinder/volume/drivers/datera/datera_iscsi.py @@ -24,6 +24,7 @@ import six from cinder import exception from cinder.i18n import _ from cinder import utils +from cinder.volume import configuration from cinder.volume.drivers.san import san import cinder.volume.drivers.datera.datera_api2 as api2 @@ -70,7 +71,7 @@ d_opts = [ CONF = cfg.CONF CONF.import_opt('driver_use_ssl', 'cinder.volume.driver') -CONF.register_opts(d_opts) +CONF.register_opts(d_opts, group=configuration.SHARED_CONF_GROUP) @six.add_metaclass(utils.TraceWrapperWithABCMetaclass) diff --git a/cinder/volume/drivers/dell_emc/ps.py b/cinder/volume/drivers/dell_emc/ps.py index fb9434e37c1..69e0eb82dbb 100644 --- a/cinder/volume/drivers/dell_emc/ps.py +++ b/cinder/volume/drivers/dell_emc/ps.py @@ -33,6 +33,7 @@ from cinder.i18n import _ from cinder import interface from cinder import ssh_utils from cinder import utils +from cinder.volume import configuration from cinder.volume.drivers import san LOG = logging.getLogger(__name__) @@ -54,7 +55,7 @@ eqlx_opts = [ CONF = cfg.CONF -CONF.register_opts(eqlx_opts) +CONF.register_opts(eqlx_opts, group=configuration.SHARED_CONF_GROUP) def with_timeout(f): diff --git a/cinder/volume/drivers/dell_emc/sc/storagecenter_common.py b/cinder/volume/drivers/dell_emc/sc/storagecenter_common.py index 840a553ea5c..53d0e8a855f 100644 --- a/cinder/volume/drivers/dell_emc/sc/storagecenter_common.py +++ b/cinder/volume/drivers/dell_emc/sc/storagecenter_common.py @@ -22,6 +22,7 @@ import six from cinder import exception from cinder.i18n import _ from cinder.objects import fields +from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.dell_emc.sc import storagecenter_api from cinder.volume.drivers.san.san import san_opts @@ -70,7 +71,7 @@ common_opts = [ LOG = logging.getLogger(__name__) CONF = cfg.CONF -CONF.register_opts(common_opts) +CONF.register_opts(common_opts, group=configuration.SHARED_CONF_GROUP) class SCCommonDriver(driver.ManageableVD, diff --git a/cinder/volume/drivers/dell_emc/scaleio/driver.py b/cinder/volume/drivers/dell_emc/scaleio/driver.py index a0444779b03..e5ea1660d17 100644 --- a/cinder/volume/drivers/dell_emc/scaleio/driver.py +++ b/cinder/volume/drivers/dell_emc/scaleio/driver.py @@ -41,6 +41,7 @@ from cinder import objects from cinder import utils from cinder.objects import fields +from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.san import san from cinder.volume import qos_specs @@ -89,7 +90,7 @@ scaleio_opts = [ 'Maximum value allowed for ScaleIO is 10.0.') ] -CONF.register_opts(scaleio_opts) +CONF.register_opts(scaleio_opts, group=configuration.SHARED_CONF_GROUP) STORAGE_POOL_NAME = 'sio:sp_name' STORAGE_POOL_ID = 'sio:sp_id' diff --git a/cinder/volume/drivers/dell_emc/unity/driver.py b/cinder/volume/drivers/dell_emc/unity/driver.py index 6cb35483406..2d0f5f0724d 100644 --- a/cinder/volume/drivers/dell_emc/unity/driver.py +++ b/cinder/volume/drivers/dell_emc/unity/driver.py @@ -19,6 +19,7 @@ from oslo_config import cfg from oslo_log import log as logging from cinder import interface +from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.dell_emc.unity import adapter from cinder.volume.drivers.san.san import san_opts @@ -38,7 +39,7 @@ UNITY_OPTS = [ help='A comma-separated list of iSCSI or FC ports to be used. ' 'Each port can be Unix-style glob expressions.')] -CONF.register_opts(UNITY_OPTS) +CONF.register_opts(UNITY_OPTS, group=configuration.SHARED_CONF_GROUP) @interface.volumedriver diff --git a/cinder/volume/drivers/dell_emc/vmax/common.py b/cinder/volume/drivers/dell_emc/vmax/common.py index c7fb9f54196..f52caef06de 100644 --- a/cinder/volume/drivers/dell_emc/vmax/common.py +++ b/cinder/volume/drivers/dell_emc/vmax/common.py @@ -23,6 +23,7 @@ import six from cinder import exception from cinder.i18n import _ +from cinder.volume import configuration from cinder.volume.drivers.dell_emc.vmax import masking from cinder.volume.drivers.dell_emc.vmax import provision from cinder.volume.drivers.dell_emc.vmax import rest @@ -57,7 +58,7 @@ vmax_opts = [ help='Use this value to enable ' 'the initiator_check.')] -CONF.register_opts(vmax_opts) +CONF.register_opts(vmax_opts, group=configuration.SHARED_CONF_GROUP) class VMAXCommon(object): diff --git a/cinder/volume/drivers/dell_emc/vnx/common.py b/cinder/volume/drivers/dell_emc/vnx/common.py index ad94645422c..903e97cc40c 100644 --- a/cinder/volume/drivers/dell_emc/vnx/common.py +++ b/cinder/volume/drivers/dell_emc/vnx/common.py @@ -24,6 +24,7 @@ storops = importutils.try_import('storops') from cinder import exception from cinder.i18n import _ +from cinder.volume import configuration from cinder.volume.drivers.dell_emc.vnx import const from cinder.volume import volume_types @@ -105,7 +106,7 @@ VNX_OPTS = [ 'By default, the value is False.') ] -CONF.register_opts(VNX_OPTS) +CONF.register_opts(VNX_OPTS, group=configuration.SHARED_CONF_GROUP) PROTOCOL_FC = 'fc' diff --git a/cinder/volume/drivers/dell_emc/xtremio.py b/cinder/volume/drivers/dell_emc/xtremio.py index 3837bcd3b58..a617d3ff548 100644 --- a/cinder/volume/drivers/dell_emc/xtremio.py +++ b/cinder/volume/drivers/dell_emc/xtremio.py @@ -49,6 +49,7 @@ from cinder.i18n import _ from cinder import interface from cinder.objects import fields from cinder import utils +from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.san import san from cinder.zonemanager import utils as fczm_utils @@ -72,7 +73,7 @@ XTREMIO_OPTS = [ default=100, help='Number of volumes created from each cached glance image')] -CONF.register_opts(XTREMIO_OPTS) +CONF.register_opts(XTREMIO_OPTS, group=configuration.SHARED_CONF_GROUP) RANDOM = random.Random() OBJ_NOT_FOUND_ERR = 'obj_not_found' diff --git a/cinder/volume/drivers/disco/disco.py b/cinder/volume/drivers/disco/disco.py index 4b1b785c566..de5c3ea1b6c 100644 --- a/cinder/volume/drivers/disco/disco.py +++ b/cinder/volume/drivers/disco/disco.py @@ -31,6 +31,7 @@ from cinder import exception from cinder.i18n import _ from cinder.image import image_utils from cinder import interface +from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.disco import disco_api from cinder.volume.drivers.disco import disco_attach_detach @@ -99,7 +100,7 @@ DISCO_CODE_MAPPING = { } CONF = cfg.CONF -CONF.register_opts(disco_opts) +CONF.register_opts(disco_opts, group=configuration.SHARED_CONF_GROUP) # Driver to communicate with DISCO storage solution diff --git a/cinder/volume/drivers/dothill/dothill_common.py b/cinder/volume/drivers/dothill/dothill_common.py index 12ac6e15fa4..e8decf74fa1 100644 --- a/cinder/volume/drivers/dothill/dothill_common.py +++ b/cinder/volume/drivers/dothill/dothill_common.py @@ -28,6 +28,7 @@ from oslo_log import log as logging from cinder import exception from cinder.i18n import _ from cinder.objects import fields +from cinder.volume import configuration from cinder.volume.drivers.dothill import dothill_client as dothill LOG = logging.getLogger(__name__) @@ -58,8 +59,8 @@ iscsi_opts = [ ] CONF = cfg.CONF -CONF.register_opts(common_opts) -CONF.register_opts(iscsi_opts) +CONF.register_opts(common_opts, group=configuration.SHARED_CONF_GROUP) +CONF.register_opts(iscsi_opts, group=configuration.SHARED_CONF_GROUP) class DotHillCommon(object): diff --git a/cinder/volume/drivers/drbdmanagedrv.py b/cinder/volume/drivers/drbdmanagedrv.py index 65779ef6073..650ff55e20d 100644 --- a/cinder/volume/drivers/drbdmanagedrv.py +++ b/cinder/volume/drivers/drbdmanagedrv.py @@ -39,6 +39,7 @@ from oslo_utils import units from cinder import exception from cinder.i18n import _ from cinder import interface +from cinder.volume import configuration from cinder.volume import driver try: @@ -108,7 +109,7 @@ drbd_opts = [ CONF = cfg.CONF -CONF.register_opts(drbd_opts) +CONF.register_opts(drbd_opts, group=configuration.SHARED_CONF_GROUP) AUX_PROP_CINDER_VOL_ID = "cinder-id" diff --git a/cinder/volume/drivers/falconstor/fss_common.py b/cinder/volume/drivers/falconstor/fss_common.py index 8afa25558d5..c74a96ae2dd 100644 --- a/cinder/volume/drivers/falconstor/fss_common.py +++ b/cinder/volume/drivers/falconstor/fss_common.py @@ -28,6 +28,7 @@ import six from cinder import exception from cinder.i18n import _ +from cinder.volume import configuration from cinder.volume.drivers.falconstor import rest_proxy from cinder.volume.drivers.san import san @@ -63,7 +64,7 @@ FSS_OPTS = [ ] CONF = cfg.CONF -CONF.register_opts(FSS_OPTS) +CONF.register_opts(FSS_OPTS, group=configuration.SHARED_CONF_GROUP) class FalconstorBaseDriver(san.SanDriver): diff --git a/cinder/volume/drivers/fujitsu/eternus_dx_common.py b/cinder/volume/drivers/fujitsu/eternus_dx_common.py index cd293cf387f..16649678b5a 100644 --- a/cinder/volume/drivers/fujitsu/eternus_dx_common.py +++ b/cinder/volume/drivers/fujitsu/eternus_dx_common.py @@ -28,6 +28,7 @@ from xml.etree.ElementTree import parse from cinder import exception from cinder.i18n import _ +from cinder.volume import configuration as conf from oslo_concurrency import lockutils from oslo_config import cfg from oslo_log import log as logging @@ -134,7 +135,7 @@ RETCODE_dic = { '35347': 'Copy table size is not enough', } -CONF.register_opts(FJ_ETERNUS_DX_OPT_opts) +CONF.register_opts(FJ_ETERNUS_DX_OPT_opts, group=conf.SHARED_CONF_GROUP) class FJDXCommon(object): diff --git a/cinder/volume/drivers/fusionstorage/dsware.py b/cinder/volume/drivers/fusionstorage/dsware.py index 792da560a83..7f17fdd6f94 100644 --- a/cinder/volume/drivers/fusionstorage/dsware.py +++ b/cinder/volume/drivers/fusionstorage/dsware.py @@ -27,6 +27,7 @@ from cinder import exception from cinder.i18n import _ from cinder.image import image_utils from cinder import interface +from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.fusionstorage import fspythonapi @@ -54,7 +55,7 @@ volume_opts = [ ] CONF = cfg.CONF -CONF.register_opts(volume_opts) +CONF.register_opts(volume_opts, group=configuration.SHARED_CONF_GROUP) OLD_VERSION = 1 NEW_VERSION = 0 diff --git a/cinder/volume/drivers/hgst.py b/cinder/volume/drivers/hgst.py index b306b8e15d7..26bbb81ba94 100644 --- a/cinder/volume/drivers/hgst.py +++ b/cinder/volume/drivers/hgst.py @@ -37,6 +37,7 @@ from cinder import exception from cinder.i18n import _ from cinder.image import image_utils from cinder import interface +from cinder.volume import configuration from cinder.volume import driver from cinder.volume import utils as volutils @@ -66,7 +67,7 @@ hgst_opts = [ CONF = cfg.CONF -CONF.register_opts(hgst_opts) +CONF.register_opts(hgst_opts, group=configuration.SHARED_CONF_GROUP) @interface.volumedriver diff --git a/cinder/volume/drivers/hitachi/hbsd_common.py b/cinder/volume/drivers/hitachi/hbsd_common.py index 5e4e5186c36..f49886293cb 100644 --- a/cinder/volume/drivers/hitachi/hbsd_common.py +++ b/cinder/volume/drivers/hitachi/hbsd_common.py @@ -26,6 +26,7 @@ import six from cinder import exception from cinder import utils +from cinder.volume import configuration from cinder.volume.drivers.hitachi import hbsd_basiclib as basic_lib from cinder.volume.drivers.hitachi import hbsd_horcm as horcm from cinder.volume.drivers.hitachi import hbsd_snm2 as snm2 @@ -89,7 +90,7 @@ volume_opts = [ ] CONF = cfg.CONF -CONF.register_opts(volume_opts) +CONF.register_opts(volume_opts, group=configuration.SHARED_CONF_GROUP) class TryLock(object): diff --git a/cinder/volume/drivers/hitachi/hbsd_fc.py b/cinder/volume/drivers/hitachi/hbsd_fc.py index 3ba7a44fcd2..aaf581ab437 100644 --- a/cinder/volume/drivers/hitachi/hbsd_fc.py +++ b/cinder/volume/drivers/hitachi/hbsd_fc.py @@ -29,6 +29,7 @@ from cinder import exception from cinder.i18n import _ from cinder import interface from cinder import utils +from cinder.volume import configuration import cinder.volume.driver from cinder.volume.drivers.hitachi import hbsd_basiclib as basic_lib from cinder.volume.drivers.hitachi import hbsd_common as common @@ -43,7 +44,7 @@ volume_opts = [ ] CONF = cfg.CONF -CONF.register_opts(volume_opts) +CONF.register_opts(volume_opts, group=configuration.SHARED_CONF_GROUP) @interface.volumedriver diff --git a/cinder/volume/drivers/hitachi/hbsd_horcm.py b/cinder/volume/drivers/hitachi/hbsd_horcm.py index b694d8a7e95..d27f59ec54d 100644 --- a/cinder/volume/drivers/hitachi/hbsd_horcm.py +++ b/cinder/volume/drivers/hitachi/hbsd_horcm.py @@ -29,6 +29,7 @@ import six from cinder import exception from cinder import utils +from cinder.volume import configuration from cinder.volume.drivers.hitachi import hbsd_basiclib as basic_lib GETSTORAGEARRAY_ONCE = 100 @@ -116,7 +117,7 @@ volume_opts = [ ] CONF = cfg.CONF -CONF.register_opts(volume_opts) +CONF.register_opts(volume_opts, group=configuration.SHARED_CONF_GROUP) def horcm_synchronized(function): diff --git a/cinder/volume/drivers/hitachi/hbsd_iscsi.py b/cinder/volume/drivers/hitachi/hbsd_iscsi.py index 39cc6c6625c..425d4d6e0a8 100644 --- a/cinder/volume/drivers/hitachi/hbsd_iscsi.py +++ b/cinder/volume/drivers/hitachi/hbsd_iscsi.py @@ -28,6 +28,7 @@ from cinder import exception from cinder.i18n import _ from cinder import interface from cinder import utils +from cinder.volume import configuration import cinder.volume.driver from cinder.volume.drivers.hitachi import hbsd_basiclib as basic_lib from cinder.volume.drivers.hitachi import hbsd_common as common @@ -51,7 +52,7 @@ volume_opts = [ ] CONF = cfg.CONF -CONF.register_opts(volume_opts) +CONF.register_opts(volume_opts, group=configuration.SHARED_CONF_GROUP) @interface.volumedriver diff --git a/cinder/volume/drivers/hitachi/hnas_nfs.py b/cinder/volume/drivers/hitachi/hnas_nfs.py index 01007c3c663..212fc2d231f 100644 --- a/cinder/volume/drivers/hitachi/hnas_nfs.py +++ b/cinder/volume/drivers/hitachi/hnas_nfs.py @@ -33,6 +33,7 @@ from cinder.i18n import _ from cinder.image import image_utils from cinder import interface from cinder import utils as cutils +from cinder.volume import configuration from cinder.volume.drivers.hitachi import hnas_backend from cinder.volume.drivers.hitachi import hnas_utils from cinder.volume.drivers import nfs @@ -53,7 +54,7 @@ NFS_OPTS = [ ] CONF = cfg.CONF -CONF.register_opts(NFS_OPTS) +CONF.register_opts(NFS_OPTS, group=configuration.SHARED_CONF_GROUP) HNAS_DEFAULT_CONFIG = {'ssc_cmd': 'ssc', 'ssh_port': '22'} diff --git a/cinder/volume/drivers/hitachi/hnas_utils.py b/cinder/volume/drivers/hitachi/hnas_utils.py index f18346211be..5a2aae950b1 100644 --- a/cinder/volume/drivers/hitachi/hnas_utils.py +++ b/cinder/volume/drivers/hitachi/hnas_utils.py @@ -27,6 +27,7 @@ from xml.etree import ElementTree as ETree from cinder import exception from cinder.i18n import _ +from cinder.volume import configuration from cinder.volume import volume_types LOG = logging.getLogger(__name__) @@ -83,7 +84,7 @@ drivers_common_opts = [ ] CONF = cfg.CONF -CONF.register_opts(drivers_common_opts) +CONF.register_opts(drivers_common_opts, group=configuration.SHARED_CONF_GROUP) def _check_conf_params(config, pool_name, idx): diff --git a/cinder/volume/drivers/hitachi/vsp_common.py b/cinder/volume/drivers/hitachi/vsp_common.py index 12c435ddcc1..a6ae748b9fa 100644 --- a/cinder/volume/drivers/hitachi/vsp_common.py +++ b/cinder/volume/drivers/hitachi/vsp_common.py @@ -26,6 +26,7 @@ import six from cinder import coordination from cinder import exception from cinder import utils as cinder_utils +from cinder.volume import configuration from cinder.volume.drivers.hitachi import vsp_utils as utils from cinder.volume import utils as volume_utils @@ -111,7 +112,7 @@ _REQUIRED_COMMON_OPTS = [ ] CONF = cfg.CONF -CONF.register_opts(common_opts) +CONF.register_opts(common_opts, group=configuration.SHARED_CONF_GROUP) LOG = logging.getLogger(__name__) MSG = utils.VSPMsg diff --git a/cinder/volume/drivers/hitachi/vsp_fc.py b/cinder/volume/drivers/hitachi/vsp_fc.py index 048ca3f27e1..3ab4b43f13a 100644 --- a/cinder/volume/drivers/hitachi/vsp_fc.py +++ b/cinder/volume/drivers/hitachi/vsp_fc.py @@ -17,6 +17,7 @@ from oslo_config import cfg from cinder import interface +from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.hitachi import vsp_common as common from cinder.volume.drivers.hitachi import vsp_utils as utils @@ -45,7 +46,7 @@ _DRIVER_INFO = { } CONF = cfg.CONF -CONF.register_opts(fc_opts) +CONF.register_opts(fc_opts, group=configuration.SHARED_CONF_GROUP) @interface.volumedriver diff --git a/cinder/volume/drivers/hitachi/vsp_horcm.py b/cinder/volume/drivers/hitachi/vsp_horcm.py index f7f23dca501..1df062aebe6 100644 --- a/cinder/volume/drivers/hitachi/vsp_horcm.py +++ b/cinder/volume/drivers/hitachi/vsp_horcm.py @@ -32,6 +32,7 @@ from six.moves import range from cinder import coordination from cinder import exception from cinder import utils as cinder_utils +from cinder.volume import configuration from cinder.volume.drivers.hitachi import vsp_common as common from cinder.volume.drivers.hitachi import vsp_utils as utils @@ -223,7 +224,7 @@ _REQUIRED_HORCM_OPTS = [ ] CONF = cfg.CONF -CONF.register_opts(horcm_opts) +CONF.register_opts(horcm_opts, group=configuration.SHARED_CONF_GROUP) LOG = logging.getLogger(__name__) MSG = utils.VSPMsg diff --git a/cinder/volume/drivers/hitachi/vsp_iscsi.py b/cinder/volume/drivers/hitachi/vsp_iscsi.py index 2134b4aff0b..521413a3183 100644 --- a/cinder/volume/drivers/hitachi/vsp_iscsi.py +++ b/cinder/volume/drivers/hitachi/vsp_iscsi.py @@ -17,6 +17,7 @@ from oslo_config import cfg from cinder import interface +from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.hitachi import vsp_common as common from cinder.volume.drivers.hitachi import vsp_utils as utils @@ -52,7 +53,7 @@ _DRIVER_INFO = { } CONF = cfg.CONF -CONF.register_opts(iscsi_opts) +CONF.register_opts(iscsi_opts, group=configuration.SHARED_CONF_GROUP) @interface.volumedriver diff --git a/cinder/volume/drivers/hpe/hpe_3par_common.py b/cinder/volume/drivers/hpe/hpe_3par_common.py index 89cca988e13..5e6dfd435b3 100644 --- a/cinder/volume/drivers/hpe/hpe_3par_common.py +++ b/cinder/volume/drivers/hpe/hpe_3par_common.py @@ -62,6 +62,7 @@ from cinder import exception from cinder import flow_utils from cinder.i18n import _ from cinder.objects import fields +from cinder.volume import configuration from cinder.volume import qos_specs from cinder.volume import utils as volume_utils from cinder.volume import volume_types @@ -128,7 +129,7 @@ hpe3par_opts = [ CONF = cfg.CONF -CONF.register_opts(hpe3par_opts) +CONF.register_opts(hpe3par_opts, group=configuration.SHARED_CONF_GROUP) # Input/output (total read/write) operations per second. THROUGHPUT = 'throughput' diff --git a/cinder/volume/drivers/hpe/hpe_lefthand_iscsi.py b/cinder/volume/drivers/hpe/hpe_lefthand_iscsi.py index 35f4993c162..c76ffd3ea04 100644 --- a/cinder/volume/drivers/hpe/hpe_lefthand_iscsi.py +++ b/cinder/volume/drivers/hpe/hpe_lefthand_iscsi.py @@ -47,6 +47,7 @@ from cinder.i18n import _ from cinder import interface from cinder.objects import fields from cinder import utils as cinder_utils +from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.san import san from cinder.volume import utils @@ -98,7 +99,7 @@ hpelefthand_opts = [ ] CONF = cfg.CONF -CONF.register_opts(hpelefthand_opts) +CONF.register_opts(hpelefthand_opts, group=configuration.SHARED_CONF_GROUP) MIN_API_VERSION = "1.1" MIN_CLIENT_VERSION = '2.1.0' diff --git a/cinder/volume/drivers/huawei/huawei_driver.py b/cinder/volume/drivers/huawei/huawei_driver.py index 7d2f8892490..38868b2c523 100644 --- a/cinder/volume/drivers/huawei/huawei_driver.py +++ b/cinder/volume/drivers/huawei/huawei_driver.py @@ -31,6 +31,7 @@ from cinder.i18n import _ from cinder import interface from cinder.objects import fields from cinder import utils +from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.huawei import constants from cinder.volume.drivers.huawei import fc_zone_helper @@ -72,7 +73,7 @@ huawei_opts = [ ] CONF = cfg.CONF -CONF.register_opts(huawei_opts) +CONF.register_opts(huawei_opts, group=configuration.SHARED_CONF_GROUP) snap_attrs = ('id', 'volume_id', 'volume', 'provider_location') Snapshot = collections.namedtuple('Snapshot', snap_attrs) diff --git a/cinder/volume/drivers/ibm/flashsystem_common.py b/cinder/volume/drivers/ibm/flashsystem_common.py index 572953f137d..84b7cc7bb23 100644 --- a/cinder/volume/drivers/ibm/flashsystem_common.py +++ b/cinder/volume/drivers/ibm/flashsystem_common.py @@ -38,6 +38,7 @@ from cinder import context from cinder import exception from cinder.i18n import _ from cinder import utils +from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.san import san from cinder.volume import utils as volume_utils @@ -60,7 +61,7 @@ flashsystem_opts = [ ] CONF = cfg.CONF -CONF.register_opts(flashsystem_opts) +CONF.register_opts(flashsystem_opts, group=configuration.SHARED_CONF_GROUP) class FlashSystemDriver(san.SanDriver, diff --git a/cinder/volume/drivers/ibm/flashsystem_fc.py b/cinder/volume/drivers/ibm/flashsystem_fc.py index 30f89629a80..9a242a1d4bf 100644 --- a/cinder/volume/drivers/ibm/flashsystem_fc.py +++ b/cinder/volume/drivers/ibm/flashsystem_fc.py @@ -35,6 +35,7 @@ from cinder import exception from cinder.i18n import _ from cinder import interface from cinder import utils +from cinder.volume import configuration from cinder.volume.drivers.ibm import flashsystem_common as fscommon from cinder.volume.drivers.san import san from cinder.zonemanager import utils as fczm_utils @@ -50,7 +51,7 @@ flashsystem_fc_opts = [ ] CONF = cfg.CONF -CONF.register_opts(flashsystem_fc_opts) +CONF.register_opts(flashsystem_fc_opts, group=configuration.SHARED_CONF_GROUP) @interface.volumedriver diff --git a/cinder/volume/drivers/ibm/flashsystem_iscsi.py b/cinder/volume/drivers/ibm/flashsystem_iscsi.py index edacb988891..60e440f6060 100644 --- a/cinder/volume/drivers/ibm/flashsystem_iscsi.py +++ b/cinder/volume/drivers/ibm/flashsystem_iscsi.py @@ -35,6 +35,7 @@ from cinder import exception from cinder.i18n import _ from cinder import interface from cinder import utils +from cinder.volume import configuration as conf from cinder.volume.drivers.ibm import flashsystem_common as fscommon from cinder.volume.drivers.san import san @@ -48,7 +49,7 @@ flashsystem_iscsi_opts = [ ] CONF = cfg.CONF -CONF.register_opts(flashsystem_iscsi_opts) +CONF.register_opts(flashsystem_iscsi_opts, group=conf.SHARED_CONF_GROUP) @interface.volumedriver diff --git a/cinder/volume/drivers/ibm/gpfs.py b/cinder/volume/drivers/ibm/gpfs.py index ff4a02b629f..80d8968a8e6 100644 --- a/cinder/volume/drivers/ibm/gpfs.py +++ b/cinder/volume/drivers/ibm/gpfs.py @@ -35,6 +35,7 @@ from cinder.image import image_utils from cinder import interface from cinder.objects import fields from cinder import utils +from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers import nfs from cinder.volume.drivers import remotefs @@ -116,8 +117,8 @@ gpfs_remote_ssh_opts = [ ] CONF = cfg.CONF -CONF.register_opts(gpfs_opts) -CONF.register_opts(gpfs_remote_ssh_opts) +CONF.register_opts(gpfs_opts, group=configuration.SHARED_CONF_GROUP) +CONF.register_opts(gpfs_remote_ssh_opts, group=configuration.SHARED_CONF_GROUP) def _different(difference_tuple): diff --git a/cinder/volume/drivers/ibm/ibm_storage/ds8k_proxy.py b/cinder/volume/drivers/ibm/ibm_storage/ds8k_proxy.py index 5bf7b5a0011..b21896d5f6d 100644 --- a/cinder/volume/drivers/ibm/ibm_storage/ds8k_proxy.py +++ b/cinder/volume/drivers/ibm/ibm_storage/ds8k_proxy.py @@ -70,6 +70,7 @@ from cinder import exception from cinder.i18n import _ from cinder import objects from cinder.objects import fields +from cinder.volume import configuration import cinder.volume.drivers.ibm.ibm_storage as storage from cinder.volume.drivers.ibm.ibm_storage import ( ds8k_replication as replication) @@ -120,7 +121,7 @@ ds8k_opts = [ ] CONF = cfg.CONF -CONF.register_opts(ds8k_opts) +CONF.register_opts(ds8k_opts, group=configuration.SHARED_CONF_GROUP) class Lun(object): diff --git a/cinder/volume/drivers/ibm/ibm_storage/ibm_storage.py b/cinder/volume/drivers/ibm/ibm_storage/ibm_storage.py index 0e127bc950a..89fb7422c1d 100644 --- a/cinder/volume/drivers/ibm/ibm_storage/ibm_storage.py +++ b/cinder/volume/drivers/ibm/ibm_storage/ibm_storage.py @@ -25,6 +25,7 @@ from oslo_utils import importutils from cinder import exception from cinder import interface +from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.san import san from cinder.zonemanager import utils as fczm_utils @@ -52,7 +53,7 @@ driver_opts = [ ] CONF = cfg.CONF -CONF.register_opts(driver_opts) +CONF.register_opts(driver_opts, group=configuration.SHARED_CONF_GROUP) LOG = logging.getLogger(__name__) diff --git a/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py b/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py index c46f69fa444..e78faaa74fe 100644 --- a/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py +++ b/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py @@ -39,6 +39,7 @@ from cinder import objects from cinder.objects import fields from cinder import ssh_utils from cinder import utils as cinder_utils +from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.ibm.storwize_svc import ( replication as storwize_rep) @@ -127,7 +128,7 @@ storwize_svc_opts = [ ] CONF = cfg.CONF -CONF.register_opts(storwize_svc_opts) +CONF.register_opts(storwize_svc_opts, group=configuration.SHARED_CONF_GROUP) class StorwizeSSH(object): diff --git a/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_fc.py b/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_fc.py index 99adc9f0483..350c9e5e2f0 100644 --- a/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_fc.py +++ b/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_fc.py @@ -42,6 +42,7 @@ from cinder import exception from cinder.i18n import _ from cinder import interface from cinder import utils +from cinder.volume import configuration from cinder.volume.drivers.ibm.storwize_svc import ( storwize_svc_common as storwize_common) from cinder.zonemanager import utils as fczm_utils @@ -56,7 +57,7 @@ storwize_svc_fc_opts = [ ] CONF = cfg.CONF -CONF.register_opts(storwize_svc_fc_opts) +CONF.register_opts(storwize_svc_fc_opts, group=configuration.SHARED_CONF_GROUP) @interface.volumedriver diff --git a/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_iscsi.py b/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_iscsi.py index 486f342672e..1af2fb827d6 100644 --- a/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_iscsi.py +++ b/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_iscsi.py @@ -42,6 +42,7 @@ from cinder import exception from cinder.i18n import _ from cinder import interface from cinder import utils +from cinder.volume import configuration as conf from cinder.volume.drivers.ibm.storwize_svc import ( storwize_svc_common as storwize_common) @@ -56,7 +57,7 @@ storwize_svc_iscsi_opts = [ ] CONF = cfg.CONF -CONF.register_opts(storwize_svc_iscsi_opts) +CONF.register_opts(storwize_svc_iscsi_opts, group=conf.SHARED_CONF_GROUP) @interface.volumedriver diff --git a/cinder/volume/drivers/infinidat.py b/cinder/volume/drivers/infinidat.py index 772be96bec4..4e641f54441 100644 --- a/cinder/volume/drivers/infinidat.py +++ b/cinder/volume/drivers/infinidat.py @@ -33,6 +33,7 @@ from cinder import interface from cinder.objects import fields from cinder import utils from cinder import version +from cinder.volume import configuration from cinder.volume.drivers.san import san from cinder.volume import utils as vol_utils from cinder.zonemanager import utils as fczm_utils @@ -74,7 +75,7 @@ infinidat_opts = [ ] CONF = cfg.CONF -CONF.register_opts(infinidat_opts) +CONF.register_opts(infinidat_opts, group=configuration.SHARED_CONF_GROUP) def infinisdk_to_cinder_exceptions(func): diff --git a/cinder/volume/drivers/infortrend/raidcmd_cli/common_cli.py b/cinder/volume/drivers/infortrend/raidcmd_cli/common_cli.py index 99443481d1e..92bdd2a18d7 100644 --- a/cinder/volume/drivers/infortrend/raidcmd_cli/common_cli.py +++ b/cinder/volume/drivers/infortrend/raidcmd_cli/common_cli.py @@ -27,6 +27,7 @@ from oslo_utils import units from cinder import exception from cinder.i18n import _ +from cinder.volume import configuration as conf from cinder.volume.drivers.infortrend.raidcmd_cli import cli_factory as cli from cinder.volume.drivers.san import san from cinder.volume import volume_types @@ -79,8 +80,8 @@ infortrend_esds_extra_opts = [ ] CONF = cfg.CONF -CONF.register_opts(infortrend_esds_opts) -CONF.register_opts(infortrend_esds_extra_opts) +CONF.register_opts(infortrend_esds_opts, group=conf.SHARED_CONF_GROUP) +CONF.register_opts(infortrend_esds_extra_opts, group=conf.SHARED_CONF_GROUP) CLI_RC_FILTER = { 'CreatePartition': {'error': _('Failed to create partition.')}, diff --git a/cinder/volume/drivers/kaminario/kaminario_common.py b/cinder/volume/drivers/kaminario/kaminario_common.py index 1567856b33b..97b22a74117 100644 --- a/cinder/volume/drivers/kaminario/kaminario_common.py +++ b/cinder/volume/drivers/kaminario/kaminario_common.py @@ -34,6 +34,7 @@ from cinder.i18n import _ from cinder import objects from cinder.objects import fields from cinder import utils +from cinder.volume import configuration from cinder.volume.drivers.san import san from cinder.volume import utils as vol_utils @@ -52,7 +53,7 @@ kaminario_opts = [ "on setting this option as True.")] CONF = cfg.CONF -CONF.register_opts(kaminario_opts) +CONF.register_opts(kaminario_opts, group=configuration.SHARED_CONF_GROUP) K2HTTPError = requests.exceptions.HTTPError K2_RETRY_ERRORS = ("MC_ERR_BUSY", "MC_ERR_BUSY_SPECIFIC", diff --git a/cinder/volume/drivers/lenovo/lenovo_common.py b/cinder/volume/drivers/lenovo/lenovo_common.py index 9893774ae30..7e92296abb4 100644 --- a/cinder/volume/drivers/lenovo/lenovo_common.py +++ b/cinder/volume/drivers/lenovo/lenovo_common.py @@ -16,6 +16,7 @@ from oslo_config import cfg +from cinder.volume import configuration from cinder.volume.drivers.dothill import dothill_common from cinder.volume.drivers.lenovo import lenovo_client @@ -45,8 +46,8 @@ iscsi_opts = [ ] CONF = cfg.CONF -CONF.register_opts(common_opts) -CONF.register_opts(iscsi_opts) +CONF.register_opts(common_opts, group=configuration.SHARED_CONF_GROUP) +CONF.register_opts(iscsi_opts, group=configuration.SHARED_CONF_GROUP) class LenovoCommon(dothill_common.DotHillCommon): diff --git a/cinder/volume/drivers/lvm.py b/cinder/volume/drivers/lvm.py index 18e5dc5bd03..4cf41d3603d 100644 --- a/cinder/volume/drivers/lvm.py +++ b/cinder/volume/drivers/lvm.py @@ -33,6 +33,7 @@ from cinder.i18n import _ from cinder.image import image_utils from cinder import interface from cinder import utils +from cinder.volume import configuration from cinder.volume import driver from cinder.volume import utils as volutils @@ -77,7 +78,7 @@ volume_opts = [ ] CONF = cfg.CONF -CONF.register_opts(volume_opts) +CONF.register_opts(volume_opts, group=configuration.SHARED_CONF_GROUP) @interface.volumedriver diff --git a/cinder/volume/drivers/nec/volume_common.py b/cinder/volume/drivers/nec/volume_common.py index 5e7cc178ccc..2a705045617 100644 --- a/cinder/volume/drivers/nec/volume_common.py +++ b/cinder/volume/drivers/nec/volume_common.py @@ -29,6 +29,7 @@ from oslo_utils import units from cinder import context from cinder import exception from cinder.i18n import _ +from cinder.volume import configuration from cinder.volume.drivers.nec import cli from cinder.volume.drivers.san import san from cinder.volume import qos_specs @@ -101,7 +102,7 @@ mstorage_opts = [ help='Number of iSCSI portals.'), ] -FLAGS.register_opts(mstorage_opts) +FLAGS.register_opts(mstorage_opts, group=configuration.SHARED_CONF_GROUP) def convert_to_name(uuid): diff --git a/cinder/volume/drivers/netapp/options.py b/cinder/volume/drivers/netapp/options.py index 4d3564424cf..e1c6d58a0e7 100644 --- a/cinder/volume/drivers/netapp/options.py +++ b/cinder/volume/drivers/netapp/options.py @@ -27,6 +27,8 @@ place to ensure re usability and better management of configuration options. from oslo_config import cfg from oslo_config import types +from cinder.volume import configuration as conf + NETAPP_SIZE_MULTIPLIER_DEFAULT = 1.2 netapp_proxy_opts = [ @@ -213,15 +215,15 @@ netapp_replication_opts = [ 'during a failover.'), ] CONF = cfg.CONF -CONF.register_opts(netapp_proxy_opts) -CONF.register_opts(netapp_connection_opts) -CONF.register_opts(netapp_transport_opts) -CONF.register_opts(netapp_basicauth_opts) -CONF.register_opts(netapp_cluster_opts) -CONF.register_opts(netapp_7mode_opts) -CONF.register_opts(netapp_provisioning_opts) -CONF.register_opts(netapp_img_cache_opts) -CONF.register_opts(netapp_eseries_opts) -CONF.register_opts(netapp_nfs_extra_opts) -CONF.register_opts(netapp_san_opts) -CONF.register_opts(netapp_replication_opts) +CONF.register_opts(netapp_proxy_opts, group=conf.SHARED_CONF_GROUP) +CONF.register_opts(netapp_connection_opts, group=conf.SHARED_CONF_GROUP) +CONF.register_opts(netapp_transport_opts, group=conf.SHARED_CONF_GROUP) +CONF.register_opts(netapp_basicauth_opts, group=conf.SHARED_CONF_GROUP) +CONF.register_opts(netapp_cluster_opts, group=conf.SHARED_CONF_GROUP) +CONF.register_opts(netapp_7mode_opts, group=conf.SHARED_CONF_GROUP) +CONF.register_opts(netapp_provisioning_opts, group=conf.SHARED_CONF_GROUP) +CONF.register_opts(netapp_img_cache_opts, group=conf.SHARED_CONF_GROUP) +CONF.register_opts(netapp_eseries_opts, group=conf.SHARED_CONF_GROUP) +CONF.register_opts(netapp_nfs_extra_opts, group=conf.SHARED_CONF_GROUP) +CONF.register_opts(netapp_san_opts, group=conf.SHARED_CONF_GROUP) +CONF.register_opts(netapp_replication_opts, group=conf.SHARED_CONF_GROUP) diff --git a/cinder/volume/drivers/nexenta/options.py b/cinder/volume/drivers/nexenta/options.py index 8bbc3587907..6c74cd4812f 100644 --- a/cinder/volume/drivers/nexenta/options.py +++ b/cinder/volume/drivers/nexenta/options.py @@ -15,6 +15,7 @@ from oslo_config import cfg +from cinder.volume import configuration as conf NEXENTA_EDGE_OPTS = [ cfg.StrOpt('nexenta_nbd_symlinks_dir', @@ -147,9 +148,9 @@ NEXENTA_RRMGR_OPTS = [ ] CONF = cfg.CONF -CONF.register_opts(NEXENTA_CONNECTION_OPTS) -CONF.register_opts(NEXENTA_ISCSI_OPTS) -CONF.register_opts(NEXENTA_DATASET_OPTS) -CONF.register_opts(NEXENTA_NFS_OPTS) -CONF.register_opts(NEXENTA_RRMGR_OPTS) -CONF.register_opts(NEXENTA_EDGE_OPTS) +CONF.register_opts(NEXENTA_CONNECTION_OPTS, group=conf.SHARED_CONF_GROUP) +CONF.register_opts(NEXENTA_ISCSI_OPTS, group=conf.SHARED_CONF_GROUP) +CONF.register_opts(NEXENTA_DATASET_OPTS, group=conf.SHARED_CONF_GROUP) +CONF.register_opts(NEXENTA_NFS_OPTS, group=conf.SHARED_CONF_GROUP) +CONF.register_opts(NEXENTA_RRMGR_OPTS, group=conf.SHARED_CONF_GROUP) +CONF.register_opts(NEXENTA_EDGE_OPTS, group=conf.SHARED_CONF_GROUP) diff --git a/cinder/volume/drivers/nfs.py b/cinder/volume/drivers/nfs.py index 1f81f086cf9..8044a9e29cb 100644 --- a/cinder/volume/drivers/nfs.py +++ b/cinder/volume/drivers/nfs.py @@ -31,6 +31,7 @@ from cinder.i18n import _ from cinder.image import image_utils from cinder import interface from cinder import utils +from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers import remotefs @@ -71,7 +72,7 @@ nfs_opts = [ ] CONF = cfg.CONF -CONF.register_opts(nfs_opts) +CONF.register_opts(nfs_opts, group=configuration.SHARED_CONF_GROUP) @interface.volumedriver @@ -96,12 +97,10 @@ class NfsDriver(remotefs.RemoteFSSnapDriverDistributed, driver.ExtendVD): root_helper = utils.get_root_helper() # base bound to instance is used in RemoteFsConnector. self.base = getattr(self.configuration, - 'nfs_mount_point_base', - CONF.nfs_mount_point_base) + 'nfs_mount_point_base') self.base = os.path.realpath(self.base) opts = getattr(self.configuration, - 'nfs_mount_options', - CONF.nfs_mount_options) + 'nfs_mount_options') nas_mount_options = getattr(self.configuration, 'nas_mount_options', diff --git a/cinder/volume/drivers/nimble.py b/cinder/volume/drivers/nimble.py index e1054ceeb97..692020e2259 100644 --- a/cinder/volume/drivers/nimble.py +++ b/cinder/volume/drivers/nimble.py @@ -38,6 +38,7 @@ from cinder.i18n import _ from cinder import interface from cinder.objects import volume from cinder import utils +from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.san import san from cinder.volume import volume_types @@ -93,7 +94,7 @@ nimble_opts = [ help='Path to Nimble Array SSL certificate'), ] CONF = cfg.CONF -CONF.register_opts(nimble_opts) +CONF.register_opts(nimble_opts, group=configuration.SHARED_CONF_GROUP) class NimbleDriverException(exception.VolumeDriverException): diff --git a/cinder/volume/drivers/prophetstor/options.py b/cinder/volume/drivers/prophetstor/options.py index ec7364dda4d..e5eb051e079 100644 --- a/cinder/volume/drivers/prophetstor/options.py +++ b/cinder/volume/drivers/prophetstor/options.py @@ -16,6 +16,7 @@ from oslo_config import cfg +from cinder.volume import configuration DPL_OPTS = [ cfg.StrOpt('dpl_pool', @@ -27,4 +28,4 @@ DPL_OPTS = [ ] CONF = cfg.CONF -CONF.register_opts(DPL_OPTS) +CONF.register_opts(DPL_OPTS, group=configuration.SHARED_CONF_GROUP) diff --git a/cinder/volume/drivers/pure.py b/cinder/volume/drivers/pure.py index ad10bf4c714..1153d8910a3 100644 --- a/cinder/volume/drivers/pure.py +++ b/cinder/volume/drivers/pure.py @@ -36,6 +36,7 @@ from cinder.i18n import _ from cinder import interface from cinder.objects import fields from cinder import utils +from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.san import san from cinder.volume import utils as volume_utils @@ -82,7 +83,7 @@ PURE_OPTS = [ ] CONF = cfg.CONF -CONF.register_opts(PURE_OPTS) +CONF.register_opts(PURE_OPTS, group=configuration.SHARED_CONF_GROUP) INVALID_CHARACTERS = re.compile(r"[^-a-zA-Z0-9]") GENERATED_NAME = re.compile(r".*-[a-f0-9]{32}-cinder$") diff --git a/cinder/volume/drivers/qnap.py b/cinder/volume/drivers/qnap.py index 3de21a4c617..4edbb48e752 100644 --- a/cinder/volume/drivers/qnap.py +++ b/cinder/volume/drivers/qnap.py @@ -38,6 +38,7 @@ from six.moves import urllib from cinder import exception from cinder.i18n import _ from cinder import interface +from cinder.volume import configuration from cinder.volume.drivers.san import san LOG = logging.getLogger(__name__) @@ -53,7 +54,7 @@ qnap_opts = [ ] CONF = cfg.CONF -CONF.register_opts(qnap_opts) +CONF.register_opts(qnap_opts, group=configuration.SHARED_CONF_GROUP) @interface.volumedriver diff --git a/cinder/volume/drivers/quobyte.py b/cinder/volume/drivers/quobyte.py index bcc19e4d45e..bf6f231134d 100644 --- a/cinder/volume/drivers/quobyte.py +++ b/cinder/volume/drivers/quobyte.py @@ -29,6 +29,7 @@ from cinder.i18n import _ from cinder.image import image_utils from cinder import interface from cinder import utils +from cinder.volume import configuration from cinder.volume.drivers import remotefs as remotefs_drv VERSION = '1.1.5' @@ -56,7 +57,7 @@ volume_opts = [ ] CONF = cfg.CONF -CONF.register_opts(volume_opts) +CONF.register_opts(volume_opts, group=configuration.SHARED_CONF_GROUP) @interface.volumedriver diff --git a/cinder/volume/drivers/rbd.py b/cinder/volume/drivers/rbd.py index 3d84a038912..f3d0ccb05a4 100644 --- a/cinder/volume/drivers/rbd.py +++ b/cinder/volume/drivers/rbd.py @@ -33,6 +33,7 @@ from cinder.image import image_utils from cinder import interface from cinder.objects import fields from cinder import utils +from cinder.volume import configuration from cinder.volume import driver try: @@ -94,7 +95,7 @@ RBD_OPTS = [ ] CONF = cfg.CONF -CONF.register_opts(RBD_OPTS) +CONF.register_opts(RBD_OPTS, group=configuration.SHARED_CONF_GROUP) EXTRA_SPECS_REPL_ENABLED = "replication_enabled" diff --git a/cinder/volume/drivers/remotefs.py b/cinder/volume/drivers/remotefs.py index 0052c16ce5f..ba43893cf6b 100644 --- a/cinder/volume/drivers/remotefs.py +++ b/cinder/volume/drivers/remotefs.py @@ -37,6 +37,7 @@ from cinder.i18n import _ from cinder.image import image_utils from cinder.objects import fields from cinder import utils +from cinder.volume import configuration from cinder.volume import driver from cinder.volume import utils as volume_utils @@ -99,8 +100,8 @@ volume_opts = [ ] CONF = cfg.CONF -CONF.register_opts(nas_opts) -CONF.register_opts(volume_opts) +CONF.register_opts(nas_opts, group=configuration.SHARED_CONF_GROUP) +CONF.register_opts(volume_opts, group=configuration.SHARED_CONF_GROUP) # TODO(bluex): remove when drivers stop using it diff --git a/cinder/volume/drivers/san/hp/hpmsa_common.py b/cinder/volume/drivers/san/hp/hpmsa_common.py index 884bc07d601..7bc10094499 100644 --- a/cinder/volume/drivers/san/hp/hpmsa_common.py +++ b/cinder/volume/drivers/san/hp/hpmsa_common.py @@ -16,6 +16,7 @@ from oslo_config import cfg +from cinder.volume import configuration from cinder.volume.drivers.dothill import dothill_common from cinder.volume.drivers.san.hp import hpmsa_client @@ -46,8 +47,8 @@ iscsi_opts = [ ] CONF = cfg.CONF -CONF.register_opts(common_opts) -CONF.register_opts(iscsi_opts) +CONF.register_opts(common_opts, group=configuration.SHARED_CONF_GROUP) +CONF.register_opts(iscsi_opts, group=configuration.SHARED_CONF_GROUP) class HPMSACommon(dothill_common.DotHillCommon): diff --git a/cinder/volume/drivers/san/san.py b/cinder/volume/drivers/san/san.py index b297ed82b5a..a5de68831c4 100644 --- a/cinder/volume/drivers/san/san.py +++ b/cinder/volume/drivers/san/san.py @@ -31,6 +31,7 @@ from cinder import exception from cinder.i18n import _ from cinder import ssh_utils from cinder import utils +from cinder.volume import configuration from cinder.volume import driver LOG = logging.getLogger(__name__) @@ -74,7 +75,7 @@ san_opts = [ ] CONF = cfg.CONF -CONF.register_opts(san_opts) +CONF.register_opts(san_opts, group=configuration.SHARED_CONF_GROUP) class SanDriver(driver.BaseVD): diff --git a/cinder/volume/drivers/sheepdog.py b/cinder/volume/drivers/sheepdog.py index 8471cc3f58d..a2b4bc513e3 100644 --- a/cinder/volume/drivers/sheepdog.py +++ b/cinder/volume/drivers/sheepdog.py @@ -36,6 +36,7 @@ from cinder.i18n import _ from cinder.image import image_utils from cinder import interface from cinder import utils +from cinder.volume import configuration from cinder.volume import driver @@ -52,7 +53,7 @@ sheepdog_opts = [ CONF = cfg.CONF CONF.import_opt("image_conversion_dir", "cinder.image.image_utils") -CONF.register_opts(sheepdog_opts) +CONF.register_opts(sheepdog_opts, group=configuration.SHARED_CONF_GROUP) class SheepdogClient(object): diff --git a/cinder/volume/drivers/solidfire.py b/cinder/volume/drivers/solidfire.py index 273577e9ea5..f755522728a 100644 --- a/cinder/volume/drivers/solidfire.py +++ b/cinder/volume/drivers/solidfire.py @@ -39,6 +39,7 @@ from cinder.image import image_utils from cinder import interface from cinder.objects import fields from cinder import utils +from cinder.volume import configuration from cinder.volume.drivers.san import san from cinder.volume import qos_specs from cinder.volume.targets import iscsi as iscsi_driver @@ -101,7 +102,7 @@ sf_opts = [ help='Utilize volume access groups on a per-tenant basis.')] CONF = cfg.CONF -CONF.register_opts(sf_opts) +CONF.register_opts(sf_opts, group=configuration.SHARED_CONF_GROUP) # SolidFire API Error Constants xExceededLimit = 'xExceededLimit' diff --git a/cinder/volume/drivers/synology/synology_common.py b/cinder/volume/drivers/synology/synology_common.py index ea1bfb6e25c..67a0ae9d74f 100644 --- a/cinder/volume/drivers/synology/synology_common.py +++ b/cinder/volume/drivers/synology/synology_common.py @@ -43,6 +43,7 @@ from cinder.i18n import _ from cinder.objects import snapshot from cinder.objects import volume from cinder import utils +from cinder.volume import configuration from cinder.volume import utils as volutils @@ -79,7 +80,7 @@ cinder_opts = [ LOG = logging.getLogger(__name__) CONF = cfg.CONF -CONF.register_opts(cinder_opts) +CONF.register_opts(cinder_opts, group=configuration.SHARED_CONF_GROUP) class AESCipher(object): diff --git a/cinder/volume/drivers/tegile.py b/cinder/volume/drivers/tegile.py index 35d3a804685..d435dfd6dfd 100644 --- a/cinder/volume/drivers/tegile.py +++ b/cinder/volume/drivers/tegile.py @@ -29,6 +29,7 @@ from cinder import exception from cinder.i18n import _ from cinder import interface from cinder import utils +from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.san import san from cinder.volume import utils as volume_utils @@ -48,7 +49,7 @@ tegile_opts = [ help='Create volumes in this project')] CONF = cfg.CONF -CONF.register_opts(tegile_opts) +CONF.register_opts(tegile_opts, group=configuration.SHARED_CONF_GROUP) def debugger(func): diff --git a/cinder/volume/drivers/tintri.py b/cinder/volume/drivers/tintri.py index d76c3e7906e..a207042a15c 100644 --- a/cinder/volume/drivers/tintri.py +++ b/cinder/volume/drivers/tintri.py @@ -35,6 +35,7 @@ from cinder.i18n import _ from cinder.image import image_utils from cinder import interface from cinder import utils +from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers import nfs @@ -63,7 +64,7 @@ tintri_opts = [ ] CONF = cfg.CONF -CONF.register_opts(tintri_opts) +CONF.register_opts(tintri_opts, group=configuration.SHARED_CONF_GROUP) @interface.volumedriver diff --git a/cinder/volume/drivers/violin/v7000_common.py b/cinder/volume/drivers/violin/v7000_common.py index bb3f81f0087..c2d4b17cbbd 100644 --- a/cinder/volume/drivers/violin/v7000_common.py +++ b/cinder/volume/drivers/violin/v7000_common.py @@ -44,6 +44,7 @@ from cinder.db.sqlalchemy import api from cinder import exception from cinder.i18n import _ from cinder import utils +from cinder.volume import configuration from cinder.volume import volume_types @@ -94,7 +95,7 @@ violin_opts = [ ] CONF = cfg.CONF -CONF.register_opts(violin_opts) +CONF.register_opts(violin_opts, group=configuration.SHARED_CONF_GROUP) class V7000Common(object): diff --git a/cinder/volume/drivers/vmware/vmdk.py b/cinder/volume/drivers/vmware/vmdk.py index ec85609eaac..d248a1877ac 100644 --- a/cinder/volume/drivers/vmware/vmdk.py +++ b/cinder/volume/drivers/vmware/vmdk.py @@ -39,6 +39,7 @@ from oslo_vmware import vim_util from cinder import exception from cinder.i18n import _ from cinder import interface +from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.vmware import datastore as hub from cinder.volume.drivers.vmware import exceptions as vmdk_exceptions @@ -130,7 +131,7 @@ vmdk_opts = [ ] CONF = cfg.CONF -CONF.register_opts(vmdk_opts) +CONF.register_opts(vmdk_opts, group=configuration.SHARED_CONF_GROUP) def _get_volume_type_extra_spec(type_id, spec_key, possible_values=None, diff --git a/cinder/volume/drivers/vzstorage.py b/cinder/volume/drivers/vzstorage.py index 90f87b30b57..fecccb7e46b 100644 --- a/cinder/volume/drivers/vzstorage.py +++ b/cinder/volume/drivers/vzstorage.py @@ -31,6 +31,7 @@ from cinder.i18n import _ from cinder.image import image_utils from cinder import interface from cinder import utils +from cinder.volume import configuration from cinder.volume.drivers import remotefs as remotefs_drv VERSION = '1.0' @@ -66,7 +67,7 @@ vzstorage_opts = [ ] CONF = cfg.CONF -CONF.register_opts(vzstorage_opts) +CONF.register_opts(vzstorage_opts, group=configuration.SHARED_CONF_GROUP) PLOOP_BASE_DELTA_NAME = 'root.hds' DISK_FORMAT_RAW = 'raw' @@ -170,12 +171,8 @@ class VZStorageDriver(remotefs_drv.RemoteFSSnapDriver): self._execute_as_root = False root_helper = utils.get_root_helper() # base bound to instance is used in RemoteFsConnector. - self.base = getattr(self.configuration, - 'vzstorage_mount_point_base', - CONF.vzstorage_mount_point_base) - opts = getattr(self.configuration, - 'vzstorage_mount_options', - CONF.vzstorage_mount_options) + self.base = self.configuration.vzstorage_mount_point_base + opts = self.configuration.vzstorage_mount_options self._remotefsclient = remotefs.RemoteFsClient( 'vzstorage', root_helper, execute=execute, diff --git a/cinder/volume/drivers/windows/smbfs.py b/cinder/volume/drivers/windows/smbfs.py index 2abb630df2b..69feb584340 100644 --- a/cinder/volume/drivers/windows/smbfs.py +++ b/cinder/volume/drivers/windows/smbfs.py @@ -30,6 +30,7 @@ from cinder.i18n import _ from cinder.image import image_utils from cinder import interface from cinder import utils +from cinder.volume import configuration from cinder.volume.drivers import remotefs as remotefs_drv VERSION = '1.1.0' @@ -79,7 +80,7 @@ volume_opts = [ ] CONF = cfg.CONF -CONF.register_opts(volume_opts) +CONF.register_opts(volume_opts, group=configuration.SHARED_CONF_GROUP) @interface.volumedriver @@ -114,8 +115,7 @@ class WindowsSmbfsDriver(remotefs_drv.RemoteFSPoolMixin, self.configuration.append_config_values(volume_opts) self.base = getattr(self.configuration, - 'smbfs_mount_point_base', - CONF.smbfs_mount_point_base) + 'smbfs_mount_point_base') self._remotefsclient = remotefs_brick.WindowsRemoteFsClient( 'cifs', root_helper=None, smbfs_mount_point_base=self.base, local_path_for_loopback=True) diff --git a/cinder/volume/drivers/windows/windows.py b/cinder/volume/drivers/windows/windows.py index 0a1abd006b3..001252e16ea 100644 --- a/cinder/volume/drivers/windows/windows.py +++ b/cinder/volume/drivers/windows/windows.py @@ -30,6 +30,7 @@ from oslo_utils import units from oslo_utils import uuidutils from cinder.image import image_utils +from cinder.volume import configuration from cinder.volume import driver from cinder.volume import utils @@ -42,7 +43,7 @@ windows_opts = [ ] CONF = cfg.CONF -CONF.register_opts(windows_opts) +CONF.register_opts(windows_opts, group=configuration.SHARED_CONF_GROUP) class WindowsDriver(driver.ISCSIDriver): diff --git a/cinder/volume/drivers/xio.py b/cinder/volume/drivers/xio.py index 18e039012cf..1b46e966f5d 100644 --- a/cinder/volume/drivers/xio.py +++ b/cinder/volume/drivers/xio.py @@ -23,6 +23,7 @@ from six.moves import urllib from cinder import context from cinder import exception from cinder import interface +from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.san import san from cinder.volume import qos_specs @@ -46,7 +47,7 @@ XIO_OPTS = [ CONF = cfg.CONF -CONF.register_opts(XIO_OPTS) +CONF.register_opts(XIO_OPTS, group=configuration.SHARED_CONF_GROUP) LOG = logging.getLogger(__name__) diff --git a/cinder/volume/drivers/zadara.py b/cinder/volume/drivers/zadara.py index 148c2f0c235..3b021ac2ea4 100644 --- a/cinder/volume/drivers/zadara.py +++ b/cinder/volume/drivers/zadara.py @@ -27,6 +27,7 @@ import six from cinder import exception from cinder.i18n import _ from cinder import interface +from cinder.volume import configuration from cinder.volume import driver LOG = logging.getLogger(__name__) @@ -69,7 +70,7 @@ zadara_opts = [ help="VPSA - Attach snapshot policy for volumes")] CONF = cfg.CONF -CONF.register_opts(zadara_opts) +CONF.register_opts(zadara_opts, group=configuration.SHARED_CONF_GROUP) class ZadaraVPSAConnection(object): diff --git a/cinder/volume/drivers/zfssa/zfssaiscsi.py b/cinder/volume/drivers/zfssa/zfssaiscsi.py index f5a7c781466..6b78b16a0c8 100644 --- a/cinder/volume/drivers/zfssa/zfssaiscsi.py +++ b/cinder/volume/drivers/zfssa/zfssaiscsi.py @@ -28,6 +28,7 @@ from cinder import exception from cinder.i18n import _ from cinder import interface from cinder import utils +from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.san import san from cinder.volume.drivers.zfssa import zfssarest @@ -91,7 +92,7 @@ ZFSSA_OPTS = [ help='Driver policy for volume manage.') ] -CONF.register_opts(ZFSSA_OPTS) +CONF.register_opts(ZFSSA_OPTS, group=configuration.SHARED_CONF_GROUP) ZFSSA_LUN_SPECS = { 'zfssa:volblocksize', diff --git a/cinder/volume/drivers/zfssa/zfssanfs.py b/cinder/volume/drivers/zfssa/zfssanfs.py index f8d17bf5d0f..8e7d46d90ff 100644 --- a/cinder/volume/drivers/zfssa/zfssanfs.py +++ b/cinder/volume/drivers/zfssa/zfssanfs.py @@ -32,6 +32,7 @@ from cinder.image import image_utils from cinder import interface from cinder.objects.volume import Volume from cinder import utils +from cinder.volume import configuration from cinder.volume.drivers import nfs from cinder.volume.drivers.san import san from cinder.volume.drivers.zfssa import zfssarest @@ -71,7 +72,7 @@ ZFSSA_OPTS = [ LOG = log.getLogger(__name__) CONF = cfg.CONF -CONF.register_opts(ZFSSA_OPTS) +CONF.register_opts(ZFSSA_OPTS, group=configuration.SHARED_CONF_GROUP) def factory_zfssa(): diff --git a/cinder/volume/drivers/zte/zte_ks.py b/cinder/volume/drivers/zte/zte_ks.py index d96a61da6b4..cf23947fad7 100644 --- a/cinder/volume/drivers/zte/zte_ks.py +++ b/cinder/volume/drivers/zte/zte_ks.py @@ -29,6 +29,7 @@ from cinder import exception from cinder.i18n import _ from cinder import interface from cinder import utils +from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.zte import zte_pub @@ -80,7 +81,7 @@ zte_opts = [ ] CONF = cfg.CONF -CONF.register_opts(zte_opts) +CONF.register_opts(zte_opts, group=configuration.SHARED_CONF_GROUP) class ZTEVolumeDriver(driver.VolumeDriver): diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index 83f54c77ea1..e486a57f8da 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -112,9 +112,6 @@ VALID_CREATE_GROUP_SRC_GROUP_STATUS = ('available',) VA_LIST = objects.VolumeAttachmentList volume_manager_opts = [ - cfg.StrOpt('volume_driver', - default='cinder.volume.drivers.lvm.LVMVolumeDriver', - help='Driver to use for volume creation'), cfg.IntOpt('migration_create_volume_timeout_secs', default=300, help='Timeout for creating the volume to migrate to ' @@ -123,6 +120,12 @@ volume_manager_opts = [ default=False, help='Offload pending volume delete during ' 'volume service startup'), +] + +volume_backend_opts = [ + cfg.StrOpt('volume_driver', + default='cinder.volume.drivers.lvm.LVMVolumeDriver', + help='Driver to use for volume creation'), cfg.StrOpt('zoning_mode', help='FC Zoning mode configured'), cfg.StrOpt('extra_capabilities', @@ -142,6 +145,7 @@ volume_manager_opts = [ CONF = cfg.CONF CONF.register_opts(volume_manager_opts) +CONF.register_opts(volume_backend_opts, group=config.SHARED_CONF_GROUP) MAPPING = { 'cinder.volume.drivers.hds.nfs.HDSNFSDriver': @@ -202,7 +206,9 @@ class VolumeManager(manager.CleanableManager, # update_service_capabilities needs service_name to be volume super(VolumeManager, self).__init__(service_name='volume', *args, **kwargs) - self.configuration = config.Configuration(volume_manager_opts, + # NOTE(dulek): service_name=None means we're running in unit tests. + service_name = service_name or 'backend_defaults' + self.configuration = config.Configuration(volume_backend_opts, config_group=service_name) self.stats = {} diff --git a/releasenotes/notes/backend-options-ed19e6c63b2b9090.yaml b/releasenotes/notes/backend-options-ed19e6c63b2b9090.yaml new file mode 100644 index 00000000000..55a11324eba --- /dev/null +++ b/releasenotes/notes/backend-options-ed19e6c63b2b9090.yaml @@ -0,0 +1,9 @@ +--- +fixes: + - | + Cinder stopped supporting single-backend configurations in Ocata. However, + sample ``cinder.conf`` was still generated with driver-related options in + ``[DEFAULT]`` section, where those options had no effect at all. Now all of + driver options are listed in ``[backend_defaults]`` section, that indicates + that those options are effective only in this section and + ``[]`` sections listed in ``enabled_backends``.