config options: Centralize vmware section

The config options of the "nova.conf" section "vmware"
got moved to the new central location "nova/conf/vmware.py".

Change-Id: I99b10ada928f052ef49279d2f003a47066b98622
Implements: blueprint centralize-config-options-newton
This commit is contained in:
Sujitha 2016-03-29 21:39:32 +00:00
parent c368a3e802
commit cf1e169bba
9 changed files with 162 additions and 143 deletions

View File

@ -69,7 +69,7 @@ from nova.conf import serial_console
# from nova.conf import trusted_computing
# from nova.conf import upgrade_levels
from nova.conf import virt
# from nova.conf import vmware
from nova.conf import vmware
from nova.conf import vnc
# from nova.conf import volume
# from nova.conf import workarounds
@ -129,7 +129,7 @@ serial_console.register_opts(CONF)
# trusted_computing.register_opts(CONF)
# upgrade_levels.register_opts(CONF)
virt.register_opts(CONF)
# vmware.register_opts(CONF)
vmware.register_opts(CONF)
vnc.register_opts(CONF)
# volume.register_opts(CONF)
# workarounds.register_opts(CONF)

151
nova/conf/vmware.py Normal file
View File

@ -0,0 +1,151 @@
# Copyright 2016 OpenStack Foundation
# All Rights Reserved.
#
# 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 itertools
from oslo_config import cfg
vmware_group = cfg.OptGroup('vmware', title='VMWare Options')
vmwareapi_vif_opts = [
cfg.StrOpt('vlan_interface',
default='vmnic0',
help='Physical ethernet adapter name for vlan networking'),
cfg.StrOpt('integration_bridge',
help='This option should be configured only when using the '
'NSX-MH Neutron plugin. This is the name of the '
'integration bridge on the ESXi. This should not be set '
'for any other Neutron plugin. Hence the default value '
'is not set.'),
]
vmware_utils_opts = [
cfg.IntOpt('console_delay_seconds',
help='Set this value if affected by an increased network '
'latency causing repeated characters when typing in '
'a remote console.'),
cfg.StrOpt('serial_port_service_uri',
help='Identifies the remote system that serial port traffic '
'will be sent to. If this is not set, no serial ports '
'will be added to the created VMs.'),
cfg.StrOpt('serial_port_proxy_uri',
help='Identifies a proxy service that provides network access '
'to the serial_port_service_uri. This option is ignored '
'if serial_port_service_uri is not specified.'),
]
vmwareapi_opts = [
cfg.StrOpt('host_ip',
help='Hostname or IP address for connection to VMware '
'vCenter host.'),
cfg.PortOpt('host_port',
default=443,
help='Port for connection to VMware vCenter host.'),
cfg.StrOpt('host_username',
help='Username for connection to VMware vCenter host.'),
cfg.StrOpt('host_password',
help='Password for connection to VMware vCenter host.',
secret=True),
cfg.StrOpt('ca_file',
help='Specify a CA bundle file to use in verifying the '
'vCenter server certificate.'),
cfg.BoolOpt('insecure',
default=False,
help='If true, the vCenter server certificate is not '
'verified. If false, then the default CA truststore is '
'used for verification. This option is ignored if '
'"ca_file" is set.'),
cfg.StrOpt('cluster_name',
help='Name of a VMware Cluster ComputeResource.'),
cfg.StrOpt('datastore_regex',
help='Regex to match the name of a datastore.'),
cfg.FloatOpt('task_poll_interval',
default=0.5,
help='The interval used for polling of remote tasks.'),
cfg.IntOpt('api_retry_count',
default=10,
help='The number of times we retry on failures, e.g., '
'socket error, etc.'),
cfg.PortOpt('vnc_port',
default=5900,
help='VNC starting port'),
cfg.IntOpt('vnc_port_total',
default=10000,
help='Total number of VNC ports'),
cfg.BoolOpt('use_linked_clone',
default=True,
help='Whether to use linked clone'),
cfg.StrOpt('wsdl_location',
help='Optional VIM Service WSDL Location '
'e.g http://<server>/vimService.wsdl. '
'Optional over-ride to default location for bug '
'work-arounds')
]
spbm_opts = [
cfg.BoolOpt('pbm_enabled',
default=False,
help='The PBM status.'),
cfg.StrOpt('pbm_wsdl_location',
help='PBM service WSDL file location URL. '
'e.g. file:///opt/SDK/spbm/wsdl/pbmService.wsdl '
'Not setting this will disable storage policy based '
'placement of instances.'),
cfg.StrOpt('pbm_default_policy',
help='The PBM default policy. If pbm_wsdl_location is set and '
'there is no defined storage policy for the specific '
'request then this policy will be used.'),
]
vimutil_opts = [
cfg.IntOpt('maximum_objects',
default=100,
help='The maximum number of ObjectContent data '
'objects that should be returned in a single '
'result. A positive value will cause the '
'operation to suspend the retrieval when the '
'count of objects reaches the specified '
'maximum. The server may still limit the count '
'to something less than the configured value. '
'Any remaining objects may be retrieved with '
'additional requests.')
]
vmops_opts = [
cfg.StrOpt('cache_prefix',
help='The prefix for where cached images are stored. This is '
'NOT the full path - just a folder prefix. '
'This should only be used when a datastore cache should '
'be shared between compute nodes. Note: this should only '
'be used when the compute nodes have a shared file '
'system.'),
]
ALL_VMWARE_OPTS = list(itertools.chain(
vmwareapi_vif_opts,
vmware_utils_opts,
vmwareapi_opts,
spbm_opts,
vimutil_opts,
vmops_opts))
def register_opts(conf):
conf.register_group(vmware_group)
conf.register_opts(ALL_VMWARE_OPTS, group=vmware_group)
def list_opts():
return {vmware_group: ALL_VMWARE_OPTS}

