Remove nova.config.CONF

Modules import nova.config for two reasons right now - firstly, to
reference nova.config.CONF and, secondly, if they use one of the
options defined in nova.config.

Often modules import nova.openstack.common.cfg and nova.config
which is a bit pointless since they could just use cfg.CONF if
they just want to nova.config in order to reference CONF.

Let's just use cfg.CONF everywhere and we can explicitly state
where we actually require options defined in nova.config.

Change-Id: Ie4184a74e3e78c99658becb18dce1c2087e450bb
This commit is contained in:
Mark McLoughlin
2012-11-17 22:50:17 +00:00
parent 5f28bdf1b2
commit 059b0302f9
64 changed files with 90 additions and 91 deletions

View File

@@ -42,13 +42,14 @@ if os.path.exists(os.path.join(possible_topdir, "nova", "__init__.py")):
from nova import config from nova import config
from nova.objectstore import s3server from nova.objectstore import s3server
from nova.openstack.common import cfg
from nova.openstack.common import log as logging from nova.openstack.common import log as logging
from nova import service from nova import service
from nova import utils from nova import utils
from nova.vnc import xvp_proxy from nova.vnc import xvp_proxy
CONF = config.CONF CONF = cfg.CONF
LOG = logging.getLogger('nova.all') LOG = logging.getLogger('nova.all')
if __name__ == '__main__': if __name__ == '__main__':

View File

@@ -37,11 +37,12 @@ if os.path.exists(os.path.join(possible_topdir, "nova", "__init__.py")):
from nova import config from nova import config
from nova.openstack.common import cfg
from nova.openstack.common import log as logging from nova.openstack.common import log as logging
from nova import service from nova import service
from nova import utils from nova import utils
CONF = config.CONF CONF = cfg.CONF
if __name__ == '__main__': if __name__ == '__main__':
config.parse_args(sys.argv) config.parse_args(sys.argv)

View File

@@ -33,11 +33,12 @@ if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'nova', '__init__.py')):
from nova import config from nova import config
from nova.openstack.common import cfg
from nova.openstack.common import log as logging from nova.openstack.common import log as logging
from nova import service from nova import service
from nova import utils from nova import utils
CONF = config.CONF CONF = cfg.CONF
if __name__ == '__main__': if __name__ == '__main__':
config.parse_args(sys.argv) config.parse_args(sys.argv)

View File

@@ -52,7 +52,7 @@ delete_exchange_opt = cfg.BoolOpt('delete_exchange',
default=False, default=False,
help='delete nova exchange too.') help='delete nova exchange too.')
CONF = config.CONF CONF = cfg.CONF
CONF.register_cli_opt(delete_exchange_opt) CONF.register_cli_opt(delete_exchange_opt)

View File

@@ -42,11 +42,12 @@ if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'nova', '__init__.py')):
from nova import config from nova import config
from nova.openstack.common import cfg
from nova.openstack.common import log as logging from nova.openstack.common import log as logging
from nova import service from nova import service
from nova import utils from nova import utils
CONF = config.CONF CONF = cfg.CONF
if __name__ == '__main__': if __name__ == '__main__':
config.parse_args(sys.argv) config.parse_args(sys.argv)

View File

@@ -33,11 +33,12 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
from nova import config from nova import config
from nova.openstack.common import cfg
from nova.openstack.common import log as logging from nova.openstack.common import log as logging
from nova import service from nova import service
from nova import utils from nova import utils
CONF = config.CONF CONF = cfg.CONF
CONF.import_opt('topic', 'nova.conductor.api', group='conductor') CONF.import_opt('topic', 'nova.conductor.api', group='conductor')
if __name__ == '__main__': if __name__ == '__main__':

View File

@@ -34,10 +34,11 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
from nova import config from nova import config
from nova.openstack.common import cfg
from nova.openstack.common import log as logging from nova.openstack.common import log as logging
from nova import service from nova import service
CONF = config.CONF CONF = cfg.CONF
if __name__ == '__main__': if __name__ == '__main__':
config.parse_args(sys.argv) config.parse_args(sys.argv)

View File

@@ -33,10 +33,11 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
from nova import config from nova import config
from nova.consoleauth import manager from nova.consoleauth import manager
from nova.openstack.common import cfg
from nova.openstack.common import log as logging from nova.openstack.common import log as logging
from nova import service from nova import service
CONF = config.CONF CONF = cfg.CONF
if __name__ == "__main__": if __name__ == "__main__":
config.parse_args(sys.argv) config.parse_args(sys.argv)

