Move cfg to nova.openstack.common
Move it here so that it can be kept in sync with openstack-common using the new update.py script for code in openstack-common's incubation area. See here for more details: http://wiki.openstack.org/CommonLibrary#Incubation Note: this commit just moves the existing code in Nova with no other changes. A subsequent commit will sync it with latest openstack-common so that it is easier see the new changes. Change-Id: If88d678b1b9bad3d37117de7f7159d7fea8ab4c8
This commit is contained in:
parent
18af5655ee
commit
3ee969966f
@ -40,11 +40,11 @@ if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'nova', '__init__.py')):
|
||||
gettext.install('nova', unicode=1)
|
||||
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import context
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova import log as logging
|
||||
from nova.openstack.common import cfg
|
||||
from nova import rpc
|
||||
from nova import utils
|
||||
|
||||
|
@ -38,9 +38,9 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
|
||||
sys.path.insert(0, possible_topdir)
|
||||
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import flags
|
||||
from nova import log as logging
|
||||
from nova.openstack.common import cfg
|
||||
from nova import rpc
|
||||
from nova import service
|
||||
from nova import utils
|
||||
|
@ -35,11 +35,11 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
|
||||
sys.path.insert(0, possible_topdir)
|
||||
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import compute
|
||||
from nova import flags
|
||||
from nova import log as logging
|
||||
from nova import network
|
||||
from nova.openstack.common import cfg
|
||||
from nova import service
|
||||
from nova import utils
|
||||
from nova import volume
|
||||
|
@ -27,10 +27,10 @@ public methods.
|
||||
import functools
|
||||
import sys
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova import log as logging
|
||||
from nova.openstack.common import cfg
|
||||
|
||||
|
||||
ldap_opts = [
|
||||
|
@ -30,13 +30,13 @@ import tempfile
|
||||
import uuid
|
||||
import zipfile
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import context
|
||||
from nova import crypto
|
||||
from nova import db
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova import log as logging
|
||||
from nova.openstack.common import cfg
|
||||
from nova import utils
|
||||
from nova.auth import signer
|
||||
|
||||
|
@ -32,7 +32,7 @@ import sys
|
||||
|
||||
import gflags
|
||||
|
||||
from nova.common import cfg
|
||||
from nova.openstack.common import cfg
|
||||
|
||||
|
||||
class FlagValues(object):
|
||||
|
@ -40,9 +40,9 @@ import sys
|
||||
import traceback
|
||||
|
||||
import nova
|
||||
from nova.common import cfg
|
||||
from nova import flags
|
||||
from nova import local
|
||||
from nova.openstack.common import cfg
|
||||
from nova import version
|
||||
|
||||
|
||||
|
@ -15,10 +15,10 @@
|
||||
|
||||
import uuid
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import flags
|
||||
from nova import utils
|
||||
from nova import log as logging
|
||||
from nova.openstack.common import cfg
|
||||
|
||||
|
||||
LOG = logging.getLogger('nova.exception')
|
||||
|
@ -13,9 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import flags
|
||||
from nova import log as logging
|
||||
from nova.openstack.common import cfg
|
||||
from nova import utils
|
||||
from nova.exception import ClassNotFound
|
||||
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
import nova.context
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import flags
|
||||
from nova.openstack.common import cfg
|
||||
from nova import rpc
|
||||
|
||||
|
||||
|
15
nova/openstack/__init__.py
Normal file
15
nova/openstack/__init__.py
Normal file
@ -0,0 +1,15 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright (c) 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.
|
15
nova/openstack/common/__init__.py
Normal file
15
nova/openstack/common/__init__.py
Normal file
@ -0,0 +1,15 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright (c) 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.
|
@ -17,10 +17,10 @@
|
||||
|
||||
"""Policy Engine For Nova"""
|
||||
|
||||
from nova.common import cfg
|
||||
from nova.common import policy
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova.openstack.common import cfg
|
||||
from nova import utils
|
||||
|
||||
|
||||
|
@ -18,8 +18,8 @@
|
||||
|
||||
"""Quotas for instances, volumes, and floating ips."""
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import db
|
||||
from nova.openstack.common import cfg
|
||||
from nova import flags
|
||||
|
||||
|
||||
|
@ -17,10 +17,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from nova.common import cfg
|
||||
from nova.utils import import_object
|
||||
from nova.rpc.common import RemoteError, LOG
|
||||
from nova import flags
|
||||
from nova.openstack.common import cfg
|
||||
from nova.rpc.common import RemoteError, LOG
|
||||
from nova.utils import import_object
|
||||
|
||||
|
||||
rpc_backend_opt = \
|
||||
|
@ -19,10 +19,10 @@
|
||||
|
||||
import copy
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova import log as logging
|
||||
from nova.openstack.common import cfg
|
||||
|
||||
|
||||
LOG = logging.getLogger('nova.rpc')
|
||||
|
@ -25,8 +25,8 @@ import greenlet
|
||||
import qpid.messaging
|
||||
import qpid.messaging.exceptions
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import flags
|
||||
from nova.openstack.common import cfg
|
||||
from nova.rpc import amqp as rpc_amqp
|
||||
from nova.rpc import common as rpc_common
|
||||
from nova.rpc.common import LOG
|
||||
|
@ -22,11 +22,11 @@ import functools
|
||||
from novaclient import v1_1 as novaclient
|
||||
from novaclient import exceptions as novaclient_exceptions
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import db
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova import log as logging
|
||||
from nova.openstack.common import cfg
|
||||
from nova import rpc
|
||||
from nova import utils
|
||||
|
||||
|
@ -22,7 +22,6 @@ Scheduler base class that all Schedulers should inherit from
|
||||
"""
|
||||
|
||||
from nova.api.ec2 import ec2utils
|
||||
from nova.common import cfg
|
||||
from nova.compute import api as compute_api
|
||||
from nova.compute import power_state
|
||||
from nova.compute import vm_states
|
||||
@ -30,6 +29,7 @@ from nova import db
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova import log as logging
|
||||
from nova.openstack.common import cfg
|
||||
from nova import rpc
|
||||
from nova.scheduler import host_manager
|
||||
from nova.scheduler import zone_manager
|
||||
|
@ -15,9 +15,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import flags
|
||||
from nova import log as logging
|
||||
from nova.openstack.common import cfg
|
||||
from nova.scheduler.filters import abstract_filter
|
||||
|
||||
|
||||
|
@ -14,9 +14,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import flags
|
||||
from nova import log as logging
|
||||
from nova.openstack.common import cfg
|
||||
from nova.scheduler.filters import abstract_filter
|
||||
|
||||
LOG = logging.getLogger('nova.scheduler.filter.ram_filter')
|
||||
|
@ -21,11 +21,11 @@ import datetime
|
||||
import types
|
||||
import UserDict
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import db
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova import log as logging
|
||||
from nova.openstack.common import cfg
|
||||
from nova import utils
|
||||
|
||||
|
||||
|
@ -22,8 +22,8 @@ The cost-function and weights are tabulated, and the host with the least cost
|
||||
is then selected for provisioning.
|
||||
"""
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import flags
|
||||
from nova.openstack.common import cfg
|
||||
from nova import log as logging
|
||||
|
||||
|
||||
|
@ -23,13 +23,13 @@ Scheduler Service
|
||||
|
||||
import functools
|
||||
|
||||
from nova.common import cfg
|
||||
from nova.compute import vm_states
|
||||
from nova import db
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova import log as logging
|
||||
from nova import manager
|
||||
from nova.openstack.common import cfg
|
||||
from nova import rpc
|
||||
from nova import utils
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
||||
Scheduler that allows routing some calls to one driver and others to another.
|
||||
"""
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import flags
|
||||
from nova.openstack.common import cfg
|
||||
from nova import utils
|
||||
from nova.scheduler import driver
|
||||
|
||||
|
@ -24,9 +24,9 @@ import datetime
|
||||
import json
|
||||
import os
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import flags
|
||||
from nova import log as logging
|
||||
from nova.openstack.common import cfg
|
||||
|
||||
|
||||
scheduler_json_config_location_opt = \
|
||||
|
@ -21,10 +21,10 @@
|
||||
Simple Scheduler
|
||||
"""
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import db
|
||||
from nova import flags
|
||||
from nova import exception
|
||||
from nova.openstack.common import cfg
|
||||
from nova.scheduler import driver
|
||||
from nova.scheduler import chance
|
||||
from nova import utils
|
||||
|
@ -19,11 +19,11 @@
|
||||
VSA Simple Scheduler
|
||||
"""
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import context
|
||||
from nova import db
|
||||
from nova import flags
|
||||
from nova import log as logging
|
||||
from nova.openstack.common import cfg
|
||||
from nova import rpc
|
||||
from nova import utils
|
||||
from nova import exception
|
||||
|
@ -23,10 +23,10 @@ import traceback
|
||||
from eventlet import greenpool
|
||||
from novaclient import v1_1 as novaclient
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import db
|
||||
from nova import flags
|
||||
from nova import log as logging
|
||||
from nova.openstack.common import cfg
|
||||
from nova import utils
|
||||
|
||||
|
||||
|
@ -25,12 +25,12 @@ import os
|
||||
import eventlet
|
||||
import greenlet
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import context
|
||||
from nova import db
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova import log as logging
|
||||
from nova.openstack.common import cfg
|
||||
from nova import rpc
|
||||
from nova import utils
|
||||
from nova import version
|
||||
|
@ -33,10 +33,10 @@ import mox
|
||||
import nose.plugins.skip
|
||||
import stubout
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import flags
|
||||
import nova.image.fake
|
||||
from nova import log
|
||||
from nova.openstack.common import cfg
|
||||
from nova import utils
|
||||
from nova import service
|
||||
from nova.testing.fake import rabbit
|
||||
|
@ -16,8 +16,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import flags
|
||||
from nova.openstack.common import cfg
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
FLAGS.add_option(cfg.IntOpt('answer', default=42, help='test flag'))
|
||||
|
@ -16,8 +16,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import flags
|
||||
from nova.openstack.common import cfg
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
FLAGS.add_option(cfg.IntOpt('runtime_answer', default=54, help='test flag'))
|
||||
|
@ -1,789 +0,0 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# 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.
|
||||
|
||||
import os
|
||||
import sys
|
||||
import StringIO
|
||||
import tempfile
|
||||
|
||||
import stubout
|
||||
|
||||
from nova import test
|
||||
from nova.common.cfg import *
|
||||
|
||||
|
||||
class BaseTestCase(test.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.conf = ConfigOpts(prog='test',
|
||||
version='1.0',
|
||||
usage='%prog FOO BAR',
|
||||
default_config_files=[])
|
||||
self.tempfiles = []
|
||||
self.stubs = stubout.StubOutForTesting()
|
||||
|
||||
def tearDown(self):
|
||||
self.remove_tempfiles()
|
||||
self.stubs.UnsetAll()
|
||||
|
||||
def create_tempfiles(self, files):
|
||||
for (basename, contents) in files:
|
||||
(fd, path) = tempfile.mkstemp(prefix=basename)
|
||||
self.tempfiles.append(path)
|
||||
try:
|
||||
os.write(fd, contents)
|
||||
finally:
|
||||
os.close(fd)
|
||||
return self.tempfiles[-len(files):]
|
||||
|
||||
def remove_tempfiles(self):
|
||||
for p in self.tempfiles:
|
||||
os.remove(p)
|
||||
|
||||
|
||||
class LeftoversTestCase(BaseTestCase):
|
||||
|
||||
def test_leftovers(self):
|
||||
self.conf.register_cli_opt(StrOpt('foo'))
|
||||
self.conf.register_cli_opt(StrOpt('bar'))
|
||||
|
||||
leftovers = self.conf(['those', '--foo', 'this',
|
||||
'thems', '--bar', 'that', 'these'])
|
||||
|
||||
self.assertEquals(leftovers, ['those', 'thems', 'these'])
|
||||
|
||||
|
||||
class FindConfigFilesTestCase(BaseTestCase):
|
||||
|
||||
def test_find_config_files(self):
|
||||
config_files = \
|
||||
[os.path.expanduser('~/.blaa/blaa.conf'), '/etc/foo.conf']
|
||||
|
||||
self.stubs.Set(os.path, 'exists', lambda p: p in config_files)
|
||||
|
||||
self.assertEquals(find_config_files(project='blaa', prog='foo'),
|
||||
config_files)
|
||||
|
||||
|
||||
class CliOptsTestCase(BaseTestCase):
|
||||
|
||||
def _do_cli_test(self, opt_class, default, cli_args, value):
|
||||
self.conf.register_cli_opt(opt_class('foo', default=default))
|
||||
|
||||
self.conf(cli_args)
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'foo'))
|
||||
self.assertEquals(self.conf.foo, value)
|
||||
|
||||
def test_str_default(self):
|
||||
self._do_cli_test(StrOpt, None, [], None)
|
||||
|
||||
def test_str_arg(self):
|
||||
self._do_cli_test(StrOpt, None, ['--foo', 'bar'], 'bar')
|
||||
|
||||
def test_bool_default(self):
|
||||
self._do_cli_test(BoolOpt, False, [], False)
|
||||
|
||||
def test_bool_arg(self):
|
||||
self._do_cli_test(BoolOpt, None, ['--foo'], True)
|
||||
|
||||
def test_bool_arg_inverse(self):
|
||||
self._do_cli_test(BoolOpt, None, ['--foo', '--nofoo'], False)
|
||||
|
||||
def test_int_default(self):
|
||||
self._do_cli_test(IntOpt, 10, [], 10)
|
||||
|
||||
def test_int_arg(self):
|
||||
self._do_cli_test(IntOpt, None, ['--foo=20'], 20)
|
||||
|
||||
def test_float_default(self):
|
||||
self._do_cli_test(FloatOpt, 1.0, [], 1.0)
|
||||
|
||||
def test_float_arg(self):
|
||||
self._do_cli_test(FloatOpt, None, ['--foo', '2.0'], 2.0)
|
||||
|
||||
def test_list_default(self):
|
||||
self._do_cli_test(ListOpt, ['bar'], [], ['bar'])
|
||||
|
||||
def test_list_arg(self):
|
||||
self._do_cli_test(ListOpt, None,
|
||||
['--foo', 'blaa,bar'], ['blaa', 'bar'])
|
||||
|
||||
def test_multistr_default(self):
|
||||
self._do_cli_test(MultiStrOpt, ['bar'], [], ['bar'])
|
||||
|
||||
def test_multistr_arg(self):
|
||||
self._do_cli_test(MultiStrOpt, None,
|
||||
['--foo', 'blaa', '--foo', 'bar'], ['blaa', 'bar'])
|
||||
|
||||
def test_help(self):
|
||||
self.stubs.Set(sys, 'stdout', StringIO.StringIO())
|
||||
self.assertRaises(SystemExit, self.conf, ['--help'])
|
||||
self.assertTrue('FOO BAR' in sys.stdout.getvalue())
|
||||
self.assertTrue('--version' in sys.stdout.getvalue())
|
||||
self.assertTrue('--help' in sys.stdout.getvalue())
|
||||
self.assertTrue('--config-file=PATH' in sys.stdout.getvalue())
|
||||
|
||||
def test_version(self):
|
||||
self.stubs.Set(sys, 'stdout', StringIO.StringIO())
|
||||
self.assertRaises(SystemExit, self.conf, ['--version'])
|
||||
self.assertTrue('1.0' in sys.stdout.getvalue())
|
||||
|
||||
def test_config_file(self):
|
||||
paths = self.create_tempfiles([('1.conf', '[DEFAULT]'),
|
||||
('2.conf', '[DEFAULT]')])
|
||||
|
||||
self.conf(['--config-file', paths[0], '--config-file', paths[1]])
|
||||
|
||||
self.assertEquals(self.conf.config_file, paths)
|
||||
|
||||
|
||||
class ConfigFileOptsTestCase(BaseTestCase):
|
||||
|
||||
def test_conf_file_str_default(self):
|
||||
self.conf.register_opt(StrOpt('foo', default='bar'))
|
||||
|
||||
paths = self.create_tempfiles([('test.conf',
|
||||
'[DEFAULT]\n')])
|
||||
|
||||
self.conf(['--config-file', paths[0]])
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'foo'))
|
||||
self.assertEquals(self.conf.foo, 'bar')
|
||||
|
||||
def test_conf_file_str_value(self):
|
||||
self.conf.register_opt(StrOpt('foo'))
|
||||
|
||||
paths = self.create_tempfiles([('test.conf',
|
||||
'[DEFAULT]\n'
|
||||
'foo = bar\n')])
|
||||
|
||||
self.conf(['--config-file', paths[0]])
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'foo'))
|
||||
self.assertEquals(self.conf.foo, 'bar')
|
||||
|
||||
def test_conf_file_str_value_override(self):
|
||||
self.conf.register_cli_opt(StrOpt('foo'))
|
||||
|
||||
paths = self.create_tempfiles([('1.conf',
|
||||
'[DEFAULT]\n'
|
||||
'foo = baar\n'),
|
||||
('2.conf',
|
||||
'[DEFAULT]\n'
|
||||
'foo = baaar\n')])
|
||||
|
||||
self.conf(['--foo', 'bar',
|
||||
'--config-file', paths[0],
|
||||
'--config-file', paths[1]])
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'foo'))
|
||||
self.assertEquals(self.conf.foo, 'baaar')
|
||||
|
||||
def test_conf_file_int_default(self):
|
||||
self.conf.register_opt(IntOpt('foo', default=666))
|
||||
|
||||
paths = self.create_tempfiles([('test.conf',
|
||||
'[DEFAULT]\n')])
|
||||
|
||||
self.conf(['--config-file', paths[0]])
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'foo'))
|
||||
self.assertEquals(self.conf.foo, 666)
|
||||
|
||||
def test_conf_file_int_value(self):
|
||||
self.conf.register_opt(IntOpt('foo'))
|
||||
|
||||
paths = self.create_tempfiles([('test.conf',
|
||||
'[DEFAULT]\n'
|
||||
'foo = 666\n')])
|
||||
|
||||
self.conf(['--config-file', paths[0]])
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'foo'))
|
||||
self.assertEquals(self.conf.foo, 666)
|
||||
|
||||
def test_conf_file_int_value_override(self):
|
||||
self.conf.register_cli_opt(IntOpt('foo'))
|
||||
|
||||
paths = self.create_tempfiles([('1.conf',
|
||||
'[DEFAULT]\n'
|
||||
'foo = 66\n'),
|
||||
('2.conf',
|
||||
'[DEFAULT]\n'
|
||||
'foo = 666\n')])
|
||||
|
||||
self.conf(['--foo', '6',
|
||||
'--config-file', paths[0],
|
||||
'--config-file', paths[1]])
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'foo'))
|
||||
self.assertEquals(self.conf.foo, 666)
|
||||
|
||||
def test_conf_file_float_default(self):
|
||||
self.conf.register_opt(FloatOpt('foo', default=6.66))
|
||||
|
||||
paths = self.create_tempfiles([('test.conf',
|
||||
'[DEFAULT]\n')])
|
||||
|
||||
self.conf(['--config-file', paths[0]])
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'foo'))
|
||||
self.assertEquals(self.conf.foo, 6.66)
|
||||
|
||||
def test_conf_file_float_value(self):
|
||||
self.conf.register_opt(FloatOpt('foo'))
|
||||
|
||||
paths = self.create_tempfiles([('test.conf',
|
||||
'[DEFAULT]\n'
|
||||
'foo = 6.66\n')])
|
||||
|
||||
self.conf(['--config-file', paths[0]])
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'foo'))
|
||||
self.assertEquals(self.conf.foo, 6.66)
|
||||
|
||||
def test_conf_file_float_value_override(self):
|
||||
self.conf.register_cli_opt(FloatOpt('foo'))
|
||||
|
||||
paths = self.create_tempfiles([('1.conf',
|
||||
'[DEFAULT]\n'
|
||||
'foo = 6.6\n'),
|
||||
('2.conf',
|
||||
'[DEFAULT]\n'
|
||||
'foo = 6.66\n')])
|
||||
|
||||
self.conf(['--foo', '6',
|
||||
'--config-file', paths[0],
|
||||
'--config-file', paths[1]])
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'foo'))
|
||||
self.assertEquals(self.conf.foo, 6.66)
|
||||
|
||||
def test_conf_file_list_default(self):
|
||||
self.conf.register_opt(ListOpt('foo', default=['bar']))
|
||||
|
||||
paths = self.create_tempfiles([('test.conf',
|
||||
'[DEFAULT]\n')])
|
||||
|
||||
self.conf(['--config-file', paths[0]])
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'foo'))
|
||||
self.assertEquals(self.conf.foo, ['bar'])
|
||||
|
||||
def test_conf_file_list_value(self):
|
||||
self.conf.register_opt(ListOpt('foo'))
|
||||
|
||||
paths = self.create_tempfiles([('test.conf',
|
||||
'[DEFAULT]\n'
|
||||
'foo = bar\n')])
|
||||
|
||||
self.conf(['--config-file', paths[0]])
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'foo'))
|
||||
self.assertEquals(self.conf.foo, ['bar'])
|
||||
|
||||
def test_conf_file_list_value_override(self):
|
||||
self.conf.register_cli_opt(ListOpt('foo'))
|
||||
|
||||
paths = self.create_tempfiles([('1.conf',
|
||||
'[DEFAULT]\n'
|
||||
'foo = bar,bar\n'),
|
||||
('2.conf',
|
||||
'[DEFAULT]\n'
|
||||
'foo = b,a,r\n')])
|
||||
|
||||
self.conf(['--foo', 'bar',
|
||||
'--config-file', paths[0],
|
||||
'--config-file', paths[1]])
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'foo'))
|
||||
self.assertEquals(self.conf.foo, ['b', 'a', 'r'])
|
||||
|
||||
def test_conf_file_multistr_default(self):
|
||||
self.conf.register_opt(MultiStrOpt('foo', default=['bar']))
|
||||
|
||||
paths = self.create_tempfiles([('test.conf',
|
||||
'[DEFAULT]\n')])
|
||||
|
||||
self.conf(['--config-file', paths[0]])
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'foo'))
|
||||
self.assertEquals(self.conf.foo, ['bar'])
|
||||
|
||||
def test_conf_file_multistr_value(self):
|
||||
self.conf.register_opt(MultiStrOpt('foo'))
|
||||
|
||||
paths = self.create_tempfiles([('test.conf',
|
||||
'[DEFAULT]\n'
|
||||
'foo = bar\n')])
|
||||
|
||||
self.conf(['--config-file', paths[0]])
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'foo'))
|
||||
self.assertEquals(self.conf.foo, ['bar'])
|
||||
|
||||
def test_conf_file_multistr_values_append(self):
|
||||
self.conf.register_cli_opt(ListOpt('foo'))
|
||||
|
||||
paths = self.create_tempfiles([('1.conf',
|
||||
'[DEFAULT]\n'
|
||||
'foo = bar\n'),
|
||||
('2.conf',
|
||||
'[DEFAULT]\n'
|
||||
'foo = bar\n')])
|
||||
|
||||
self.conf(['--foo', 'bar',
|
||||
'--config-file', paths[0],
|
||||
'--config-file', paths[1]])
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'foo'))
|
||||
|
||||
# FIXME(markmc): values spread across the CLI and multiple
|
||||
# config files should be appended
|
||||
# self.assertEquals(self.conf.foo, ['bar', 'bar', 'bar'])
|
||||
|
||||
|
||||
class OptGroupsTestCase(BaseTestCase):
|
||||
|
||||
def test_arg_group(self):
|
||||
blaa_group = OptGroup('blaa')
|
||||
self.conf.register_group(blaa_group)
|
||||
self.conf.register_cli_opt(StrOpt('foo'), group=blaa_group)
|
||||
|
||||
self.conf(['--blaa-foo', 'bar'])
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'blaa'))
|
||||
self.assertTrue(hasattr(self.conf.blaa, 'foo'))
|
||||
self.assertEquals(self.conf.blaa.foo, 'bar')
|
||||
|
||||
def test_arg_group_by_name(self):
|
||||
self.conf.register_group(OptGroup('blaa'))
|
||||
self.conf.register_cli_opt(StrOpt('foo'), group='blaa')
|
||||
|
||||
self.conf(['--blaa-foo', 'bar'])
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'blaa'))
|
||||
self.assertTrue(hasattr(self.conf.blaa, 'foo'))
|
||||
self.assertEquals(self.conf.blaa.foo, 'bar')
|
||||
|
||||
def test_arg_group_with_default(self):
|
||||
self.conf.register_group(OptGroup('blaa'))
|
||||
self.conf.register_cli_opt(StrOpt('foo', default='bar'), group='blaa')
|
||||
|
||||
self.conf([])
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'blaa'))
|
||||
self.assertTrue(hasattr(self.conf.blaa, 'foo'))
|
||||
self.assertEquals(self.conf.blaa.foo, 'bar')
|
||||
|
||||
def test_arg_group_in_config_file(self):
|
||||
self.conf.register_group(OptGroup('blaa'))
|
||||
self.conf.register_opt(StrOpt('foo'), group='blaa')
|
||||
|
||||
paths = self.create_tempfiles([('test.conf',
|
||||
'[blaa]\n'
|
||||
'foo = bar\n')])
|
||||
|
||||
self.conf(['--config-file', paths[0]])
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'blaa'))
|
||||
self.assertTrue(hasattr(self.conf.blaa, 'foo'))
|
||||
self.assertEquals(self.conf.blaa.foo, 'bar')
|
||||
|
||||
|
||||
class TemplateSubstitutionTestCase(BaseTestCase):
|
||||
|
||||
def _prep_test_str_sub(self, foo_default=None, bar_default=None):
|
||||
self.conf.register_cli_opt(StrOpt('foo', default=foo_default))
|
||||
self.conf.register_cli_opt(StrOpt('bar', default=bar_default))
|
||||
|
||||
def _assert_str_sub(self):
|
||||
self.assertTrue(hasattr(self.conf, 'bar'))
|
||||
self.assertEquals(self.conf.bar, 'blaa')
|
||||
|
||||
def test_str_sub_default_from_default(self):
|
||||
self._prep_test_str_sub(foo_default='blaa', bar_default='$foo')
|
||||
|
||||
self.conf([])
|
||||
|
||||
self._assert_str_sub()
|
||||
|
||||
def test_str_sub_default_from_arg(self):
|
||||
self._prep_test_str_sub(bar_default='$foo')
|
||||
|
||||
self.conf(['--foo', 'blaa'])
|
||||
|
||||
self._assert_str_sub()
|
||||
|
||||
def test_str_sub_default_from_config_file(self):
|
||||
self._prep_test_str_sub(bar_default='$foo')
|
||||
|
||||
paths = self.create_tempfiles([('test.conf',
|
||||
'[DEFAULT]\n'
|
||||
'foo = blaa\n')])
|
||||
|
||||
self.conf(['--config-file', paths[0]])
|
||||
|
||||
self._assert_str_sub()
|
||||
|
||||
def test_str_sub_arg_from_default(self):
|
||||
self._prep_test_str_sub(foo_default='blaa')
|
||||
|
||||
self.conf(['--bar', '$foo'])
|
||||
|
||||
self._assert_str_sub()
|
||||
|
||||
def test_str_sub_arg_from_arg(self):
|
||||
self._prep_test_str_sub()
|
||||
|
||||
self.conf(['--foo', 'blaa', '--bar', '$foo'])
|
||||
|
||||
self._assert_str_sub()
|
||||
|
||||
def test_str_sub_arg_from_config_file(self):
|
||||
self._prep_test_str_sub()
|
||||
|
||||
paths = self.create_tempfiles([('test.conf',
|
||||
'[DEFAULT]\n'
|
||||
'foo = blaa\n')])
|
||||
|
||||
self.conf(['--config-file', paths[0], '--bar=$foo'])
|
||||
|
||||
self._assert_str_sub()
|
||||
|
||||
def test_str_sub_config_file_from_default(self):
|
||||
self._prep_test_str_sub(foo_default='blaa')
|
||||
|
||||
paths = self.create_tempfiles([('test.conf',
|
||||
'[DEFAULT]\n'
|
||||
'bar = $foo\n')])
|
||||
|
||||
self.conf(['--config-file', paths[0]])
|
||||
|
||||
self._assert_str_sub()
|
||||
|
||||
def test_str_sub_config_file_from_arg(self):
|
||||
self._prep_test_str_sub()
|
||||
|
||||
paths = self.create_tempfiles([('test.conf',
|
||||
'[DEFAULT]\n'
|
||||
'bar = $foo\n')])
|
||||
|
||||
self.conf(['--config-file', paths[0], '--foo=blaa'])
|
||||
|
||||
self._assert_str_sub()
|
||||
|
||||
def test_str_sub_config_file_from_config_file(self):
|
||||
self._prep_test_str_sub()
|
||||
|
||||
paths = self.create_tempfiles([('test.conf',
|
||||
'[DEFAULT]\n'
|
||||
'bar = $foo\n'
|
||||
'foo = blaa\n')])
|
||||
|
||||
self.conf(['--config-file', paths[0]])
|
||||
|
||||
self._assert_str_sub()
|
||||
|
||||
def test_str_sub_group_from_default(self):
|
||||
self.conf.register_cli_opt(StrOpt('foo', default='blaa'))
|
||||
self.conf.register_group(OptGroup('ba'))
|
||||
self.conf.register_cli_opt(StrOpt('r', default='$foo'), group='ba')
|
||||
|
||||
self.conf([])
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'ba'))
|
||||
self.assertTrue(hasattr(self.conf.ba, 'r'))
|
||||
self.assertEquals(self.conf.ba.r, 'blaa')
|
||||
|
||||
|
||||
class ReparseTestCase(BaseTestCase):
|
||||
|
||||
def test_reparse(self):
|
||||
self.conf.register_group(OptGroup('blaa'))
|
||||
self.conf.register_cli_opt(StrOpt('foo', default='r'), group='blaa')
|
||||
|
||||
paths = self.create_tempfiles([('test.conf',
|
||||
'[blaa]\n'
|
||||
'foo = b\n')])
|
||||
|
||||
self.conf(['--config-file', paths[0]])
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'blaa'))
|
||||
self.assertTrue(hasattr(self.conf.blaa, 'foo'))
|
||||
self.assertEquals(self.conf.blaa.foo, 'b')
|
||||
|
||||
self.conf(['--blaa-foo', 'a'])
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'blaa'))
|
||||
self.assertTrue(hasattr(self.conf.blaa, 'foo'))
|
||||
self.assertEquals(self.conf.blaa.foo, 'a')
|
||||
|
||||
self.conf([])
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'blaa'))
|
||||
self.assertTrue(hasattr(self.conf.blaa, 'foo'))
|
||||
self.assertEquals(self.conf.blaa.foo, 'r')
|
||||
|
||||
|
||||
class OverridesTestCase(BaseTestCase):
|
||||
|
||||
def test_no_default_override(self):
|
||||
self.conf.register_opt(StrOpt('foo'))
|
||||
self.conf([])
|
||||
self.assertEquals(self.conf.foo, None)
|
||||
self.conf.set_default('foo', 'bar')
|
||||
self.assertEquals(self.conf.foo, 'bar')
|
||||
|
||||
def test_default_override(self):
|
||||
self.conf.register_opt(StrOpt('foo', default='foo'))
|
||||
self.conf([])
|
||||
self.assertEquals(self.conf.foo, 'foo')
|
||||
self.conf.set_default('foo', 'bar')
|
||||
self.assertEquals(self.conf.foo, 'bar')
|
||||
self.conf.set_default('foo', None)
|
||||
self.assertEquals(self.conf.foo, 'foo')
|
||||
|
||||
def test_override(self):
|
||||
self.conf.register_opt(StrOpt('foo'))
|
||||
self.conf.set_override('foo', 'bar')
|
||||
self.conf([])
|
||||
self.assertEquals(self.conf.foo, 'bar')
|
||||
|
||||
def test_group_no_default_override(self):
|
||||
self.conf.register_group(OptGroup('blaa'))
|
||||
self.conf.register_opt(StrOpt('foo'), group='blaa')
|
||||
self.conf([])
|
||||
self.assertEquals(self.conf.blaa.foo, None)
|
||||
self.conf.set_default('foo', 'bar', group='blaa')
|
||||
self.assertEquals(self.conf.blaa.foo, 'bar')
|
||||
|
||||
def test_group_default_override(self):
|
||||
self.conf.register_group(OptGroup('blaa'))
|
||||
self.conf.register_opt(StrOpt('foo', default='foo'), group='blaa')
|
||||
self.conf([])
|
||||
self.assertEquals(self.conf.blaa.foo, 'foo')
|
||||
self.conf.set_default('foo', 'bar', group='blaa')
|
||||
self.assertEquals(self.conf.blaa.foo, 'bar')
|
||||
self.conf.set_default('foo', None, group='blaa')
|
||||
self.assertEquals(self.conf.blaa.foo, 'foo')
|
||||
|
||||
def test_group_override(self):
|
||||
self.conf.register_group(OptGroup('blaa'))
|
||||
self.conf.register_opt(StrOpt('foo'), group='blaa')
|
||||
self.conf.set_override('foo', 'bar', group='blaa')
|
||||
self.conf([])
|
||||
self.assertEquals(self.conf.blaa.foo, 'bar')
|
||||
|
||||
|
||||
class SadPathTestCase(BaseTestCase):
|
||||
|
||||
def test_unknown_attr(self):
|
||||
self.conf([])
|
||||
self.assertFalse(hasattr(self.conf, 'foo'))
|
||||
self.assertRaises(NoSuchOptError, getattr, self.conf, 'foo')
|
||||
|
||||
def test_unknown_attr_is_attr_error(self):
|
||||
self.conf([])
|
||||
self.assertFalse(hasattr(self.conf, 'foo'))
|
||||
self.assertRaises(AttributeError, getattr, self.conf, 'foo')
|
||||
|
||||
def test_unknown_group_attr(self):
|
||||
self.conf.register_group(OptGroup('blaa'))
|
||||
|
||||
self.conf([])
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'blaa'))
|
||||
self.assertFalse(hasattr(self.conf.blaa, 'foo'))
|
||||
self.assertRaises(NoSuchOptError, getattr, self.conf.blaa, 'foo')
|
||||
|
||||
def test_ok_duplicate(self):
|
||||
opt = StrOpt('foo')
|
||||
self.conf.register_cli_opt(opt)
|
||||
self.conf.register_cli_opt(opt)
|
||||
|
||||
self.conf([])
|
||||
|
||||
self.assertTrue(hasattr(self.conf, 'foo'))
|
||||
self.assertEquals(self.conf.foo, None)
|
||||
|
||||
def test_error_duplicate(self):
|
||||
self.conf.register_cli_opt(StrOpt('foo'))
|
||||
self.assertRaises(DuplicateOptError,
|
||||
self.conf.register_cli_opt, StrOpt('foo'))
|
||||
|
||||
def test_error_duplicate_with_different_dest(self):
|
||||
self.conf.register_cli_opt(StrOpt('foo', dest='f'))
|
||||
self.assertRaises(DuplicateOptError,
|
||||
self.conf.register_cli_opt, StrOpt('foo'))
|
||||
|
||||
def test_error_duplicate_short(self):
|
||||
self.conf.register_cli_opt(StrOpt('foo', short='f'))
|
||||
self.assertRaises(DuplicateOptError,
|
||||
self.conf.register_cli_opt, StrOpt('bar', short='f'))
|
||||
|
||||
def test_no_such_group(self):
|
||||
self.assertRaises(NoSuchGroupError, self.conf.register_cli_opt,
|
||||
StrOpt('foo'), group='blaa')
|
||||
|
||||
def test_already_parsed(self):
|
||||
self.conf([])
|
||||
|
||||
self.assertRaises(ArgsAlreadyParsedError,
|
||||
self.conf.register_cli_opt, StrOpt('foo'))
|
||||
|
||||
def test_bad_cli_arg(self):
|
||||
self.stubs.Set(sys, 'stderr', StringIO.StringIO())
|
||||
|
||||
self.assertRaises(SystemExit, self.conf, ['--foo'])
|
||||
|
||||
self.assertTrue('error' in sys.stderr.getvalue())
|
||||
self.assertTrue('--foo' in sys.stderr.getvalue())
|
||||
|
||||
def _do_test_bad_cli_value(self, opt_class):
|
||||
self.conf.register_cli_opt(opt_class('foo'))
|
||||
|
||||
self.stubs.Set(sys, 'stderr', StringIO.StringIO())
|
||||
|
||||
self.assertRaises(SystemExit, self.conf, ['--foo', 'bar'])
|
||||
|
||||
self.assertTrue('foo' in sys.stderr.getvalue())
|
||||
self.assertTrue('bar' in sys.stderr.getvalue())
|
||||
|
||||
def test_bad_int_arg(self):
|
||||
self._do_test_bad_cli_value(IntOpt)
|
||||
|
||||
def test_bad_float_arg(self):
|
||||
self._do_test_bad_cli_value(FloatOpt)
|
||||
|
||||
def test_conf_file_not_found(self):
|
||||
paths = self.create_tempfiles([('test.conf', '')])
|
||||
os.remove(paths[0])
|
||||
self.tempfiles.remove(paths[0])
|
||||
|
||||
self.assertRaises(ConfigFilesNotFoundError,
|
||||
self.conf, ['--config-file', paths[0]])
|
||||
|
||||
def test_conf_file_broken(self):
|
||||
paths = self.create_tempfiles([('test.conf', 'foo')])
|
||||
|
||||
self.assertRaises(ConfigFileParseError,
|
||||
self.conf, ['--config-file', paths[0]])
|
||||
|
||||
def _do_test_conf_file_bad_value(self, opt_class):
|
||||
self.conf.register_opt(opt_class('foo'))
|
||||
|
||||
def test_conf_file_bad_bool(self):
|
||||
self._do_test_conf_file_bad_value(BoolOpt)
|
||||
|
||||
def test_conf_file_bad_int(self):
|
||||
self._do_test_conf_file_bad_value(IntOpt)
|
||||
|
||||
def test_conf_file_bad_float(self):
|
||||
self._do_test_conf_file_bad_value(FloatOpt)
|
||||
|
||||
def test_str_sub_from_group(self):
|
||||
self.conf.register_group(OptGroup('f'))
|
||||
self.conf.register_cli_opt(StrOpt('oo', default='blaa'), group='f')
|
||||
self.conf.register_cli_opt(StrOpt('bar', default='$f.oo'))
|
||||
|
||||
self.conf([])
|
||||
|
||||
self.assertFalse(hasattr(self.conf, 'bar'))
|
||||
self.assertRaises(TemplateSubstitutionError, getattr, self.conf, 'bar')
|
||||
|
||||
def test_set_default_unknown_attr(self):
|
||||
self.conf([])
|
||||
self.assertRaises(NoSuchOptError, self.conf.set_default, 'foo', 'bar')
|
||||
|
||||
def test_set_default_unknown_group(self):
|
||||
self.conf([])
|
||||
self.assertRaises(NoSuchGroupError,
|
||||
self.conf.set_default, 'foo', 'bar', group='blaa')
|
||||
|
||||
def test_set_override_unknown_attr(self):
|
||||
self.conf([])
|
||||
self.assertRaises(NoSuchOptError, self.conf.set_override, 'foo', 'bar')
|
||||
|
||||
def test_set_override_unknown_group(self):
|
||||
self.conf([])
|
||||
self.assertRaises(NoSuchGroupError,
|
||||
self.conf.set_override, 'foo', 'bar', group='blaa')
|
||||
|
||||
|
||||
class OptDumpingTestCase(BaseTestCase):
|
||||
|
||||
class FakeLogger:
|
||||
|
||||
def __init__(self, test_case, expected_lvl):
|
||||
self.test_case = test_case
|
||||
self.expected_lvl = expected_lvl
|
||||
self.logged = []
|
||||
|
||||
def log(self, lvl, fmt, *args):
|
||||
self.test_case.assertEquals(lvl, self.expected_lvl)
|
||||
self.logged.append(fmt % args)
|
||||
|
||||
def test_log_opt_values(self):
|
||||
self.conf.register_cli_opt(StrOpt('foo'))
|
||||
self.conf.register_group(OptGroup('blaa'))
|
||||
self.conf.register_cli_opt(StrOpt('bar'), 'blaa')
|
||||
|
||||
self.conf(['--foo', 'this', '--blaa-bar', 'that'])
|
||||
|
||||
logger = self.FakeLogger(self, 666)
|
||||
|
||||
self.conf.log_opt_values(logger, 666)
|
||||
|
||||
self.assertEquals(logger.logged, [
|
||||
"*" * 80,
|
||||
"Configuration options gathered from:",
|
||||
"command line args: ['--foo', 'this', '--blaa-bar', 'that']",
|
||||
"config files: []",
|
||||
"=" * 80,
|
||||
"config_file = []",
|
||||
"foo = this",
|
||||
"blaa.bar = that",
|
||||
"*" * 80,
|
||||
])
|
||||
|
||||
|
||||
class CommonOptsTestCase(BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(CommonOptsTestCase, self).setUp()
|
||||
self.conf = CommonConfigOpts()
|
||||
|
||||
def test_debug_verbose(self):
|
||||
self.conf(['--debug', '--verbose'])
|
||||
|
||||
self.assertEquals(self.conf.debug, True)
|
||||
self.assertEquals(self.conf.verbose, True)
|
||||
|
||||
def test_logging_opts(self):
|
||||
self.conf([])
|
||||
|
||||
self.assertTrue(self.conf.log_config is None)
|
||||
self.assertTrue(self.conf.log_file is None)
|
||||
self.assertTrue(self.conf.log_dir is None)
|
||||
|
||||
self.assertEquals(self.conf.log_format,
|
||||
CommonConfigOpts.DEFAULT_LOG_FORMAT)
|
||||
self.assertEquals(self.conf.log_date_format,
|
||||
CommonConfigOpts.DEFAULT_LOG_DATE_FORMAT)
|
||||
|
||||
self.assertEquals(self.conf.use_syslog, False)
|
@ -21,8 +21,8 @@ import exceptions
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import flags
|
||||
from nova.openstack.common import cfg
|
||||
from nova import test
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
|
@ -46,10 +46,10 @@ from eventlet import semaphore
|
||||
from eventlet.green import subprocess
|
||||
import netaddr
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova import log as logging
|
||||
from nova.openstack.common import cfg
|
||||
|
||||
|
||||
LOG = logging.getLogger("nova.utils")
|
||||
|
@ -25,11 +25,11 @@ For assistance and guidelines pls contact
|
||||
|
||||
import sys
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import compute
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova import log as logging
|
||||
from nova.openstack.common import cfg
|
||||
from nova import rpc
|
||||
from nova import volume
|
||||
from nova.compute import instance_types
|
||||
|
@ -22,12 +22,12 @@ Handles all processes relating to Virtual Storage Arrays (VSA).
|
||||
|
||||
"""
|
||||
|
||||
from nova.common import cfg
|
||||
from nova import compute
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova import log as logging
|
||||
from nova import manager
|
||||
from nova.openstack.common import cfg
|
||||
from nova import volume
|
||||
from nova import vsa
|
||||
from nova import utils
|
||||
|
Loading…
Reference in New Issue
Block a user