View File

@ -32,12 +32,6 @@ import nova.virt.libvirt.volume.remotefs
import nova.virt.libvirt.volume.scality
import nova.virt.libvirt.volume.smbfs
import nova.virt.libvirt.volume.volume
import nova.virt.vmwareapi.driver
import nova.virt.vmwareapi.images
import nova.virt.vmwareapi.vif
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
@ -76,15 +70,6 @@ def list_opts():
nova.virt.libvirt.volume.scality.volume_opts,
nova.virt.libvirt.volume.smbfs.volume_opts,
)),
('vmware',
itertools.chain(
[nova.virt.vmwareapi.vim_util.vmware_opts],
nova.virt.vmwareapi.driver.spbm_opts,
nova.virt.vmwareapi.driver.vmwareapi_opts,
nova.virt.vmwareapi.vif.vmwareapi_vif_opts,
nova.virt.vmwareapi.vm_util.vmware_utils_opts,
nova.virt.vmwareapi.vmops.vmops_opts,
)),
('xenserver',
itertools.chain(
[nova.virt.xenapi.vif.xenapi_ovs_integration_bridge_opt],

View File

@ -21,7 +21,6 @@ A connection to the VMware vCenter platform.
import re
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
from oslo_utils import versionutils as v_utils
@ -46,72 +45,7 @@ from nova.virt.vmwareapi import volumeops
LOG = logging.getLogger(__name__)
vmwareapi_opts = [
cfg.StrOpt('host_ip',
help='Hostname or IP address for connection to VMware '
'vCenter host.'),
cfg.PortOpt('host_port',
default=443,
help='Port for connection to VMware vCenter host.'),
cfg.StrOpt('host_username',
help='Username for connection to VMware vCenter host.'),
cfg.StrOpt('host_password',
help='Password for connection to VMware vCenter host.',
secret=True),
cfg.StrOpt('ca_file',
help='Specify a CA bundle file to use in verifying the '
'vCenter server certificate.'),
cfg.BoolOpt('insecure',
default=False,
help='If true, the vCenter server certificate is not '
'verified. If false, then the default CA truststore is '
'used for verification. This option is ignored if '
'"ca_file" is set.'),
cfg.StrOpt('cluster_name',
help='Name of a VMware Cluster ComputeResource.'),
cfg.StrOpt('datastore_regex',
help='Regex to match the name of a datastore.'),
cfg.FloatOpt('task_poll_interval',
default=0.5,
help='The interval used for polling of remote tasks.'),
cfg.IntOpt('api_retry_count',
default=10,
help='The number of times we retry on failures, e.g., '
'socket error, etc.'),
cfg.PortOpt('vnc_port',
default=5900,
help='VNC starting port'),
cfg.IntOpt('vnc_port_total',
default=10000,
help='Total number of VNC ports'),
cfg.BoolOpt('use_linked_clone',
default=True,
help='Whether to use linked clone'),
cfg.StrOpt('wsdl_location',
help='Optional VIM Service WSDL Location '
'e.g http://<server>/vimService.wsdl. '
'Optional over-ride to default location for bug '
'work-arounds')
]
spbm_opts = [
cfg.BoolOpt('pbm_enabled',
default=False,
help='The PBM status.'),
cfg.StrOpt('pbm_wsdl_location',
help='PBM service WSDL file location URL. '
'e.g. file:///opt/SDK/spbm/wsdl/pbmService.wsdl '
'Not setting this will disable storage policy based '
'placement of instances.'),
cfg.StrOpt('pbm_default_policy',
help='The PBM default policy. If pbm_wsdl_location is set and '
'there is no defined storage policy for the specific '
'request then this policy will be used.'),
]
CONF = nova.conf.CONF
CONF.register_opts(vmwareapi_opts, 'vmware')
CONF.register_opts(spbm_opts, 'vmware')
TIME_BETWEEN_API_CALL_RETRIES = 1.0

View File

@ -15,11 +15,11 @@
"""VIF drivers for VMware."""
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import versionutils
from oslo_vmware import vim_util
import nova.conf
from nova import exception
from nova.i18n import _, _LI, _LW
from nova.network import model
@ -28,21 +28,7 @@ from nova.virt.vmwareapi import network_util
from nova.virt.vmwareapi import vm_util
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
vmwareapi_vif_opts = [
cfg.StrOpt('vlan_interface',
default='vmnic0',
help='Physical ethernet adapter name for vlan networking'),
cfg.StrOpt('integration_bridge',
help='This option should be configured only when using the '
'NSX-MH Neutron plugin. This is the name of the '
'integration bridge on the ESXi. This should not be set '
'for any other Neutron plugin. Hence the default value '
'is not set.'),
]
CONF.register_opts(vmwareapi_vif_opts, 'vmware')
CONF = nova.conf.CONF
def _get_associated_vswitch_for_interface(session, interface, cluster=None):

View File

@ -17,23 +17,13 @@
The VMware API utility module.
"""
from oslo_config import cfg
from oslo_log import log as logging
from oslo_vmware import vim_util as vutil
import six
vmware_opts = cfg.IntOpt('maximum_objects', default=100,
help='The maximum number of ObjectContent data '
'objects that should be returned in a single '
'result. A positive value will cause the '
'operation to suspend the retrieval when the '
'count of objects reaches the specified '
'maximum. The server may still limit the count '
'to something less than the configured value. '
'Any remaining objects may be retrieved with '
'additional requests.')
CONF = cfg.CONF
CONF.register_opt(vmware_opts, 'vmware')
import nova.conf
CONF = nova.conf.CONF
LOG = logging.getLogger(__name__)

View File

@ -22,7 +22,6 @@ import collections
import copy
import functools
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
from oslo_utils import units
@ -32,6 +31,7 @@ from oslo_vmware import pbm
from oslo_vmware import vim_util as vutil
import six
import nova.conf
from nova import exception
from nova.i18n import _, _LE, _LI, _LW
from nova.network import model as network_model
@ -40,23 +40,7 @@ from nova.virt.vmwareapi import vim_util
LOG = logging.getLogger(__name__)
vmware_utils_opts = [
cfg.IntOpt('console_delay_seconds',
help='Set this value if affected by an increased network '
'latency causing repeated characters when typing in '
'a remote console.'),
cfg.StrOpt('serial_port_service_uri',
help='Identifies the remote system that serial port traffic '
'will be sent to. If this is not set, no serial ports '
'will be added to the created VMs.'),
cfg.StrOpt('serial_port_proxy_uri',
help='Identifies a proxy service that provides network access '
'to the serial_port_service_uri. This option is ignored '
'if serial_port_service_uri is not specified.'),
]
CONF = cfg.CONF
CONF.register_opts(vmware_utils_opts, 'vmware')
CONF = nova.conf.CONF
ALL_SUPPORTED_NETWORK_DEVICES = ['VirtualE1000', 'VirtualE1000e',
'VirtualPCNet32', 'VirtualSriovEthernetCard',

View File

@ -25,7 +25,6 @@ import time
import decorator
from oslo_concurrency import lockutils
from oslo_config import cfg
from oslo_log import log as logging
from oslo_serialization import jsonutils
from oslo_utils import excutils
@ -62,18 +61,8 @@ from nova.virt.vmwareapi import vif as vmwarevif
from nova.virt.vmwareapi import vim_util
from nova.virt.vmwareapi import vm_util
vmops_opts = [
cfg.StrOpt('cache_prefix',
help='The prefix for where cached images are stored. This is '
'NOT the full path - just a folder prefix. '
'This should only be used when a datastore cache should '
'be shared between compute nodes. Note: this should only '
'be used when the compute nodes have a shared file '
'system.'),
]
CONF = nova.conf.CONF
CONF.register_opts(vmops_opts, 'vmware')
CONF.import_opt('my_ip', 'nova.netconf')
LOG = logging.getLogger(__name__)

View File

@ -17,17 +17,17 @@
Management class for Storage-related functions (attach, detach, etc).
"""
from oslo_config import cfg
from oslo_log import log as logging
from oslo_vmware import exceptions as oslo_vmw_exceptions
from oslo_vmware import vim_util as vutil
import nova.conf
from nova import exception
from nova.i18n import _, _LI, _LW
from nova.virt.vmwareapi import constants
from nova.virt.vmwareapi import vm_util
CONF = cfg.CONF
CONF = nova.conf.CONF
LOG = logging.getLogger(__name__)