View File

@@ -40,12 +40,13 @@ from nova import context
from nova import db from nova import db
from nova.network import linux_net from nova.network import linux_net
from nova.network import rpcapi as network_rpcapi from nova.network import rpcapi as network_rpcapi
from nova.openstack.common import cfg
from nova.openstack.common import importutils from nova.openstack.common import importutils
from nova.openstack.common import log as logging from nova.openstack.common import log as logging
from nova.openstack.common import rpc from nova.openstack.common import rpc
from nova import utils from nova import utils
CONF = config.CONF CONF = cfg.CONF
LOG = logging.getLogger('nova.dhcpbridge') LOG = logging.getLogger('nova.dhcpbridge')

View File

@@ -88,7 +88,7 @@ from nova.scheduler import rpcapi as scheduler_rpcapi
from nova import utils from nova import utils
from nova import version from nova import version
CONF = config.CONF CONF = cfg.CONF
CONF.import_opt('flat_network_bridge', 'nova.network.manager') CONF.import_opt('flat_network_bridge', 'nova.network.manager')
CONF.import_opt('num_networks', 'nova.network.manager') CONF.import_opt('num_networks', 'nova.network.manager')
CONF.import_opt('multi_host', 'nova.network.manager') CONF.import_opt('multi_host', 'nova.network.manager')

View File

@@ -35,11 +35,12 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
from nova import config from nova import config
from nova.openstack.common import cfg
from nova.openstack.common import log as logging from nova.openstack.common import log as logging
from nova import service from nova import service
from nova import utils from nova import utils
CONF = config.CONF CONF = cfg.CONF
if __name__ == '__main__': if __name__ == '__main__':
config.parse_args(sys.argv) config.parse_args(sys.argv)

View File

@@ -67,7 +67,7 @@ opts = [
help='Port on which to listen for incoming requests'), help='Port on which to listen for incoming requests'),
] ]
CONF = config.CONF CONF = cfg.CONF
CONF.register_cli_opts(opts) CONF.register_cli_opts(opts)
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@@ -34,12 +34,13 @@ if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'nova', '__init__.py')):
from nova import config from nova import config
from nova import exception from nova import exception
from nova.openstack.common import cfg
from nova.openstack.common import log as logging from nova.openstack.common import log as logging
from nova.openstack.common import rpc from nova.openstack.common import rpc
from nova.openstack.common.rpc import impl_zmq from nova.openstack.common.rpc import impl_zmq
from nova import utils from nova import utils
CONF = config.CONF CONF = cfg.CONF
CONF.register_opts(rpc.rpc_opts) CONF.register_opts(rpc.rpc_opts)
CONF.register_opts(impl_zmq.zmq_opts) CONF.register_opts(impl_zmq.zmq_opts)

View File

@@ -37,11 +37,12 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
gettext.install('nova', unicode=1) gettext.install('nova', unicode=1)
from nova import config from nova import config
from nova.openstack.common import cfg
from nova.openstack.common import log as logging from nova.openstack.common import log as logging
from nova import service from nova import service
from nova import utils from nova import utils
CONF = config.CONF CONF = cfg.CONF
if __name__ == '__main__': if __name__ == '__main__':
config.parse_args(sys.argv) config.parse_args(sys.argv)

View File

