From fadde1dc923028d3661a2ed57db2e6e9f63cd545 Mon Sep 17 00:00:00 2001 From: Pushkar Umaranikar Date: Wed, 6 Apr 2016 21:17:52 +0000 Subject: [PATCH] Centralize vif,xenpool & vol_utils config options This change moves config options of xenserver module from vif.py, pool.py and volume_utils.py to centralize location nova/conf/xenserver.py Change-Id: I07bfaac36b4a8021788617958196b676d5b2b173 Implements: blueprint centralize-config-options-newton --- nova/conf/xenserver.py | 25 ++++++++++++++++++++++++- nova/virt/opts.py | 9 --------- nova/virt/xenapi/pool.py | 8 -------- nova/virt/xenapi/vif.py | 9 ++------- nova/virt/xenapi/volume_utils.py | 11 ++--------- 5 files changed, 28 insertions(+), 34 deletions(-) diff --git a/nova/conf/xenserver.py b/nova/conf/xenserver.py index 49902d004c29..028d3019b9ba 100644 --- a/nova/conf/xenserver.py +++ b/nova/conf/xenserver.py @@ -351,12 +351,35 @@ xenapi_vmops_opts = [ help='Dom0 plugin driver used to handle image uploads.'), ] +xenapi_volume_utils_opts = [ + cfg.IntOpt('introduce_vdi_retry_wait', + default=20, + help='Number of seconds to wait for an SR to settle ' + 'if the VDI does not exist when first introduced'), + ] + +xenapi_ovs_integration_bridge_opts = [ + cfg.StrOpt('ovs_integration_bridge', + default='xapi1', + help='Name of Integration Bridge used by Open vSwitch'), + ] + +xenapi_pool_opts = [ + cfg.BoolOpt('use_join_force', + default=True, + help='To use for hosts with different CPUs'), + ] + + ALL_XENSERVER_OPTS = (xenapi_agent_opts + xenapi_session_opts + xenapi_torrent_opts + xenapi_vm_utils_opts + xenapi_opts + - xenapi_vmops_opts) + xenapi_vmops_opts + + xenapi_volume_utils_opts + + xenapi_ovs_integration_bridge_opts + + xenapi_pool_opts) def register_opts(conf): diff --git a/nova/virt/opts.py b/nova/virt/opts.py index 5b9eea6a39d8..476db81a8f55 100644 --- a/nova/virt/opts.py +++ b/nova/virt/opts.py @@ -29,10 +29,7 @@ import nova.virt.libvirt.volume.scality import nova.virt.libvirt.volume.smbfs import nova.virt.libvirt.volume.volume import nova.virt.xenapi.agent -import nova.virt.xenapi.pool -import nova.virt.xenapi.vif import nova.virt.xenapi.vmops -import nova.virt.xenapi.volume_utils def list_opts(): @@ -56,10 +53,4 @@ def list_opts(): nova.virt.libvirt.volume.scality.volume_opts, nova.virt.libvirt.volume.smbfs.volume_opts, )), - ('xenserver', - itertools.chain( - [nova.virt.xenapi.vif.xenapi_ovs_integration_bridge_opt], - nova.virt.xenapi.pool.xenapi_pool_opts, - nova.virt.xenapi.volume_utils.xenapi_volume_utils_opts, - )), ] diff --git a/nova/virt/xenapi/pool.py b/nova/virt/xenapi/pool.py index 24d024495b0e..9dd915a6d9c1 100644 --- a/nova/virt/xenapi/pool.py +++ b/nova/virt/xenapi/pool.py @@ -17,7 +17,6 @@ Management class for Pool-related functions (join, eject, etc). """ -from oslo_config import cfg from oslo_log import log as logging from oslo_serialization import jsonutils import six @@ -32,14 +31,7 @@ from nova.virt.xenapi import vm_utils LOG = logging.getLogger(__name__) -xenapi_pool_opts = [ - cfg.BoolOpt('use_join_force', - default=True, - help='To use for hosts with different CPUs'), - ] - CONF = nova.conf.CONF -CONF.register_opts(xenapi_pool_opts, 'xenserver') class ResourcePool(object): diff --git a/nova/virt/xenapi/vif.py b/nova/virt/xenapi/vif.py index 5c7a3502d02f..f6717360265a 100644 --- a/nova/virt/xenapi/vif.py +++ b/nova/virt/xenapi/vif.py @@ -17,9 +17,9 @@ """VIF drivers for XenAPI.""" -from oslo_config import cfg from oslo_log import log as logging +import nova.conf from nova import exception from nova.i18n import _ from nova.i18n import _LW @@ -27,12 +27,7 @@ from nova.virt.xenapi import network_utils from nova.virt.xenapi import vm_utils -xenapi_ovs_integration_bridge_opt = cfg.StrOpt('ovs_integration_bridge', - default='xapi1', - help='Name of Integration Bridge used by Open vSwitch') - -CONF = cfg.CONF -CONF.register_opt(xenapi_ovs_integration_bridge_opt, 'xenserver') +CONF = nova.conf.CONF LOG = logging.getLogger(__name__) diff --git a/nova/virt/xenapi/volume_utils.py b/nova/virt/xenapi/volume_utils.py index 99f084626372..655939405d71 100644 --- a/nova/virt/xenapi/volume_utils.py +++ b/nova/virt/xenapi/volume_utils.py @@ -23,24 +23,17 @@ import string import uuid from eventlet import greenthread -from oslo_config import cfg from oslo_log import log as logging from oslo_utils import strutils from oslo_utils import versionutils import six +import nova.conf from nova import exception from nova.i18n import _, _LE, _LW -xenapi_volume_utils_opts = [ - cfg.IntOpt('introduce_vdi_retry_wait', - default=20, - help='Number of seconds to wait for an SR to settle ' - 'if the VDI does not exist when first introduced'), - ] -CONF = cfg.CONF -CONF.register_opts(xenapi_volume_utils_opts, 'xenserver') +CONF = nova.conf.CONF LOG = logging.getLogger(__name__)