Merge "config options: Centralise 'virt.driver' options"

This commit is contained in:
Jenkins 2016-02-12 08:14:22 +00:00 committed by Gerrit Code Review
commit 8a74b3c517
24 changed files with 87 additions and 97 deletions

View File

@ -16,19 +16,18 @@
"""The bare-metal admin extension."""
from oslo_config import cfg
from oslo_utils import importutils
import webob
from nova.api.openstack import common
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
import nova.conf
from nova.i18n import _
ironic_client = importutils.try_import('ironicclient.client')
ironic_exc = importutils.try_import('ironicclient.exc')
CONF = cfg.CONF
ALIAS = "os-baremetal-nodes"
authorize = extensions.os_compute_authorizer(ALIAS)
@ -39,6 +38,7 @@ node_ext_fields = ['uuid', 'task_state', 'updated_at', 'pxe_config_path']
interface_fields = ['id', 'address', 'datapath_id', 'port_no']
CONF = nova.conf.CONF
CONF.import_opt('api_version',
'nova.virt.ironic.driver',
group='ironic')
@ -54,7 +54,6 @@ CONF.import_opt('admin_password',
CONF.import_opt('admin_tenant_name',
'nova.virt.ironic.driver',
group='ironic')
CONF.import_opt('compute_driver', 'nova.virt.driver')
def _check_ironic_client_enabled():

View File

@ -15,12 +15,12 @@
"""The bare-metal admin extension with Ironic Proxy."""
from oslo_config import cfg
from oslo_utils import importutils
import webob
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
import nova.conf
from nova.i18n import _
ironic_client = importutils.try_import('ironicclient.client')
@ -35,8 +35,7 @@ node_ext_fields = ['uuid', 'task_state', 'updated_at', 'pxe_config_path']
interface_fields = ['id', 'address', 'datapath_id', 'port_no']
CONF = cfg.CONF
CONF = nova.conf.CONF
CONF.import_opt('api_version',
'nova.virt.ironic.driver',
group='ironic')
@ -52,7 +51,6 @@ CONF.import_opt('admin_password',
CONF.import_opt('admin_tenant_name',
'nova.virt.ironic.driver',
group='ironic')
CONF.import_opt('compute_driver', 'nova.virt.driver')
def _check_ironic_client_enabled():

View File

@ -15,18 +15,17 @@
import re
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import strutils
import six
import nova.conf
from nova import exception
from nova.i18n import _
from nova import utils
from nova.virt import driver
CONF = cfg.CONF
CONF.import_opt('default_ephemeral_format', 'nova.virt.driver')
CONF = nova.conf.CONF
LOG = logging.getLogger(__name__)
DEFAULT_ROOT_DEV_NAME = '/dev/sda1'

View File

@ -88,10 +88,8 @@ wrap_exception = functools.partial(exception.wrap_exception,
get_notifier=get_notifier)
CONF = nova.conf.CONF
CONF.import_opt('compute_topic', 'nova.compute.rpcapi')
CONF.import_opt('enable', 'nova.cells.opts', group='cells')
CONF.import_opt('default_ephemeral_format', 'nova.virt.driver')
MAX_USERDATA_SIZE = 65535
RO_SECURITY_GROUPS = ['default']

View File

@ -17,16 +17,15 @@
CPU monitor based on virt driver to retrieve CPU information
"""
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import timeutils
from nova.compute.monitors import base
import nova.conf
from nova import exception
from nova.i18n import _LE
CONF = cfg.CONF
CONF.import_opt('compute_driver', 'nova.virt.driver')
CONF = nova.conf.CONF
LOG = logging.getLogger(__name__)

View File

@ -37,8 +37,52 @@ Related options:
* None""")
compute_driver = cfg.StrOpt(
'compute_driver',
help='Driver to use for controlling virtualization. Options '
'include: libvirt.LibvirtDriver, xenapi.XenAPIDriver, '
'fake.FakeDriver, ironic.IronicDriver, '
'vmwareapi.VMwareVCDriver, hyperv.HyperVDriver')
ALL_OPTS = [vcpu_pin_set]
default_ephemeral_format = cfg.StrOpt(
'default_ephemeral_format',
help='The default format an ephemeral_volume will be '
'formatted with on creation.')
preallocate_images = cfg.StrOpt(
'preallocate_images',
default='none',
choices=('none', 'space'),
help='VM image preallocation mode: '
'"none" => no storage provisioning is done up front, '
'"space" => storage is fully allocated at instance start')
use_cow_images = cfg.BoolOpt(
'use_cow_images',
default=True,
help='Whether to use cow images')
vif_plugging_is_fatal = cfg.BoolOpt(
'vif_plugging_is_fatal',
default=True,
help='Fail instance boot if vif plugging fails')
vif_plugging_timeout = cfg.IntOpt(
'vif_plugging_timeout',
default=300,
help='Number of seconds to wait for neutron vif plugging '
'events to arrive before continuing or failing (see '
'vif_plugging_is_fatal). If this is set to zero and '
'vif_plugging_is_fatal is False, events should not '
'be expected to arrive at all.')
ALL_OPTS = [vcpu_pin_set,
compute_driver,
default_ephemeral_format,
preallocate_images,
use_cow_images,
vif_plugging_is_fatal,
vif_plugging_timeout]
def register_opts(conf):
@ -47,4 +91,4 @@ def register_opts(conf):
def list_opts():
# TODO(sfinucan): This should be moved to a virt or hardware group
return ('DEFAULT', ALL_OPTS)
return {'DEFAULT': ALL_OPTS}

View File

@ -29,7 +29,6 @@ from eventlet import greenthread
import mock
from mox3 import mox
from neutronclient.common import exceptions as neutron_exceptions
from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging as messaging
from oslo_serialization import jsonutils
@ -56,6 +55,7 @@ from nova.compute import task_states
from nova.compute import utils as compute_utils
from nova.compute import vm_states
from nova.conductor import manager as conductor_manager
import nova.conf
from nova.console import type as ctype
from nova import context
from nova import db
@ -98,11 +98,10 @@ from nova.volume import cinder
QUOTAS = quota.QUOTAS
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
CONF = nova.conf.CONF
CONF.import_opt('compute_manager', 'nova.service')
CONF.import_opt('host', 'nova.netconf')
CONF.import_opt('live_migration_retry_count', 'nova.compute.manager')
CONF.import_opt('default_ephemeral_format', 'nova.virt.driver')
FAKE_IMAGE_REF = uuids.image_ref

View File

@ -21,7 +21,6 @@ import string
import uuid
import mock
from oslo_config import cfg
from oslo_serialization import jsonutils
from oslo_utils import importutils
import six
@ -30,6 +29,7 @@ from nova.compute import flavors
from nova.compute import power_state
from nova.compute import task_states
from nova.compute import utils as compute_utils
import nova.conf
from nova import context
from nova import exception
from nova.image import glance
@ -50,9 +50,8 @@ from nova.tests.unit.objects import test_migration
from nova.tests import uuidsentinel as uuids
from nova.virt import driver
CONF = cfg.CONF
CONF = nova.conf.CONF
CONF.import_opt('compute_manager', 'nova.service')
CONF.import_opt('compute_driver', 'nova.virt.driver')
def create_instance(context, user_id='fake', project_id='fake', params=None):

View File

@ -12,10 +12,10 @@
"""Tests for expectations of behaviour from the Xen driver."""
from oslo_config import cfg
from oslo_utils import importutils
from nova.compute import power_state
import nova.conf
from nova import context
from nova import objects
from nova.objects import instance as instance_obj
@ -24,9 +24,8 @@ from nova.tests.unit import fake_instance
from nova.tests.unit.virt.xenapi import stubs
from nova.virt.xenapi import vm_utils
CONF = cfg.CONF
CONF = nova.conf.CONF
CONF.import_opt('compute_manager', 'nova.service')
CONF.import_opt('compute_driver', 'nova.virt.driver')
class ComputeXenTestCase(stubs.XenAPITestBaseNoDB):

View File

@ -14,18 +14,17 @@
# under the License.
"""Tests for compute service with multiple compute nodes."""
from oslo_config import cfg
from oslo_utils import importutils
import nova.conf
from nova import context
from nova import objects
from nova import test
from nova.virt import fake
CONF = cfg.CONF
CONF = nova.conf.CONF
CONF.import_opt('compute_manager', 'nova.service')
CONF.import_opt('compute_driver', 'nova.virt.driver')
class BaseTestCase(test.TestCase):

View File

@ -31,7 +31,6 @@ CONF.import_opt('network_size', 'nova.network.manager')
CONF.import_opt('num_networks', 'nova.network.manager')
CONF.import_opt('floating_ip_dns_manager', 'nova.network.floating_ips')
CONF.import_opt('instance_dns_manager', 'nova.network.floating_ips')
CONF.import_opt('compute_driver', 'nova.virt.driver')
class ConfFixture(config_fixture.Config):

View File

@ -18,13 +18,13 @@
import copy
import mock
from oslo_config import cfg
from oslo_context import context as o_context
from oslo_context import fixture as o_fixture
from nova.compute import flavors
from nova.compute import task_states
from nova.compute import vm_states
import nova.conf
from nova import context
from nova import exception
from nova import notifications
@ -34,8 +34,7 @@ from nova import test
from nova.tests.unit import fake_network
from nova.tests.unit import fake_notifier
CONF = cfg.CONF
CONF.import_opt('compute_driver', 'nova.virt.driver')
CONF = nova.conf.CONF
class NotificationsTestCase(test.TestCase):

View File

@ -16,13 +16,13 @@
import datetime
from oslo_config import cfg
from oslo_db.sqlalchemy import enginefacade
from oslo_utils import timeutils
from six.moves import range
from nova import compute
from nova.compute import flavors
import nova.conf
from nova import context
from nova import db
from nova.db.sqlalchemy import api as sqa_api
@ -32,8 +32,7 @@ from nova import quota
from nova import test
import nova.tests.unit.image.fake
CONF = cfg.CONF
CONF.import_opt('compute_driver', 'nova.virt.driver')
CONF = nova.conf.CONF
class QuotaIntegrationTestCase(test.TestCase):

View File

@ -26,7 +26,6 @@ import uuid
import mock
from mox3 import mox
from oslo_concurrency import lockutils
from oslo_config import cfg
from oslo_config import fixture as config_fixture
from oslo_log import log as logging
from oslo_serialization import jsonutils
@ -41,6 +40,7 @@ from nova.compute import power_state
from nova.compute import task_states
from nova.compute import utils as compute_utils
from nova.compute import vm_states
import nova.conf
from nova import context
from nova import crypto
from nova import db
@ -73,10 +73,9 @@ from nova.virt.xenapi import volume_utils
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
CONF = nova.conf.CONF
CONF.import_opt('compute_manager', 'nova.service')
CONF.import_opt('network_manager', 'nova.service')
CONF.import_opt('compute_driver', 'nova.virt.driver')
CONF.import_opt('host', 'nova.netconf')
CONF.import_opt('default_availability_zone', 'nova.availability_zones')
CONF.import_opt('login_timeout', 'nova.virt.xenapi.client.session',

View File

@ -35,6 +35,7 @@ from oslo_config import cfg
from oslo_log import log as logging
from oslo_serialization import jsonutils
import nova.conf
from nova import exception
from nova.i18n import _
from nova.i18n import _LE
@ -72,9 +73,8 @@ disk_opts = [
'the nbd driver (for qcow and raw), or loop (for raw).'),
]
CONF = cfg.CONF
CONF = nova.conf.CONF
CONF.register_opts(disk_opts)
CONF.import_opt('default_ephemeral_format', 'nova.virt.driver')
_MKFS_COMMAND = {}
_DEFAULT_MKFS_COMMAND = None

View File

@ -22,46 +22,15 @@ Driver base-classes:
import sys
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import importutils
import nova.conf
from nova.i18n import _, _LE, _LI
from nova import utils
from nova.virt import event as virtevent
driver_opts = [
cfg.StrOpt('compute_driver',
help='Driver to use for controlling virtualization. Options '
'include: libvirt.LibvirtDriver, xenapi.XenAPIDriver, '
'fake.FakeDriver, ironic.IronicDriver, '
'vmwareapi.VMwareVCDriver, hyperv.HyperVDriver'),
cfg.StrOpt('default_ephemeral_format',
help='The default format an ephemeral_volume will be '
'formatted with on creation.'),
cfg.StrOpt('preallocate_images',
default='none',
choices=('none', 'space'),
help='VM image preallocation mode: '
'"none" => no storage provisioning is done up front, '
'"space" => storage is fully allocated at instance start'),
cfg.BoolOpt('use_cow_images',
default=True,
help='Whether to use cow images'),
cfg.BoolOpt('vif_plugging_is_fatal',
default=True,
help="Fail instance boot if vif plugging fails"),
cfg.IntOpt('vif_plugging_timeout',
default=300,
help='Number of seconds to wait for neutron vif plugging '
'events to arrive before continuing or failing (see '
'vif_plugging_is_fatal). If this is set to zero and '
'vif_plugging_is_fatal is False, events should not '
'be expected to arrive at all.'),
]
CONF = cfg.CONF
CONF.register_opts(driver_opts)
CONF = nova.conf.CONF
LOG = logging.getLogger(__name__)

View File

@ -18,11 +18,11 @@ Image caching and management.
import os
from os_win import utilsfactory
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
from oslo_utils import units
import nova.conf
from nova import exception
from nova import utils
from nova.virt.hyperv import pathutils
@ -30,8 +30,7 @@ from nova.virt import images
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
CONF.import_opt('use_cow_images', 'nova.virt.driver')
CONF = nova.conf.CONF
class ImageCache(object):

View File

@ -19,10 +19,10 @@ Management class for live migration VM operations.
import functools
from os_win import utilsfactory
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
import nova.conf
from nova.i18n import _
from nova.objects import migrate_data as migrate_data_obj
from nova.virt.hyperv import imagecache
@ -31,8 +31,7 @@ from nova.virt.hyperv import vmops
from nova.virt.hyperv import volumeops
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
CONF.import_opt('use_cow_images', 'nova.virt.driver')
CONF = nova.conf.CONF
def check_os_version_requirement(function):

View File

@ -37,6 +37,7 @@ from oslo_utils import uuidutils
import six
from nova.api.metadata import base as instance_metadata
import nova.conf
from nova import exception
from nova.i18n import _, _LI, _LE, _LW
from nova import utils
@ -86,9 +87,8 @@ hyperv_opts = [
' if instance does not shutdown within this window.'),
]
CONF = cfg.CONF
CONF = nova.conf.CONF
CONF.register_opts(hyperv_opts, 'hyperv')
CONF.import_opt('use_cow_images', 'nova.virt.driver')
CONF.import_opt('network_api_class', 'nova.network')
SHUTDOWN_TIME_INCREMENT = 5