@@ -18,8 +18,9 @@
import re import re
from nova import config from nova import config
from nova.openstack.common import cfg
CONF = config.CONF CONF = cfg.CONF
DEFAULT_ROOT_DEV_NAME = '/dev/sda1' DEFAULT_ROOT_DEV_NAME = '/dev/sda1'
_DEFAULT_MAPPINGS = {'ami': 'sda1', _DEFAULT_MAPPINGS = {'ami': 'sda1',

View File

@@ -57,13 +57,14 @@ import eventlet
from nova import config from nova import config
from nova.db import base from nova.db import base
from nova.openstack.common import cfg
from nova.openstack.common import log as logging from nova.openstack.common import log as logging
from nova.openstack.common.plugin import pluginmanager from nova.openstack.common.plugin import pluginmanager
from nova.openstack.common.rpc import dispatcher as rpc_dispatcher from nova.openstack.common.rpc import dispatcher as rpc_dispatcher
from nova.scheduler import rpcapi as scheduler_rpcapi from nova.scheduler import rpcapi as scheduler_rpcapi
from nova import version from nova import version
CONF = config.CONF CONF = cfg.CONF
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@@ -19,7 +19,6 @@
the system. the system.
""" """
from nova import config
import nova.context import nova.context
from nova import db from nova import db
from nova import exception from nova import exception
@@ -50,7 +49,7 @@ notify_api_faults = cfg.BoolOpt('notify_api_faults', default=False,
'in the API service.') 'in the API service.')
CONF = config.CONF CONF = cfg.CONF
CONF.register_opt(notify_state_opt) CONF.register_opt(notify_state_opt)
CONF.register_opt(notify_any_opt) CONF.register_opt(notify_any_opt)
CONF.register_opt(notify_api_faults) CONF.register_opt(notify_api_faults)

View File

@@ -19,7 +19,6 @@
import os.path import os.path
from nova import config
from nova import exception from nova import exception
from nova.openstack.common import cfg from nova.openstack.common import cfg
from nova.openstack.common import policy from nova.openstack.common import policy
@@ -35,7 +34,7 @@ policy_opts = [
help=_('Rule checked when requested rule is not found')), help=_('Rule checked when requested rule is not found')),
] ]
CONF = config.CONF CONF = cfg.CONF
CONF.register_opts(policy_opts) CONF.register_opts(policy_opts)
_POLICY_PATH = None _POLICY_PATH = None

View File

@@ -20,7 +20,6 @@
import datetime import datetime
from nova import config
from nova import db from nova import db
from nova import exception from nova import exception
from nova.openstack.common import cfg from nova.openstack.common import cfg
@@ -79,7 +78,7 @@ quota_opts = [
help='default driver to use for quota checks'), help='default driver to use for quota checks'),
] ]
CONF = config.CONF CONF = cfg.CONF
CONF.register_opts(quota_opts) CONF.register_opts(quota_opts)

View File

@@ -25,9 +25,10 @@ import random
from nova import config from nova import config
from nova import exception from nova import exception
from nova.openstack.common import cfg
from nova.scheduler import driver from nova.scheduler import driver
CONF = config.CONF CONF = cfg.CONF
class ChanceScheduler(driver.Scheduler): class ChanceScheduler(driver.Scheduler):

View File

@@ -52,10 +52,10 @@ scheduler_driver_opts = [
help='Maximum number of attempts to schedule an instance'), help='Maximum number of attempts to schedule an instance'),
] ]
CONF = config.CONF CONF = cfg.CONF
CONF.register_opts(scheduler_driver_opts) CONF.register_opts(scheduler_driver_opts)
CONF = config.CONF CONF = cfg.CONF
CONF.import_opt('instances_path', 'nova.compute.manager') CONF.import_opt('instances_path', 'nova.compute.manager')
CONF.import_opt('libvirt_type', 'nova.virt.libvirt.driver') CONF.import_opt('libvirt_type', 'nova.virt.libvirt.driver')

View File

@@ -19,14 +19,14 @@ You can customize this scheduler by specifying your own Host Filters and
Weighing Functions. Weighing Functions.
""" """
from nova import config
from nova import exception from nova import exception
from nova.openstack.common import cfg
from nova.openstack.common import log as logging from nova.openstack.common import log as logging
from nova.openstack.common.notifier import api as notifier from nova.openstack.common.notifier import api as notifier
from nova.scheduler import driver from nova.scheduler import driver
from nova.scheduler import scheduler_options from nova.scheduler import scheduler_options
CONF = config.CONF CONF = cfg.CONF
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@@ -13,12 +13,12 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nova import config from nova.openstack.common import cfg
from nova.openstack.common import log as logging from nova.openstack.common import log as logging
from nova.scheduler import filters from nova.scheduler import filters
from nova import utils from nova import utils
CONF = config.CONF CONF = cfg.CONF
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@@ -15,7 +15,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nova import config
from nova.openstack.common import cfg from nova.openstack.common import cfg
from nova.openstack.common import log as logging from nova.openstack.common import log as logging
from nova.scheduler import filters from nova.scheduler import filters
@@ -27,7 +26,7 @@ cpu_allocation_ratio_opt = cfg.FloatOpt('cpu_allocation_ratio',
default=16.0, default=16.0,
help='Virtual CPU to Physical CPU allocation ratio') help='Virtual CPU to Physical CPU allocation ratio')
CONF = config.CONF CONF = cfg.CONF
CONF.register_opt(cpu_allocation_ratio_opt) CONF.register_opt(cpu_allocation_ratio_opt)

View File

