Config options: Centralize xenapi driver options

The config options of
"nova/virt/xenapi/driver.py" got moved
to the new central location
"nova/conf/xenserver.py”

Change-Id: I87f6163c7a3b69ef8ede947132b771f32742781e
Implements: blueprint centralize-config-options-newton
This commit is contained in:
Anusha Unnam 2016-03-29 22:23:09 +00:00
parent 8caaf3572e
commit 424ab495e7
5 changed files with 57 additions and 67 deletions

View File

@ -288,10 +288,62 @@ xenapi_vm_utils_opts = [
'ISO image creation'),
]
xenapi_opts = [
cfg.StrOpt('connection_url',
help='URL for connection to XenServer/Xen Cloud Platform. '
'A special value of unix://local can be used to connect '
'to the local unix socket. '
'Required if compute_driver=xenapi.XenAPIDriver'),
cfg.StrOpt('connection_username',
default='root',
help='Username for connection to XenServer/Xen Cloud Platform. '
'Used only if compute_driver=xenapi.XenAPIDriver'),
cfg.StrOpt('connection_password',
help='Password for connection to XenServer/Xen Cloud Platform. '
'Used only if compute_driver=xenapi.XenAPIDriver',
secret=True),
cfg.FloatOpt('vhd_coalesce_poll_interval',
default=5.0,
help='The interval used for polling of coalescing vhds. '
'Used only if compute_driver=xenapi.XenAPIDriver'),
cfg.BoolOpt('check_host',
default=True,
help='Ensure compute service is running on host XenAPI '
'connects to.'),
cfg.IntOpt('vhd_coalesce_max_attempts',
default=20,
help='Max number of times to poll for VHD to coalesce. '
'Used only if compute_driver=xenapi.XenAPIDriver'),
cfg.StrOpt('sr_base_path',
default='/var/run/sr-mount',
help='Base path to the storage repository'),
cfg.StrOpt('target_host',
help='The iSCSI Target Host'),
cfg.StrOpt('target_port',
default='3260',
help='The iSCSI Target Port, default is port 3260'),
cfg.StrOpt('iqn_prefix',
default='iqn.2010-10.org.openstack',
help='IQN Prefix'),
# NOTE(sirp): This is a work-around for a bug in Ubuntu Maverick,
# when we pull support for it, we should remove this
cfg.BoolOpt('remap_vbd_dev',
default=False,
help='Used to enable the remapping of VBD dev '
'(Works around an issue in Ubuntu Maverick)'),
cfg.StrOpt('remap_vbd_dev_prefix',
default='sd',
help='Specify prefix to remap VBD dev to '
'(ex. /dev/xvdb -> /dev/sdb)'),
]
ALL_XENSERVER_OPTS = (xenapi_agent_opts +
xenapi_session_opts +
xenapi_torrent_opts +
xenapi_vm_utils_opts)
xenapi_vm_utils_opts +
xenapi_opts)
def register_opts(conf):

View File

@ -75,8 +75,6 @@ LOG = logging.getLogger(__name__)
CONF = nova.conf.CONF
CONF.import_opt('host', 'nova.netconf')
CONF.import_opt('login_timeout', 'nova.virt.xenapi.client.session',
group="xenserver")
IMAGE_MACHINE = '1'
IMAGE_KERNEL = '2'

View File