View File

@ -20,12 +20,12 @@
Helper classes for Ironic HTTP PATCH creation.
"""
from oslo_config import cfg
from oslo_serialization import jsonutils
import six
CONF = cfg.CONF
CONF.import_opt('default_ephemeral_format', 'nova.virt.driver')
import nova.conf
CONF = nova.conf.CONF
def create(node):

View File

@ -66,6 +66,7 @@ from nova.compute import power_state
from nova.compute import task_states
from nova.compute import utils as compute_utils
from nova.compute import vm_mode
import nova.conf
from nova.console import serial as serial_console
from nova.console import type as ctype
from nova import context as nova_context
@ -310,11 +311,10 @@ libvirt_opts = [
'kernel (usually 1-99)')
]
CONF = cfg.CONF
CONF = nova.conf.CONF
CONF.register_opts(libvirt_opts, 'libvirt')
CONF.import_opt('host', 'nova.netconf')
CONF.import_opt('my_ip', 'nova.netconf')
CONF.import_opt('use_cow_images', 'nova.virt.driver')
CONF.import_opt('enabled', 'nova.compute.api',
group='ephemeral_storage_encryption')
CONF.import_opt('cipher', 'nova.compute.api',
@ -325,8 +325,6 @@ CONF.import_opt('live_migration_retry_count', 'nova.compute.manager')
CONF.import_opt('vncserver_proxyclient_address', 'nova.vnc', group='vnc')
CONF.import_opt('server_proxyclient_address', 'nova.spice', group='spice')
CONF.import_opt('vcpu_pin_set', 'nova.conf.virt')
CONF.import_opt('vif_plugging_is_fatal', 'nova.virt.driver')
CONF.import_opt('vif_plugging_timeout', 'nova.virt.driver')
CONF.import_opt('hw_disk_discard', 'nova.virt.libvirt.imagebackend',
group='libvirt')
CONF.import_group('workarounds', 'nova.utils')

View File

@ -29,6 +29,7 @@ from oslo_utils import strutils
from oslo_utils import units
import six
import nova.conf
from nova import exception
from nova.i18n import _
from nova.i18n import _LE, _LI, _LW
@ -70,10 +71,9 @@ __imagebackend_opts = [
' format)'),
]
CONF = cfg.CONF
CONF = nova.conf.CONF
CONF.register_opts(__imagebackend_opts, 'libvirt')
CONF.import_opt('image_cache_subdirectory_name', 'nova.virt.imagecache')
CONF.import_opt('preallocate_images', 'nova.virt.driver')
CONF.import_opt('enabled', 'nova.compute.api',
group='ephemeral_storage_encryption')
CONF.import_opt('cipher', 'nova.compute.api',

View File

@ -17,7 +17,6 @@ import nova.virt.configdrive
import nova.virt.disk.api
import nova.virt.disk.mount.nbd
import nova.virt.disk.vfs.guestfs
import nova.virt.driver
import nova.virt.firewall
import nova.virt.hyperv.pathutils
import nova.virt.hyperv.vif
@ -57,14 +56,12 @@ def list_opts():
nova.virt.configdrive.configdrive_opts,
nova.virt.disk.api.disk_opts,
nova.virt.disk.mount.nbd.nbd_opts,
nova.virt.driver.driver_opts,
nova.virt.firewall.firewall_opts,
nova.virt.imagecache.imagecache_opts,
nova.virt.images.image_opts,
nova.virt.netutils.netutils_opts,
)),
('guestfs', nova.virt.disk.vfs.guestfs.guestfs_opts),
nova.conf.virt.list_opts(),
('hyperv',
itertools.chain(
nova.virt.hyperv.pathutils.hyperv_opts,

View File

@ -45,6 +45,7 @@ from nova.api.metadata import base as instance_metadata
from nova.compute import power_state
from nova.compute import task_states
from nova.compute import vm_mode
import nova.conf
from nova import exception
from nova.i18n import _, _LE, _LI, _LW
from nova.network import model as network_model
@ -118,10 +119,8 @@ xenapi_vm_utils_opts = [
'ISO image creation'),
]
CONF = cfg.CONF
CONF = nova.conf.CONF
CONF.register_opts(xenapi_vm_utils_opts, 'xenserver')
CONF.import_opt('default_ephemeral_format', 'nova.virt.driver')
CONF.import_opt('use_cow_images', 'nova.virt.driver')
CONF.import_opt('use_ipv6', 'nova.netconf')
XENAPI_POWER_STATE = {