@@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nova import config
from nova.openstack.common import cfg from nova.openstack.common import cfg
from nova.openstack.common import log as logging from nova.openstack.common import log as logging
from nova.scheduler import filters from nova.scheduler import filters
@@ -23,7 +22,7 @@ LOG = logging.getLogger(__name__)
disk_allocation_ratio_opt = cfg.FloatOpt("disk_allocation_ratio", default=1.0, disk_allocation_ratio_opt = cfg.FloatOpt("disk_allocation_ratio", default=1.0,
help="virtual disk to physical disk allocation ratio") help="virtual disk to physical disk allocation ratio")
CONF = config.CONF CONF = cfg.CONF
CONF.register_opt(disk_allocation_ratio_opt) CONF.register_opt(disk_allocation_ratio_opt)

View File

@@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nova import config
from nova.openstack.common import cfg from nova.openstack.common import cfg
from nova.openstack.common import log as logging from nova.openstack.common import log as logging
from nova.scheduler import filters from nova.scheduler import filters
@@ -24,7 +23,7 @@ max_io_ops_per_host_opt = cfg.IntOpt("max_io_ops_per_host",
default=8, default=8,
help="Ignore hosts that have too many builds/resizes/snaps/migrations") help="Ignore hosts that have too many builds/resizes/snaps/migrations")
CONF = config.CONF CONF = cfg.CONF
CONF.register_opt(max_io_ops_per_host_opt) CONF.register_opt(max_io_ops_per_host_opt)

View File

@@ -14,9 +14,10 @@
# under the License. # under the License.
from nova import config from nova import config
from nova.openstack.common import cfg
from nova.scheduler import filters from nova.scheduler import filters
CONF = config.CONF CONF = cfg.CONF
class IsolatedHostsFilter(filters.BaseHostFilter): class IsolatedHostsFilter(filters.BaseHostFilter):

View File

@@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nova import config
from nova.openstack.common import cfg from nova.openstack.common import cfg
from nova.openstack.common import log as logging from nova.openstack.common import log as logging
from nova.scheduler import filters from nova.scheduler import filters
@@ -24,7 +23,7 @@ max_instances_per_host_opt = cfg.IntOpt("max_instances_per_host",
default=50, default=50,
help="Ignore hosts that have too many instances") help="Ignore hosts that have too many instances")
CONF = config.CONF CONF = cfg.CONF
CONF.register_opt(max_instances_per_host_opt) CONF.register_opt(max_instances_per_host_opt)

View File

@@ -14,7 +14,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nova import config
from nova.openstack.common import cfg from nova.openstack.common import cfg
from nova.openstack.common import log as logging from nova.openstack.common import log as logging
from nova.scheduler import filters from nova.scheduler import filters
@@ -25,7 +24,7 @@ ram_allocation_ratio_opt = cfg.FloatOpt("ram_allocation_ratio",
default=1.5, default=1.5,
help="virtual ram to physical ram allocation ratio") help="virtual ram to physical ram allocation ratio")
CONF = config.CONF CONF = cfg.CONF
CONF.register_opt(ram_allocation_ratio_opt) CONF.register_opt(ram_allocation_ratio_opt)

View File

@@ -48,7 +48,6 @@ import httplib
import socket import socket
import ssl import ssl
from nova import config
from nova.openstack.common import cfg from nova.openstack.common import cfg
from nova.openstack.common import jsonutils from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging from nova.openstack.common import log as logging
@@ -81,7 +80,7 @@ trusted_opts = [
help='attestation authorization blob - must change'), help='attestation authorization blob - must change'),
] ]
CONF = config.CONF CONF = cfg.CONF
trust_group = cfg.OptGroup(name='trusted_computing', title='Trust parameters') trust_group = cfg.OptGroup(name='trusted_computing', title='Trust parameters')
CONF.register_group(trust_group) CONF.register_group(trust_group)
CONF.register_opts(trusted_opts, group=trust_group) CONF.register_opts(trusted_opts, group=trust_group)

View File

