"""
+
import eventlet
+
eventlet.monkey_patch()
import os
import sys
+from oslo.config import cfg
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
os.pardir,
from cinder.openstack.common import gettextutils
gettextutils.install('cinder')
-from cinder import flags
+from cinder.common import config # Need to register global_opts
from cinder.openstack.common import log as logging
from cinder import service
from cinder import utils
+from cinder import version
+
+
+CONF = cfg.CONF
if __name__ == '__main__':
- flags.parse_args(sys.argv)
+ CONF(sys.argv[1:], project='cinder',
+ version=version.version_string())
logging.setup("cinder")
LOG = logging.getLogger('cinder.all')
# eventlet is updated/released to fix the root issue
import eventlet
+
eventlet.monkey_patch()
import os
import sys
+from oslo.config import cfg
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
os.pardir,
from cinder.openstack.common import gettextutils
gettextutils.install('cinder')
-from cinder import flags
+from cinder.common import config # Need to register global_opts
from cinder.openstack.common import log as logging
from cinder import service
from cinder import utils
+from cinder import version
+
+
+CONF = cfg.CONF
+
if __name__ == '__main__':
- flags.parse_args(sys.argv)
+ CONF(sys.argv[1:], project='cinder',
+ version=version.version_string())
logging.setup("cinder")
utils.monkey_patch()
server = service.WSGIService('osapi_volume')
"""Starter script for Cinder Volume Backup."""
+
import os
import sys
eventlet.monkey_patch()
+from oslo.config import cfg
+
# If ../cinder/__init__.py exists, add ../ to Python search path, so that
# it will override what happens to be installed in /usr/(local/)lib/python...
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
from cinder.openstack.common import gettextutils
gettextutils.install('cinder')
-from cinder import flags
+from cinder.common import config # Need to register global_opts
from cinder.openstack.common import log as logging
from cinder import service
from cinder import utils
+from cinder import version
+
+
+CONF = cfg.CONF
+
if __name__ == '__main__':
- flags.parse_args(sys.argv)
+ CONF(sys.argv[1:], project='cinder',
+ version=version.version_string())
logging.setup("cinder")
utils.monkey_patch()
launcher = service.ProcessLauncher()
import sys
import time
+from oslo.config import cfg
+
# If ../cinder/__init__.py exists, add ../ to Python search path, so that
# it will override what happens to be installed in /usr/(local/)lib/python...
POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
from cinder.openstack.common import gettextutils
gettextutils.install('cinder')
-from oslo.config import cfg
-
+from cinder.common import config # Need to register global_opts
from cinder import context
from cinder import exception
-from cinder import flags
from cinder.openstack.common import log as logging
from cinder.openstack.common import rpc
+from cinder import version
+
delete_exchange_opt = \
cfg.BoolOpt('delete_exchange',
default=False,
help='delete cinder exchange too.')
-FLAGS = flags.FLAGS
-FLAGS.register_cli_opt(delete_exchange_opt)
+CONF = cfg.CONF
+CONF.register_cli_opt(delete_exchange_opt)
def delete_exchange(exch):
x.queue_delete(q)
if __name__ == '__main__':
- args = flags.parse_args(sys.argv)
+ args = CONF(sys.argv[1:], project='cinder',
+ version=version.version_string())
logging.setup("cinder")
delete_queues(args[1:])
- if FLAGS.delete_exchange:
- delete_exchange(FLAGS.control_exchange)
+ if CONF.delete_exchange:
+ delete_exchange(CONF.control_exchange)
CLI interface for cinder management.
"""
+
import os
import sys
import uuid
+from oslo.config import cfg
from sqlalchemy import create_engine, MetaData, Table
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from cinder.openstack.common import gettextutils
gettextutils.install('cinder')
-from oslo.config import cfg
-
+from cinder.common import config # Need to register global_opts
from cinder import context
from cinder import db
from cinder.db import migration
from cinder import exception
-from cinder import flags
from cinder.openstack.common import log as logging
from cinder.openstack.common import rpc
from cinder.openstack.common import uuidutils
from cinder import utils
from cinder import version
-FLAGS = flags.FLAGS
+
+CONF = cfg.CONF
# Decorators for actions
return
rpc.cast(ctxt,
- rpc.queue_get_for(ctxt, FLAGS.volume_topic, host),
+ rpc.queue_get_for(ctxt, CONF.volume_topic, host),
{"method": "delete_volume",
"args": {"volume_id": volume['id']}})
instance = db.instance_get(ctxt, volume['instance_id'])
host = instance['host']
rpc.cast(ctxt,
- rpc.queue_get_for(ctxt, FLAGS.compute_topic, host),
+ rpc.queue_get_for(ctxt, CONF.compute_topic, host),
{"method": "attach_volume",
"args": {"instance_id": instance['id'],
"volume_id": volume['id'],
pass
def list(self):
- for key, value in FLAGS.iteritems():
+ for key, value in CONF.iteritems():
if value is not None:
print '%s = %s' % (key, value)
def errors(self):
"""Get all of the errors from the log files."""
error_found = 0
- if FLAGS.log_dir:
- logs = [x for x in os.listdir(FLAGS.log_dir) if x.endswith('.log')]
+ if CONF.log_dir:
+ logs = [x for x in os.listdir(CONF.log_dir) if x.endswith('.log')]
for file in logs:
- log_file = os.path.join(FLAGS.log_dir, file)
+ log_file = os.path.join(CONF.log_dir, file)
lines = [line.strip() for line in open(log_file, "r")]
lines.reverse()
print_name = 0
fn_args = []
for args, kwargs in getattr(func, 'args', []):
arg = get_arg_string(args[0])
- fn_args.append(getattr(FLAGS.category, arg))
+ fn_args.append(getattr(CONF.category, arg))
return fn_args
def main():
"""Parse options and call the appropriate class/method."""
- FLAGS.register_cli_opt(category_opt)
+ CONF.register_cli_opt(category_opt)
script_name = sys.argv[0]
if len(sys.argv) < 2:
print(_("\nOpenStack Cinder version: %(version)s\n") %
sys.exit(2)
try:
- flags.parse_args(sys.argv)
+ CONF(sys.argv[1:], project='cinder',
+ version=version.version_string())
logging.setup("cinder")
except cfg.ConfigFilesNotFoundError:
- cfgfile = FLAGS.config_file[-1] if FLAGS.config_file else None
+ cfgfile = CONF.config_file[-1] if CONF.config_file else None
if cfgfile and not os.access(cfgfile, os.R_OK):
st = os.stat(cfgfile)
print _("Could not read %s. Re-running with sudo") % cfgfile
print _('Please re-run cinder-manage as root.')
sys.exit(2)
- fn = FLAGS.category.action_fn
+ fn = CONF.category.action_fn
fn_args = fetch_func_args(fn)
fn(*fn_args)
"""Starter script for Cinder Scheduler."""
+
import eventlet
+
eventlet.monkey_patch()
import os
import sys
+from oslo.config import cfg
+
# If ../cinder/__init__.py exists, add ../ to Python search path, so that
# it will override what happens to be installed in /usr/(local/)lib/python...
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
from cinder.openstack.common import gettextutils
gettextutils.install('cinder')
-from cinder import flags
+from cinder.common import config # Need to register global_opts
from cinder.openstack.common import log as logging
from cinder import service
from cinder import utils
+from cinder import version
+
+
+CONF = cfg.CONF
+
if __name__ == '__main__':
- flags.parse_args(sys.argv)
+ CONF(sys.argv[1:], project='cinder',
+ version=version.version_string())
logging.setup("cinder")
utils.monkey_patch()
server = service.Service.create(binary='cinder-scheduler')
"""Starter script for Cinder Volume."""
import eventlet
+
eventlet.monkey_patch()
import os
import sys
+from oslo.config import cfg
+
# If ../cinder/__init__.py exists, add ../ to Python search path, so that
# it will override what happens to be installed in /usr/(local/)lib/python...
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
from cinder.openstack.common import gettextutils
gettextutils.install('cinder')
-from cinder import flags
+from cinder.common import config # Need to register global_opts
from cinder.openstack.common import log as logging
from cinder import service
from cinder import utils
+from cinder import version
+
+
+CONF = cfg.CONF
-FLAGS = flags.FLAGS
if __name__ == '__main__':
- flags.parse_args(sys.argv)
+ CONF(sys.argv[1:], project='cinder',
+ version=version.version_string())
logging.setup("cinder")
utils.monkey_patch()
launcher = service.ProcessLauncher()
- if FLAGS.enabled_backends:
- for backend in FLAGS.enabled_backends:
- host = "%s@%s" % (FLAGS.host, backend)
+ if CONF.enabled_backends:
+ for backend in CONF.enabled_backends:
+ host = "%s@%s" % (CONF.host, backend)
server = service.Service.create(host=host,
service_name=backend)
launcher.launch_server(server)
Jan 1 through Dec 31 of the previous year.
"""
+
import os
import sys
import traceback
+from oslo.config import cfg
+
# If ../cinder/__init__.py exists, add ../ to Python search path, so that
# it will override what happens to be installed in /usr/(local/)lib/python...
POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
from cinder.openstack.common import gettextutils
gettextutils.install('cinder')
+from cinder.common import config # Need to register global_opts
from cinder import context
from cinder import db
-from cinder import flags
from cinder.openstack.common import log as logging
from cinder.openstack.common import rpc
from cinder import utils
+from cinder import version
import cinder.volume.utils
-FLAGS = flags.FLAGS
+CONF = cfg.CONF
+
if __name__ == '__main__':
admin_context = context.get_admin_context()
- flags.parse_args(sys.argv)
+ CONF(sys.argv[1:], project='cinder',
+ version=version.version_string())
logging.setup("cinder")
begin, end = utils.last_completed_audit_period()
print _("Starting volume usage audit")
import os
import socket
-import sys
from oslo.config import cfg
-from cinder import version
-FLAGS = cfg.CONF
-
-
-def parse_args(argv, default_config_files=None):
- FLAGS(argv[1:], project='cinder',
- version=version.version_string(),
- default_config_files=default_config_files)
-
-
-class UnrecognizedFlag(Exception):
- pass
-
-
-def DECLARE(name, module_string, flag_values=FLAGS):
- if module_string not in sys.modules:
- __import__(module_string, globals(), locals())
- if name not in flag_values:
- raise UnrecognizedFlag('%s not defined by %s' % (name, module_string))
+CONF = cfg.CONF
def _get_my_ip():
help='File name for the paste.deploy config for cinder-api'),
cfg.StrOpt('pybasedir',
default=os.path.abspath(os.path.join(os.path.dirname(__file__),
- '../')),
+ '..',
+ '..')),
help='Directory where the cinder python module is installed'),
cfg.StrOpt('bindir',
default='$pybasedir/bin',
debug_opts = [
]
-FLAGS.register_cli_opts(core_opts)
-FLAGS.register_cli_opts(debug_opts)
+CONF.register_cli_opts(core_opts)
+CONF.register_cli_opts(debug_opts)
global_opts = [
cfg.StrOpt('my_ip',
default='cinder.transfer.api.API',
help='The full class name of the volume transfer API class'), ]
-FLAGS.register_opts(global_opts)
+CONF.register_opts(global_opts)
"""Base classes for our unit tests.
-Allows overriding of flags for use of fakes, and some black magic for
+Allows overriding of CONF for use of fakes, and some black magic for
inline callbacks.
"""
+
import functools
import os
import shutil
import stubout
import testtools
+from cinder.common import config # Need to register global_opts
from cinder.db import migration
-from cinder import flags
from cinder.openstack.common.db.sqlalchemy import session
from cinder.openstack.common import log as logging
from cinder.openstack.common import timeutils
from cinder import service
-from cinder.tests import fake_flags
+from cinder.tests import conf_fixture
+
test_opts = [
cfg.StrOpt('sqlite_clean_db',
default=True,
help='should we use everything for testing'), ]
-FLAGS = flags.FLAGS
-FLAGS.register_opts(test_opts)
+CONF = cfg.CONF
+CONF.register_opts(test_opts)
LOG = logging.getLogger(__name__)
if db_migrate.db_version() > db_migrate.INIT_VERSION:
return
else:
- testdb = os.path.join(FLAGS.state_path, sqlite_db)
+ testdb = os.path.join(CONF.state_path, sqlite_db)
if os.path.exists(testdb):
return
db_migrate.db_sync()
self._DB = "".join(line for line in conn.connection.iterdump())
self.engine.dispose()
else:
- cleandb = os.path.join(FLAGS.state_path, sqlite_clean_db)
+ cleandb = os.path.join(CONF.state_path, sqlite_clean_db)
shutil.copyfile(testdb, cleandb)
def setUp(self):
self.addCleanup(self.engine.dispose)
else:
shutil.copyfile(
- os.path.join(FLAGS.state_path, self.sqlite_clean_db),
- os.path.join(FLAGS.state_path, self.sqlite_db))
+ os.path.join(CONF.state_path, self.sqlite_clean_db),
+ os.path.join(CONF.state_path, self.sqlite_db))
class TestCase(testtools.TestCase):
self.log_fixture = self.useFixture(fixtures.FakeLogger())
- fake_flags.set_defaults(FLAGS)
- flags.parse_args([], default_config_files=[])
+ conf_fixture.set_defaults(CONF)
+ CONF([], default_config_files=[])
# NOTE(vish): We need a better method for creating fixtures for tests
# now that we have some required db setup for the system
# to work properly.
self.start = timeutils.utcnow()
- FLAGS.set_default('connection', 'sqlite://', 'database')
- FLAGS.set_default('sqlite_synchronous', False)
+ CONF.set_default('connection', 'sqlite://', 'database')
+ CONF.set_default('sqlite_synchronous', False)
self.log_fixture = self.useFixture(fixtures.FakeLogger())
global _DB_CACHE
if not _DB_CACHE:
_DB_CACHE = Database(session, migration,
- sql_connection=FLAGS.database.connection,
- sqlite_db=FLAGS.sqlite_db,
- sqlite_clean_db=FLAGS.sqlite_clean_db)
+ sql_connection=CONF.database.connection,
+ sqlite_db=CONF.sqlite_db,
+ sqlite_clean_db=CONF.sqlite_clean_db)
self.useFixture(_DB_CACHE)
# emulate some of the mox stuff, we can't use the metaclass
# because it screws with our generators
self.mox = mox.Mox()
self.stubs = stubout.StubOutForTesting()
- self.addCleanup(FLAGS.reset)
+ self.addCleanup(CONF.reset)
self.addCleanup(self.mox.UnsetStubs)
self.addCleanup(self.stubs.UnsetAll)
self.addCleanup(self.stubs.SmartUnsetAll)
self.injected = []
self._services = []
- FLAGS.set_override('fatal_exception_format_errors', True)
+ CONF.set_override('fatal_exception_format_errors', True)
def tearDown(self):
"""Runs after each test method to tear down test environment."""
super(TestCase, self).tearDown()
def flags(self, **kw):
- """Override flag variables for a test."""
+ """Override CONF variables for a test."""
for k, v in kw.iteritems():
- FLAGS.set_override(k, v)
+ CONF.set_override(k, v)
def start_service(self, name, host=None, **kwargs):
host = host and host or uuid.uuid4().hex
--- /dev/null
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2010 United States Government as represented by the
+# Administrator of the National Aeronautics and Space Administration.
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+
+from oslo.config import cfg
+
+
+CONF = cfg.CONF
+
+CONF.import_opt('iscsi_num_targets', 'cinder.volume.drivers.lvm')
+CONF.import_opt('policy_file', 'cinder.policy')
+CONF.import_opt('volume_driver', 'cinder.volume.manager')
+CONF.import_opt('xiv_proxy', 'cinder.volume.drivers.xiv')
+CONF.import_opt('backup_service', 'cinder.backup.manager')
+
+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.FakeISCSIDriver')
+ conf.set_default('iscsi_helper', 'fake')
+ conf.set_default('connection_type', 'fake')
+ conf.set_default('fake_rabbit', True)
+ conf.set_default('rpc_backend', 'cinder.openstack.common.rpc.impl_fake')
+ conf.set_default('iscsi_num_targets', 8)
+ conf.set_default('verbose', True)
+ conf.set_default('connection', 'sqlite://', group='database')
+ conf.set_default('sqlite_synchronous', False)
+ conf.set_default('policy_file', 'cinder/tests/policy.json')
+ conf.set_default('xiv_proxy', 'cinder.tests.test_xiv.XIVFakeProxyDriver')
+ conf.set_default('backup_service', 'cinder.tests.backup.fake_service')
CONF = cfg.CONF
-CONF.register_opt(cfg.IntOpt('answer', default=42, help='test flag'))
+CONF.register_opt(cfg.IntOpt('answer', default=42, help='test conf'))
CONF = cfg.CONF
-CONF.register_opt(cfg.IntOpt('runtime_answer', default=54, help='test flag'))
+CONF.register_opt(cfg.IntOpt('runtime_answer', default=54, help='test conf'))
--- /dev/null
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2010 United States Government as represented by the
+# Administrator of the National Aeronautics and Space Administration.
+# All Rights Reserved.
+# Copyright 2011 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+
+from oslo.config import cfg
+
+from cinder import test
+
+
+CONF = cfg.CONF
+CONF.register_opt(cfg.StrOpt('conf_unittest',
+ default='foo',
+ help='for testing purposes only'))
+
+
+class ConfigTestCase(test.TestCase):
+
+ def setUp(self):
+ super(ConfigTestCase, self).setUp()
+
+ def test_declare(self):
+ self.assert_('answer' not in CONF)
+ CONF.import_opt('answer', 'cinder.tests.declare_conf')
+ self.assert_('answer' in CONF)
+ self.assertEqual(CONF.answer, 42)
+
+ # Make sure we don't overwrite anything
+ CONF.set_override('answer', 256)
+ self.assertEqual(CONF.answer, 256)
+ CONF.import_opt('answer', 'cinder.tests.declare_conf')
+ self.assertEqual(CONF.answer, 256)
+
+ def test_runtime_and_unknown_conf(self):
+ self.assert_('runtime_answer' not in CONF)
+ import cinder.tests.runtime_conf
+ self.assert_('runtime_answer' in CONF)
+ self.assertEqual(CONF.runtime_answer, 54)
+
+ def test_long_vs_short_conf(self):
+ CONF.clear()
+ CONF.register_cli_opt(cfg.StrOpt('duplicate_answer_long',
+ default='val',
+ help='desc'))
+ CONF.register_cli_opt(cfg.IntOpt('duplicate_answer',
+ default=50,
+ help='desc'))
+
+ argv = ['--duplicate_answer=60']
+ CONF(argv, default_config_files=[])
+ self.assertEqual(CONF.duplicate_answer, 60)
+ self.assertEqual(CONF.duplicate_answer_long, 'val')
+
+ def test_conf_leak_left(self):
+ self.assertEqual(CONF.conf_unittest, 'foo')
+ self.flags(conf_unittest='bar')
+ self.assertEqual(CONF.conf_unittest, 'bar')
+
+ def test_conf_leak_right(self):
+ self.assertEqual(CONF.conf_unittest, 'foo')
+ self.flags(conf_unittest='bar')
+ self.assertEqual(CONF.conf_unittest, 'bar')
+
+ def test_conf_overrides(self):
+ self.assertEqual(CONF.conf_unittest, 'foo')
+ self.flags(conf_unittest='bar')
+ self.assertEqual(CONF.conf_unittest, 'bar')
+ CONF.reset()
+ self.assertEqual(CONF.conf_unittest, 'foo')
+++ /dev/null
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
-# Copyright 2010 United States Government as represented by the
-# Administrator of the National Aeronautics and Space Administration.
-# All Rights Reserved.
-# Copyright 2011 Red Hat, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from oslo.config import cfg
-
-from cinder import flags
-from cinder import test
-
-FLAGS = flags.FLAGS
-FLAGS.register_opt(cfg.StrOpt('flags_unittest',
- default='foo',
- help='for testing purposes only'))
-
-
-class FlagsTestCase(test.TestCase):
-
- def setUp(self):
- super(FlagsTestCase, self).setUp()
-
- def test_declare(self):
- self.assert_('answer' not in FLAGS)
- flags.DECLARE('answer', 'cinder.tests.declare_flags')
- self.assert_('answer' in FLAGS)
- self.assertEqual(FLAGS.answer, 42)
-
- # Make sure we don't overwrite anything
- FLAGS.set_override('answer', 256)
- self.assertEqual(FLAGS.answer, 256)
- flags.DECLARE('answer', 'cinder.tests.declare_flags')
- self.assertEqual(FLAGS.answer, 256)
-
- def test_runtime_and_unknown_flags(self):
- self.assert_('runtime_answer' not in FLAGS)
- import cinder.tests.runtime_flags
- self.assert_('runtime_answer' in FLAGS)
- self.assertEqual(FLAGS.runtime_answer, 54)
-
- def test_long_vs_short_flags(self):
- FLAGS.clear()
- FLAGS.register_cli_opt(cfg.StrOpt('duplicate_answer_long',
- default='val',
- help='desc'))
- FLAGS.register_cli_opt(cfg.IntOpt('duplicate_answer',
- default=50,
- help='desc'))
-
- argv = ['flags_test', '--duplicate_answer=60']
- flags.parse_args(argv, default_config_files=[])
- self.assertEqual(FLAGS.duplicate_answer, 60)
- self.assertEqual(FLAGS.duplicate_answer_long, 'val')
-
- def test_flag_leak_left(self):
- self.assertEqual(FLAGS.flags_unittest, 'foo')
- self.flags(flags_unittest='bar')
- self.assertEqual(FLAGS.flags_unittest, 'bar')
-
- def test_flag_leak_right(self):
- self.assertEqual(FLAGS.flags_unittest, 'foo')
- self.flags(flags_unittest='bar')
- self.assertEqual(FLAGS.flags_unittest, 'bar')
-
- def test_flag_overrides(self):
- self.assertEqual(FLAGS.flags_unittest, 'foo')
- self.flags(flags_unittest='bar')
- self.assertEqual(FLAGS.flags_unittest, 'bar')
- FLAGS.reset()
- self.assertEqual(FLAGS.flags_unittest, 'foo')
import cinder.policy
from cinder import quota
from cinder import test
-from cinder.tests import fake_flags
+from cinder.tests import conf_fixture
from cinder.tests.image import fake as fake_image
from cinder.volume import configuration as conf
from cinder.volume import driver
self.assertEquals(volume['volume_type_id'], None)
# Create default volume type
- vol_type = fake_flags.def_vol_type
+ vol_type = conf_fixture.def_vol_type
db.volume_type_create(context.get_admin_context(),
dict(name=vol_type, extra_specs={}))
from cinder import exception
from cinder.openstack.common import log as logging
from cinder import test
-from cinder.tests import fake_flags
+from cinder.tests import conf_fixture
from cinder.volume import volume_types
def test_get_default_volume_type(self):
"""Ensures default volume type can be retrieved."""
type_ref = volume_types.create(self.ctxt,
- fake_flags.def_vol_type,
+ conf_fixture.def_vol_type,
{})
default_vol_type = volume_types.get_default_volume_type()
self.assertEqual(default_vol_type.get('name'),
- fake_flags.def_vol_type)
+ conf_fixture.def_vol_type)
def test_default_volume_type_missing_in_db(self):
"""Ensures proper exception raised if default volume type
# Importing full names to not pollute the namespace and cause possible
# collisions with use of 'from cinder.transfer import <foo>' elsewhere.
-import cinder.flags
+
+from oslo.config import cfg
+
import cinder.openstack.common.importutils
-API = cinder.openstack.common.importutils.import_class(
- cinder.flags.FLAGS.transfer_api_class)
+
+CONF = cfg.CONF
+
+API = cinder.openstack.common.importutils.import_class(CONF.transfer_api_class)
# Importing full names to not pollute the namespace and cause possible
# collisions with use of 'from cinder.volume import <foo>' elsewhere.
-import cinder.flags as flags
+
+
+from oslo.config import cfg
+
import cinder.openstack.common.importutils as import_utils
-API = import_utils.import_class(flags.FLAGS.volume_api_class)
+
+CONF = cfg.CONF
+
+API = import_utils.import_class(CONF.volume_api_class)
:show-inheritance:
-The :mod:`cinder.flags` Module
+The :mod:`cinder.common.config` Module
------------------------------
-.. automodule:: cinder.flags
+.. automodule:: cinder.common.config
:noindex:
:members:
:undoc-members:
Tests
-----
-The :mod:`declare_flags` Module
+The :mod:`declare_conf` Module
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. automodule:: cinder.tests.declare_flags
+.. automodule:: cinder.tests.declare_conf
:noindex:
:members:
:undoc-members:
:show-inheritance:
-The :mod:`fake_flags` Module
+The :mod:`conf_fixture` Module
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. automodule:: cinder.tests.fake_flags
- :noindex:
- :members:
- :undoc-members:
- :show-inheritance:
-
-
-The :mod:`flags_unittest` Module
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. automodule:: cinder.tests.flags_unittest
+.. automodule:: cinder.tests.conf_fixture
:noindex:
:members:
:undoc-members:
:show-inheritance:
-The :mod:`real_flags` Module
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. automodule:: cinder.tests.real_flags
- :noindex:
- :members:
- :undoc-members:
- :show-inheritance:
-
-
The :mod:`rpc_unittest` Module
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:show-inheritance:
-The :mod:`runtime_flags` Module
+The :mod:`runtime_conf` Module
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. automodule:: cinder.tests.runtime_flags
+.. automodule:: cinder.tests.runtime_conf
:noindex:
:members:
:undoc-members:
If you are running the unit tests from a shared folder, you may see tests start
to fail or stop completely as a result of Python lockfile issues [#f4]_. You
can get around this by manually setting or updating the following line in
-``cinder/tests/fake_flags.py``::
+``cinder/tests/conf_fixture.py``::
- FLAGS['lock_path'].SetDefault('/tmp')
+ CONF['lock_path'].SetDefault('/tmp')
Note that you may use any location (not just ``/tmp``!) as long as it is not
a shared folder.