@ -38,8 +38,6 @@ import nova.virt.vmwareapi.vim_util
import nova.virt.vmwareapi.vm_util
import nova.virt.vmwareapi.vmops
import nova.virt.xenapi.agent
import nova.virt.xenapi.client.session
import nova.virt.xenapi.driver
import nova.virt.xenapi.pool
import nova.virt.xenapi.vif
import nova.virt.xenapi.vmops
@ -84,7 +82,6 @@ def list_opts():
('xenserver',
itertools.chain(
[nova.virt.xenapi.vif.xenapi_ovs_integration_bridge_opt],
nova.virt.xenapi.driver.xenapi_opts,
nova.virt.xenapi.pool.xenapi_pool_opts,
nova.virt.xenapi.vmops.xenapi_vmops_opts,
nova.virt.xenapi.volume_utils.xenapi_volume_utils_opts,

View File

@ -25,7 +25,6 @@ A driver for XenServer or Xen Cloud Platform.
import math
from oslo_config import cfg
from oslo_log import log as logging
from oslo_serialization import jsonutils
from oslo_utils import units
@ -33,6 +32,7 @@ from oslo_utils import versionutils
import six
import six.moves.urllib.parse as urlparse
import nova.conf
from nova.i18n import _, _LE, _LW
from nova.virt import driver
from nova.virt.xenapi.client import session
@ -44,57 +44,7 @@ from nova.virt.xenapi import volumeops
LOG = logging.getLogger(__name__)
xenapi_opts = [
cfg.StrOpt('connection_url',
help='URL for connection to XenServer/Xen Cloud Platform. '
'A special value of unix://local can be used to connect '
'to the local unix socket. '
'Required if compute_driver=xenapi.XenAPIDriver'),
cfg.StrOpt('connection_username',
default='root',
help='Username for connection to XenServer/Xen Cloud Platform. '
'Used only if compute_driver=xenapi.XenAPIDriver'),
cfg.StrOpt('connection_password',
help='Password for connection to XenServer/Xen Cloud Platform. '
'Used only if compute_driver=xenapi.XenAPIDriver',
secret=True),
cfg.FloatOpt('vhd_coalesce_poll_interval',
default=5.0,
help='The interval used for polling of coalescing vhds. '
'Used only if compute_driver=xenapi.XenAPIDriver'),
cfg.BoolOpt('check_host',
default=True,
help='Ensure compute service is running on host XenAPI '
'connects to.'),
cfg.IntOpt('vhd_coalesce_max_attempts',
default=20,
help='Max number of times to poll for VHD to coalesce. '
'Used only if compute_driver=xenapi.XenAPIDriver'),
cfg.StrOpt('sr_base_path',
default='/var/run/sr-mount',
help='Base path to the storage repository'),
cfg.StrOpt('target_host',
help='The iSCSI Target Host'),
cfg.StrOpt('target_port',
default='3260',
help='The iSCSI Target Port, default is port 3260'),
cfg.StrOpt('iqn_prefix',
default='iqn.2010-10.org.openstack',
help='IQN Prefix'),
# NOTE(sirp): This is a work-around for a bug in Ubuntu Maverick,
# when we pull support for it, we should remove this
cfg.BoolOpt('remap_vbd_dev',
default=False,
help='Used to enable the remapping of VBD dev '
'(Works around an issue in Ubuntu Maverick)'),
cfg.StrOpt('remap_vbd_dev_prefix',
default='sd',
help='Specify prefix to remap VBD dev to '
'(ex. /dev/xvdb -> /dev/sdb)'),
]
CONF = cfg.CONF
CONF.register_opts(xenapi_opts, 'xenserver')
CONF = nova.conf.CONF
CONF.import_opt('host', 'nova.netconf')
OVERHEAD_BASE = 3

View File

@ -27,6 +27,7 @@ POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'nova', '__init__.py')):
sys.path.insert(0, POSSIBLE_TOPDIR)
import nova.conf
from nova import config
from nova import utils
from nova.virt.xenapi.client import session
@ -42,17 +43,9 @@ destroy_opts = [
help='Don\'t actually delete the VDIs.')
]
CONF = cfg.CONF
CONF = nova.conf.CONF
CONF.register_cli_opts(destroy_opts)
CONF.import_opt('connection_url', 'nova.virt.xenapi.driver',
group='xenserver')
CONF.import_opt('connection_username', 'nova.virt.xenapi.driver',
group='xenserver')
CONF.import_opt('connection_password', 'nova.virt.xenapi.driver',
group='xenserver')
def main():
config.parse_args(sys.argv)
utils.monkey_patch()