@@ -21,7 +21,6 @@ import UserDict
from nova.compute import task_states from nova.compute import task_states
from nova.compute import vm_states from nova.compute import vm_states
from nova import config
from nova import db from nova import db
from nova import exception from nova import exception
from nova.openstack.common import cfg from nova.openstack.common import cfg
@@ -53,7 +52,7 @@ host_manager_opts = [
help='Which weight class names to use for weighing hosts'), help='Which weight class names to use for weighing hosts'),
] ]
CONF = config.CONF CONF = cfg.CONF
CONF.register_opts(host_manager_opts) CONF.register_opts(host_manager_opts)
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@@ -26,7 +26,6 @@ import sys
from nova.compute import rpcapi as compute_rpcapi from nova.compute import rpcapi as compute_rpcapi
from nova.compute import utils as compute_utils from nova.compute import utils as compute_utils
from nova.compute import vm_states from nova.compute import vm_states
from nova import config
import nova.context import nova.context
from nova import db from nova import db
from nova import exception from nova import exception
@@ -46,7 +45,7 @@ scheduler_driver_opt = cfg.StrOpt('scheduler_driver',
default='nova.scheduler.filter_scheduler.FilterScheduler', default='nova.scheduler.filter_scheduler.FilterScheduler',
help='Default driver to use for the scheduler') help='Default driver to use for the scheduler')
CONF = config.CONF CONF = cfg.CONF
CONF.register_opt(scheduler_driver_opt) CONF.register_opt(scheduler_driver_opt)
QUOTAS = quota.QUOTAS QUOTAS = quota.QUOTAS

View File

@@ -27,7 +27,6 @@ schedule requests to compute nodes but provide their own manager and topic.
https://bugs.launchpad.net/nova/+bug/1009681 https://bugs.launchpad.net/nova/+bug/1009681
""" """
from nova import config
from nova.openstack.common import cfg from nova.openstack.common import cfg
from nova.openstack.common import importutils from nova.openstack.common import importutils
from nova.scheduler import driver from nova.scheduler import driver
@@ -43,7 +42,7 @@ multi_scheduler_opts = [
help='Default driver to use for scheduling calls'), help='Default driver to use for scheduling calls'),
] ]
CONF = config.CONF CONF = cfg.CONF
CONF.register_opts(multi_scheduler_opts) CONF.register_opts(multi_scheduler_opts)

View File

@@ -19,10 +19,11 @@ Client side of the scheduler manager RPC API.
""" """
from nova import config from nova import config
from nova.openstack.common import cfg
from nova.openstack.common import jsonutils from nova.openstack.common import jsonutils
import nova.openstack.common.rpc.proxy import nova.openstack.common.rpc.proxy
CONF = config.CONF CONF = cfg.CONF
class SchedulerAPI(nova.openstack.common.rpc.proxy.RpcProxy): class SchedulerAPI(nova.openstack.common.rpc.proxy.RpcProxy):

View File

@@ -26,7 +26,6 @@ import datetime
import json import json
import os import os
from nova import config
from nova.openstack.common import cfg from nova.openstack.common import cfg
from nova.openstack.common import log as logging from nova.openstack.common import log as logging
from nova.openstack.common import timeutils from nova.openstack.common import timeutils
@@ -37,7 +36,7 @@ scheduler_json_config_location_opt = cfg.StrOpt(
default='', default='',
help='Absolute path to scheduler configuration JSON file.') help='Absolute path to scheduler configuration JSON file.')
CONF = config.CONF CONF = cfg.CONF
CONF.register_opt(scheduler_json_config_location_opt) CONF.register_opt(scheduler_json_config_location_opt)
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@@ -18,13 +18,13 @@ Scheduler host weights
""" """
from nova import config from nova.openstack.common import cfg
from nova.openstack.common import log as logging from nova.openstack.common import log as logging
from nova.scheduler.weights import least_cost from nova.scheduler.weights import least_cost
from nova import weights from nova import weights
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
CONF = config.CONF CONF = cfg.CONF
class WeighedHost(weights.WeighedObject): class WeighedHost(weights.WeighedObject):

View File

@@ -25,7 +25,6 @@ NOTE(comstud): This is deprecated. One should use the RAMWeigher and/or
create other weight modules. create other weight modules.
""" """
from nova import config
from nova import exception from nova import exception
from nova.openstack.common import cfg from nova.openstack.common import cfg
from nova.openstack.common import importutils from nova.openstack.common import importutils
@@ -48,7 +47,7 @@ least_cost_opts = [
'e.g. spread-first'), 'e.g. spread-first'),
] ]
CONF = config.CONF CONF = cfg.CONF
CONF.register_opts(least_cost_opts) CONF.register_opts(least_cost_opts)

View File

@@ -20,7 +20,6 @@ stacking, you can set the 'ram_weight_multiplier' option to a negative
number and the weighing has the opposite effect of the default. number and the weighing has the opposite effect of the default.
""" """
from nova import config
from nova.openstack.common import cfg from nova.openstack.common import cfg
from nova.scheduler import weights from nova.scheduler import weights
@@ -32,7 +31,7 @@ ram_weight_opts = [
'numbers mean to stack vs spread.'), 'numbers mean to stack vs spread.'),
] ]
CONF = config.CONF CONF = cfg.CONF
CONF.register_opts(ram_weight_opts) CONF.register_opts(ram_weight_opts)

View File

@@ -90,7 +90,7 @@ service_opts = [
help='Number of workers for metadata service'), help='Number of workers for metadata service'),
] ]
CONF = config.CONF CONF = cfg.CONF
CONF.register_opts(service_opts) CONF.register_opts(service_opts)

View File

@@ -49,7 +49,7 @@ test_opts = [
help='should we use everything for testing'), help='should we use everything for testing'),
] ]
CONF = config.CONF CONF = cfg.CONF
CONF.register_opts(test_opts) CONF.register_opts(test_opts)
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@@ -33,6 +33,7 @@ import shutil
from nova import config from nova import config
from nova.db.sqlalchemy.session import get_engine from nova.db.sqlalchemy.session import get_engine
from nova.openstack.common import cfg
from nova.openstack.common import log as logging from nova.openstack.common import log as logging
import eventlet import eventlet
@@ -40,7 +41,7 @@ import eventlet
eventlet.monkey_patch(os=False) eventlet.monkey_patch(os=False)
CONF = config.CONF CONF = cfg.CONF
CONF.set_override('use_stderr', False) CONF.set_override('use_stderr', False)
logging.setup('nova') logging.setup('nova')

View File

@@ -15,15 +15,15 @@
"""Bare-metal DB test base class.""" """Bare-metal DB test base class."""
from nova import config
from nova import context as nova_context from nova import context as nova_context
from nova.openstack.common import cfg
from nova import test from nova import test
from nova.virt.baremetal.db import migration as bm_migration from nova.virt.baremetal.db import migration as bm_migration
from nova.virt.baremetal.db.sqlalchemy import session as bm_session from nova.virt.baremetal.db.sqlalchemy import session as bm_session
_DB = None _DB = None
CONF = config.CONF CONF = cfg.CONF
CONF.import_opt('baremetal_sql_connection', CONF.import_opt('baremetal_sql_connection',
'nova.virt.baremetal.db.sqlalchemy.session') 'nova.virt.baremetal.db.sqlalchemy.session')

View File

@@ -16,8 +16,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nova import config
from nova.openstack.common import cfg from nova.openstack.common import cfg
CONF = config.CONF CONF = cfg.CONF
CONF.register_opt(cfg.IntOpt('answer', default=42, help='test flag')) CONF.register_opt(cfg.IntOpt('answer', default=42, help='test flag'))

View File

@@ -17,8 +17,9 @@
# under the License. # under the License.
from nova import config from nova import config
from nova.openstack.common import cfg
CONF = config.CONF CONF = cfg.CONF
CONF.import_opt('scheduler_driver', 'nova.scheduler.manager') CONF.import_opt('scheduler_driver', 'nova.scheduler.manager')
CONF.import_opt('fake_network', 'nova.network.manager') CONF.import_opt('fake_network', 'nova.network.manager')

View File

@@ -16,8 +16,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nova import config
from nova.openstack.common import cfg from nova.openstack.common import cfg
CONF = config.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 flag'))

View File

@@ -22,6 +22,7 @@ from nova import config
from nova import context from nova import context
from nova import db from nova import db
from nova import exception from nova import exception
from nova.openstack.common import cfg
from nova.openstack.common import jsonutils from nova.openstack.common import jsonutils
from nova.scheduler import filters from nova.scheduler import filters
from nova.scheduler.filters import extra_specs_ops from nova.scheduler.filters import extra_specs_ops
@@ -30,7 +31,7 @@ from nova import test
from nova.tests.scheduler import fakes from nova.tests.scheduler import fakes
from nova import utils from nova import utils
CONF = config.CONF CONF = cfg.CONF
DATA = '' DATA = ''

View File

@@ -15,7 +15,6 @@
""" """
Tests For Least Cost functions. Tests For Least Cost functions.
""" """
from nova import config
from nova import context from nova import context
from nova.openstack.common import cfg from nova.openstack.common import cfg
from nova.scheduler import weights from nova.scheduler import weights
@@ -33,7 +32,7 @@ test_least_cost_opts = [
help='How much weight to give the fake_weigher2 function'), help='How much weight to give the fake_weigher2 function'),
] ]
CONF = config.CONF CONF = cfg.CONF
CONF.import_opt('least_cost_functions', 'nova.scheduler.weights.least_cost') CONF.import_opt('least_cost_functions', 'nova.scheduler.weights.least_cost')
CONF.import_opt('compute_fill_first_cost_fn_weight', CONF.import_opt('compute_fill_first_cost_fn_weight',
'nova.scheduler.weights.least_cost') 'nova.scheduler.weights.least_cost')

View File

@@ -20,11 +20,12 @@ Unit Tests for nova.scheduler.rpcapi
from nova import config from nova import config
from nova import context from nova import context
from nova.openstack.common import cfg
from nova.openstack.common import rpc from nova.openstack.common import rpc
from nova.scheduler import rpcapi as scheduler_rpcapi from nova.scheduler import rpcapi as scheduler_rpcapi
from nova import test from nova import test
CONF = config.CONF CONF = cfg.CONF
class SchedulerRpcAPITestCase(test.TestCase): class SchedulerRpcAPITestCase(test.TestCase):

View File

@@ -26,7 +26,6 @@ from nova.compute import power_state
from nova.compute import rpcapi as compute_rpcapi from nova.compute import rpcapi as compute_rpcapi
from nova.compute import utils as compute_utils from nova.compute import utils as compute_utils
from nova.compute import vm_states from nova.compute import vm_states
from nova import config
from nova import context from nova import context
from nova import db from nova import db
from nova import exception from nova import exception

View File

@@ -36,7 +36,6 @@ from nova.api import ec2
from nova.api.ec2 import apirequest from nova.api.ec2 import apirequest
from nova.api.ec2 import ec2utils from nova.api.ec2 import ec2utils
from nova import block_device from nova import block_device
from nova import config
from nova import context from nova import context
from nova import exception from nova import exception
from nova.openstack.common import timeutils from nova.openstack.common import timeutils

View File

@@ -22,16 +22,16 @@
import datetime import datetime
import uuid as stdlib_uuid import uuid as stdlib_uuid
from nova import config
from nova import context from nova import context
from nova import db from nova import db
from nova import exception from nova import exception
from nova.openstack.common import cfg
from nova.openstack.common import timeutils from nova.openstack.common import timeutils
from nova import test from nova import test
from nova.tests import matchers from nova.tests import matchers
CONF = config.CONF CONF = cfg.CONF
CONF.import_opt('reserved_host_memory_mb', 'nova.compute.resource_tracker') CONF.import_opt('reserved_host_memory_mb', 'nova.compute.resource_tracker')
CONF.import_opt('reserved_host_disk_mb', 'nova.compute.resource_tracker') CONF.import_opt('reserved_host_disk_mb', 'nova.compute.resource_tracker')

View File

@@ -21,7 +21,7 @@ from nova import config
from nova.openstack.common import cfg from nova.openstack.common import cfg
from nova import test from nova import test
CONF = config.CONF CONF = cfg.CONF
CONF.register_opt(cfg.StrOpt('flags_unittest', CONF.register_opt(cfg.StrOpt('flags_unittest',
default='foo', default='foo',
help='for testing purposes only')) help='for testing purposes only'))

View File

@@ -26,10 +26,10 @@ import sys
import uuid import uuid
from nova.compute import power_state from nova.compute import power_state
from nova import config
from nova import context from nova import context
from nova import db from nova import db
from nova.image import glance from nova.image import glance
from nova.openstack.common import cfg
from nova.tests import fake_network from nova.tests import fake_network
from nova.tests.hyperv import basetestcase from nova.tests.hyperv import basetestcase
from nova.tests.hyperv import db_fakes from nova.tests.hyperv import db_fakes
@@ -41,7 +41,7 @@ from nova.virt.hyperv import driver as driver_hyperv
from nova.virt.hyperv import vmutils from nova.virt.hyperv import vmutils
from nova.virt import images from nova.virt import images
CONF = config.CONF CONF = cfg.CONF
class HyperVAPITestCase(basetestcase.BaseTestCase): class HyperVAPITestCase(basetestcase.BaseTestCase):

View File

@@ -17,13 +17,13 @@
import os import os
from nova import config from nova.openstack.common import cfg
from nova.openstack.common import fileutils from nova.openstack.common import fileutils
from nova import test from nova import test
from nova.tests import fake_libvirt_utils from nova.tests import fake_libvirt_utils
from nova.virt.libvirt import imagebackend from nova.virt.libvirt import imagebackend
CONF = config.CONF CONF = cfg.CONF
class _ImageTestCase(test.TestCase): class _ImageTestCase(test.TestCase):

View File

@@ -29,13 +29,14 @@ from nova.compute import manager as compute_manager
from nova.compute import vm_states from nova.compute import vm_states
from nova import config from nova import config
from nova import db from nova import db
from nova.openstack.common import cfg
from nova.openstack.common import importutils from nova.openstack.common import importutils
from nova.openstack.common import log from nova.openstack.common import log
from nova import utils from nova import utils
from nova.virt.libvirt import imagecache from nova.virt.libvirt import imagecache
from nova.virt.libvirt import utils as virtutils from nova.virt.libvirt import utils as virtutils
CONF = config.CONF CONF = cfg.CONF
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)

View File

@@ -18,7 +18,6 @@ Unit Tests for instance types code
import time import time
from nova.compute import instance_types from nova.compute import instance_types
from nova import config
from nova import context from nova import context
from nova import db from nova import db
from nova.db.sqlalchemy import models from nova.db.sqlalchemy import models

View File

@@ -37,6 +37,7 @@ from nova import config
from nova import context from nova import context
from nova import db from nova import db
from nova import exception from nova import exception
from nova.openstack.common import cfg
from nova.openstack.common import fileutils from nova.openstack.common import fileutils
from nova.openstack.common import importutils from nova.openstack.common import importutils
from nova.openstack.common import jsonutils from nova.openstack.common import jsonutils
@@ -69,7 +70,7 @@ except ImportError:
libvirt_driver.libvirt = libvirt libvirt_driver.libvirt = libvirt
CONF = config.CONF CONF = cfg.CONF
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
_fake_network_info = fake_network.fake_get_instance_nw_info _fake_network_info = fake_network.fake_get_instance_nw_info

View File

@@ -16,13 +16,13 @@
from lxml import etree from lxml import etree
from nova import config from nova.openstack.common import cfg
from nova import test from nova import test
from nova import utils from nova import utils
from nova.virt.libvirt import config as vconfig from nova.virt.libvirt import config as vconfig
from nova.virt.libvirt import vif from nova.virt.libvirt import vif
CONF = config.CONF CONF = cfg.CONF
class LibvirtVifTestCase(test.TestCase): class LibvirtVifTestCase(test.TestCase):

View File

@@ -18,7 +18,6 @@
Test suite for PowerVMDriver. Test suite for PowerVMDriver.
""" """
from nova import config
from nova import context from nova import context
from nova import db from nova import db
from nova import test from nova import test

View File

@@ -17,7 +17,6 @@
import os import os
from nova import config
from nova import exception from nova import exception
from nova import test from nova import test
from nova import tests from nova import tests

View File

@@ -20,7 +20,6 @@ Test suite for VMWareAPI.
""" """
from nova.compute import power_state from nova.compute import power_state
from nova import config
from nova import context from nova import context
from nova import db from nova import db
from nova import exception from nova import exception

View File

@@ -33,6 +33,7 @@ from nova import config
from nova import context from nova import context
from nova import db from nova import db
from nova import exception from nova import exception
from nova.openstack.common import cfg
from nova.openstack.common import importutils from nova.openstack.common import importutils
from nova.openstack.common import jsonutils from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging from nova.openstack.common import log as logging
@@ -56,7 +57,7 @@ from nova.virt.xenapi import volume_utils
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
CONF = config.CONF CONF = cfg.CONF
IMAGE_MACHINE = '1' IMAGE_MACHINE = '1'
IMAGE_KERNEL = '2' IMAGE_KERNEL = '2'

View File

@@ -56,7 +56,7 @@ from nova.openstack.common import timeutils
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
CONF = config.CONF CONF = cfg.CONF
CONF.register_opt( CONF.register_opt(
cfg.BoolOpt('disable_process_locking', default=False, cfg.BoolOpt('disable_process_locking', default=False,
help='Whether to disable inter-process locks')) help='Whether to disable inter-process locks'))

View File

@@ -44,7 +44,7 @@ wsgi_opts = [
'into it: client_ip, date_time, request_line, status_code, ' 'into it: client_ip, date_time, request_line, status_code, '
'body_length, wall_seconds.') 'body_length, wall_seconds.')
] ]
CONF = config.CONF CONF = cfg.CONF
CONF.register_opts(wsgi_opts) CONF.register_opts(wsgi_opts)
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)