Create vmware section
Implements blueprint vmware-configuration-section VMware specific parameters will be moved to a new section. The change is backward compatible and supports existing configurations. DocImpact Change-Id: Ic9b425a3d9ea2b614643ba8d3db50b065947c806
This commit is contained in:
parent
9e2d4ac460
commit
2642897d6f
@ -2169,72 +2169,6 @@
|
||||
#powervm_img_local_path=/tmp
|
||||
|
||||
|
||||
#
|
||||
# Options defined in nova.virt.vmwareapi.driver
|
||||
#
|
||||
|
||||
# URL for connection to VMware ESX/VC host. Required if
|
||||
# compute_driver is vmwareapi.VMwareESXDriver or
|
||||
# vmwareapi.VMwareVCDriver. (string value)
|
||||
#vmwareapi_host_ip=<None>
|
||||
|
||||
# Username for connection to VMware ESX/VC host. Used only if
|
||||
# compute_driver is vmwareapi.VMwareESXDriver or
|
||||
# vmwareapi.VMwareVCDriver. (string value)
|
||||
#vmwareapi_host_username=<None>
|
||||
|
||||
# Password for connection to VMware ESX/VC host. Used only if
|
||||
# compute_driver is vmwareapi.VMwareESXDriver or
|
||||
# vmwareapi.VMwareVCDriver. (string value)
|
||||
#vmwareapi_host_password=<None>
|
||||
|
||||
# Name of a VMware Cluster ComputeResource. Used only if
|
||||
# compute_driver is vmwareapi.VMwareVCDriver. (string value)
|
||||
#vmwareapi_cluster_name=<None>
|
||||
|
||||
# The interval used for polling of remote tasks. Used only if
|
||||
# compute_driver is vmwareapi.VMwareESXDriver or
|
||||
# vmwareapi.VMwareVCDriver. (floating point value)
|
||||
#vmwareapi_task_poll_interval=5.0
|
||||
|
||||
# The number of times we retry on failures, e.g., socket
|
||||
# error, etc. Used only if compute_driver is
|
||||
# vmwareapi.VMwareESXDriver or vmwareapi.VMwareVCDriver.
|
||||
# (integer value)
|
||||
#vmwareapi_api_retry_count=10
|
||||
|
||||
# VNC starting port (integer value)
|
||||
#vnc_port=5900
|
||||
|
||||
# Total number of VNC ports (integer value)
|
||||
#vnc_port_total=10000
|
||||
|
||||
# VNC password (string value)
|
||||
#vnc_password=<None>
|
||||
|
||||
# Whether to use linked clone (boolean value)
|
||||
#use_linked_clone=true
|
||||
|
||||
|
||||
#
|
||||
# Options defined in nova.virt.vmwareapi.vif
|
||||
#
|
||||
|
||||
# Physical ethernet adapter name for vlan networking (string
|
||||
# value)
|
||||
#vmwareapi_vlan_interface=vmnic0
|
||||
|
||||
|
||||
#
|
||||
# Options defined in nova.virt.vmwareapi.vim
|
||||
#
|
||||
|
||||
# Optional VIM Service WSDL Location e.g
|
||||
# http://<server>/vimService.wsdl. Optional over-ride to
|
||||
# default location for bug work-arounds (string value)
|
||||
#vmwareapi_wsdl_loc=<None>
|
||||
|
||||
|
||||
#
|
||||
# Options defined in nova.virt.xenapi.agent
|
||||
#
|
||||
@ -3091,6 +3025,72 @@
|
||||
|
||||
[vmware]
|
||||
|
||||
#
|
||||
# Options defined in nova.virt.vmwareapi.driver
|
||||
#
|
||||
|
||||
# URL for connection to VMware ESX/VC host. Required if
|
||||
# compute_driver is vmwareapi.VMwareESXDriver or
|
||||
# vmwareapi.VMwareVCDriver. (string value)
|
||||
#host_ip=<None>
|
||||
|
||||
# Username for connection to VMware ESX/VC host. Used only if
|
||||
# compute_driver is vmwareapi.VMwareESXDriver or
|
||||
# vmwareapi.VMwareVCDriver. (string value)
|
||||
#host_username=<None>
|
||||
|
||||
# Password for connection to VMware ESX/VC host. Used only if
|
||||
# compute_driver is vmwareapi.VMwareESXDriver or
|
||||
# vmwareapi.VMwareVCDriver. (string value)
|
||||
#host_password=<None>
|
||||
|
||||
# Name of a VMware Cluster ComputeResource. Used only if
|
||||
# compute_driver is vmwareapi.VMwareVCDriver. (string value)
|
||||
#cluster_name=<None>
|
||||
|
||||
# The interval used for polling of remote tasks. Used only if
|
||||
# compute_driver is vmwareapi.VMwareESXDriver or
|
||||
# vmwareapi.VMwareVCDriver. (floating point value)
|
||||
#task_poll_interval=5.0
|
||||
|
||||
# The number of times we retry on failures, e.g., socket
|
||||
# error, etc. Used only if compute_driver is
|
||||
# vmwareapi.VMwareESXDriver or vmwareapi.VMwareVCDriver.
|
||||
# (integer value)
|
||||
#api_retry_count=10
|
||||
|
||||
# VNC starting port (integer value)
|
||||
#vnc_port=5900
|
||||
|
||||
# Total number of VNC ports (integer value)
|
||||
#vnc_port_total=10000
|
||||
|
||||
# VNC password (string value)
|
||||
#vnc_password=<None>
|
||||
|
||||
# Whether to use linked clone (boolean value)
|
||||
#use_linked_clone=true
|
||||
|
||||
|
||||
#
|
||||
# Options defined in nova.virt.vmwareapi.vif
|
||||
#
|
||||
|
||||
# Physical ethernet adapter name for vlan networking (string
|
||||
# value)
|
||||
#vlan_interface=vmnic0
|
||||
|
||||
|
||||
#
|
||||
# Options defined in nova.virt.vmwareapi.vim
|
||||
#
|
||||
|
||||
# Optional VIM Service WSDL Location e.g
|
||||
# http://<server>/vimService.wsdl. Optional over-ride to
|
||||
# default location for bug work-arounds (string value)
|
||||
#wsdl_location=<None>
|
||||
|
||||
|
||||
#
|
||||
# Options defined in nova.virt.vmwareapi.vmops
|
||||
#
|
||||
|
@ -72,7 +72,7 @@ class VMwareAPIConfTestCase(test.TestCase):
|
||||
# Test the default configuration behavior. By default,
|
||||
# use the WSDL sitting on the host we are talking to in
|
||||
# order to bind the SOAP client.
|
||||
wsdl_loc = cfg.CONF.vmwareapi_wsdl_loc
|
||||
wsdl_loc = cfg.CONF.vmware.wsdl_location
|
||||
self.assertIsNone(wsdl_loc)
|
||||
wsdl_url = vim.Vim.get_wsdl_url("https", "www.example.com")
|
||||
url = vim.Vim.get_soap_url("https", "www.example.com")
|
||||
@ -91,8 +91,8 @@ class VMwareAPIConfTestCase(test.TestCase):
|
||||
# The wsdl_url should point to a different host than the one we
|
||||
# are actually going to send commands to.
|
||||
fake_wsdl = "https://www.test.com/sdk/foo.wsdl"
|
||||
self.flags(vmwareapi_wsdl_loc=fake_wsdl)
|
||||
wsdl_loc = cfg.CONF.vmwareapi_wsdl_loc
|
||||
self.flags(wsdl_location=fake_wsdl, group='vmware')
|
||||
wsdl_loc = cfg.CONF.vmware.wsdl_location
|
||||
self.assertIsNotNone(wsdl_loc)
|
||||
self.assertEqual(fake_wsdl, wsdl_loc)
|
||||
wsdl_url = vim.Vim.get_wsdl_url("https", "www.example.com")
|
||||
@ -107,11 +107,11 @@ class VMwareAPIVMTestCase(test.TestCase):
|
||||
def setUp(self):
|
||||
super(VMwareAPIVMTestCase, self).setUp()
|
||||
self.context = context.RequestContext('fake', 'fake', is_admin=False)
|
||||
self.flags(vmwareapi_host_ip='test_url',
|
||||
vmwareapi_host_username='test_username',
|
||||
vmwareapi_host_password='test_pass',
|
||||
vnc_enabled=False,
|
||||
use_linked_clone=False)
|
||||
self.flags(host_ip='test_url',
|
||||
host_username='test_username',
|
||||
host_password='test_pass',
|
||||
use_linked_clone=False, group='vmware')
|
||||
self.flags(vnc_enabled=False)
|
||||
self.user_id = 'fake'
|
||||
self.project_id = 'fake'
|
||||
self.node_name = 'test_url'
|
||||
@ -597,9 +597,9 @@ class VMwareAPIHostTestCase(test.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(VMwareAPIHostTestCase, self).setUp()
|
||||
self.flags(vmwareapi_host_ip='test_url',
|
||||
vmwareapi_host_username='test_username',
|
||||
vmwareapi_host_password='test_pass')
|
||||
self.flags(host_ip='test_url',
|
||||
host_username='test_username',
|
||||
host_password='test_pass', group='vmware')
|
||||
vmwareapi_fake.reset()
|
||||
stubs.set_stubs(self.stubs)
|
||||
self.conn = driver.VMwareESXDriver(False)
|
||||
@ -644,11 +644,9 @@ class VMwareAPIVCDriverTestCase(VMwareAPIVMTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(VMwareAPIVCDriverTestCase, self).setUp()
|
||||
self.flags(
|
||||
vmwareapi_cluster_name='test_cluster',
|
||||
vmwareapi_task_poll_interval=10,
|
||||
vnc_enabled=False
|
||||
)
|
||||
self.flags(cluster_name='test_cluster',
|
||||
task_poll_interval=10, group='vmware')
|
||||
self.flags(vnc_enabled=False)
|
||||
self.conn = driver.VMwareVCDriver(None, False)
|
||||
|
||||
def tearDown(self):
|
||||
|
@ -24,7 +24,7 @@ from nova.virt.vmwareapi import vif
|
||||
class VMwareVifTestCase(test.TestCase):
|
||||
def setUp(self):
|
||||
super(VMwareVifTestCase, self).setUp()
|
||||
self.flags(vmwareapi_vlan_interface='vmnet0')
|
||||
self.flags(vlan_interface='vmnet0', group='vmware')
|
||||
network = network_model.Network(id=0,
|
||||
bridge='fa0',
|
||||
label='fake',
|
||||
|
@ -60,56 +60,76 @@ from nova.virt.vmwareapi import volumeops
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
vmwareapi_opts = [
|
||||
cfg.StrOpt('vmwareapi_host_ip',
|
||||
cfg.StrOpt('host_ip',
|
||||
default=None,
|
||||
deprecated_name='vmwareapi_host_ip',
|
||||
deprecated_group='DEFAULT',
|
||||
help='URL for connection to VMware ESX/VC host. Required if '
|
||||
'compute_driver is vmwareapi.VMwareESXDriver or '
|
||||
'vmwareapi.VMwareVCDriver.'),
|
||||
cfg.StrOpt('vmwareapi_host_username',
|
||||
cfg.StrOpt('host_username',
|
||||
default=None,
|
||||
deprecated_name='vmwareapi_host_username',
|
||||
deprecated_group='DEFAULT',
|
||||
help='Username for connection to VMware ESX/VC host. '
|
||||
'Used only if compute_driver is '
|
||||
'vmwareapi.VMwareESXDriver or vmwareapi.VMwareVCDriver.'),
|
||||
cfg.StrOpt('vmwareapi_host_password',
|
||||
cfg.StrOpt('host_password',
|
||||
default=None,
|
||||
deprecated_name='vmwareapi_host_password',
|
||||
deprecated_group='DEFAULT',
|
||||
help='Password for connection to VMware ESX/VC host. '
|
||||
'Used only if compute_driver is '
|
||||
'vmwareapi.VMwareESXDriver or vmwareapi.VMwareVCDriver.',
|
||||
secret=True),
|
||||
cfg.StrOpt('vmwareapi_cluster_name',
|
||||
cfg.StrOpt('cluster_name',
|
||||
default=None,
|
||||
deprecated_name='vmwareapi_cluster_name',
|
||||
deprecated_group='DEFAULT',
|
||||
help='Name of a VMware Cluster ComputeResource. '
|
||||
'Used only if compute_driver is '
|
||||
'vmwareapi.VMwareVCDriver.'),
|
||||
cfg.FloatOpt('vmwareapi_task_poll_interval',
|
||||
cfg.FloatOpt('task_poll_interval',
|
||||
default=5.0,
|
||||
deprecated_name='vmwareapi_task_poll_interval',
|
||||
deprecated_group='DEFAULT',
|
||||
help='The interval used for polling of remote tasks. '
|
||||
'Used only if compute_driver is '
|
||||
'vmwareapi.VMwareESXDriver or '
|
||||
'vmwareapi.VMwareVCDriver.'),
|
||||
cfg.IntOpt('vmwareapi_api_retry_count',
|
||||
cfg.IntOpt('api_retry_count',
|
||||
default=10,
|
||||
deprecated_name='vmwareapi_api_retry_count',
|
||||
deprecated_group='DEFAULT',
|
||||
help='The number of times we retry on failures, e.g., '
|
||||
'socket error, etc. '
|
||||
'Used only if compute_driver is '
|
||||
'vmwareapi.VMwareESXDriver or vmwareapi.VMwareVCDriver.'),
|
||||
cfg.IntOpt('vnc_port',
|
||||
default=5900,
|
||||
deprecated_name='vnc_port',
|
||||
deprecated_group='DEFAULT',
|
||||
help='VNC starting port'),
|
||||
cfg.IntOpt('vnc_port_total',
|
||||
default=10000,
|
||||
deprecated_name='vnc_port_total',
|
||||
deprecated_group='DEFAULT',
|
||||
help='Total number of VNC ports'),
|
||||
cfg.StrOpt('vnc_password',
|
||||
default=None,
|
||||
deprecated_name='vnc_password',
|
||||
deprecated_group='DEFAULT',
|
||||
help='VNC password',
|
||||
secret=True),
|
||||
cfg.BoolOpt('use_linked_clone',
|
||||
default=True,
|
||||
deprecated_name='use_linked_clone',
|
||||
deprecated_group='DEFAULT',
|
||||
help='Whether to use linked clone'),
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(vmwareapi_opts)
|
||||
CONF.register_opts(vmwareapi_opts, 'vmware')
|
||||
|
||||
TIME_BETWEEN_API_CALL_RETRIES = 2.0
|
||||
|
||||
@ -136,10 +156,10 @@ class VMwareESXDriver(driver.ComputeDriver):
|
||||
def __init__(self, virtapi, read_only=False, scheme="https"):
|
||||
super(VMwareESXDriver, self).__init__(virtapi)
|
||||
|
||||
self._host_ip = CONF.vmwareapi_host_ip
|
||||
host_username = CONF.vmwareapi_host_username
|
||||
host_password = CONF.vmwareapi_host_password
|
||||
api_retry_count = CONF.vmwareapi_api_retry_count
|
||||
self._host_ip = CONF.vmware.host_ip
|
||||
host_username = CONF.vmware.host_username
|
||||
host_password = CONF.vmware.host_password
|
||||
api_retry_count = CONF.vmware.api_retry_count
|
||||
if not self._host_ip or host_username is None or host_password is None:
|
||||
raise Exception(_("Must specify vmwareapi_host_ip,"
|
||||
"vmwareapi_host_username "
|
||||
@ -293,9 +313,9 @@ class VMwareESXDriver(driver.ComputeDriver):
|
||||
|
||||
def get_console_pool_info(self, console_type):
|
||||
"""Get info about the host on which the VM resides."""
|
||||
return {'address': CONF.vmwareapi_host_ip,
|
||||
'username': CONF.vmwareapi_host_username,
|
||||
'password': CONF.vmwareapi_host_password}
|
||||
return {'address': CONF.vmware.host_ip,
|
||||
'username': CONF.vmware.host_username,
|
||||
'password': CONF.vmware.host_password}
|
||||
|
||||
def get_available_resource(self, nodename):
|
||||
"""Retrieve resource info.
|
||||
@ -376,7 +396,7 @@ class VMwareVCDriver(VMwareESXDriver):
|
||||
|
||||
def __init__(self, virtapi, read_only=False, scheme="https"):
|
||||
super(VMwareVCDriver, self).__init__(virtapi)
|
||||
self._cluster_name = CONF.vmwareapi_cluster_name
|
||||
self._cluster_name = CONF.vmware.cluster_name
|
||||
if not self._cluster_name:
|
||||
self._cluster = None
|
||||
else:
|
||||
@ -596,7 +616,7 @@ class VMwareAPISession(object):
|
||||
loop = loopingcall.FixedIntervalLoopingCall(self._poll_task,
|
||||
instance_uuid,
|
||||
task_ref, done)
|
||||
loop.start(CONF.vmwareapi_task_poll_interval)
|
||||
loop.start(CONF.vmware.task_poll_interval)
|
||||
ret_val = done.wait()
|
||||
loop.stop()
|
||||
return ret_val
|
||||
|
@ -26,19 +26,21 @@ from nova.virt.vmwareapi import network_util
|
||||
CONF = cfg.CONF
|
||||
|
||||
vmwareapi_vif_opts = [
|
||||
cfg.StrOpt('vmwareapi_vlan_interface',
|
||||
cfg.StrOpt('vlan_interface',
|
||||
default='vmnic0',
|
||||
deprecated_name='vmwareapi_vlan_interface',
|
||||
deprecated_group='DEFAULT',
|
||||
help='Physical ethernet adapter name for vlan networking'),
|
||||
]
|
||||
|
||||
CONF.register_opts(vmwareapi_vif_opts)
|
||||
CONF.register_opts(vmwareapi_vif_opts, 'vmware')
|
||||
|
||||
|
||||
def ensure_vlan_bridge(session, vif, cluster=None, create_vlan=True):
|
||||
"""Create a vlan and bridge unless they already exist."""
|
||||
vlan_num = vif['network'].get_meta('vlan')
|
||||
bridge = vif['network']['bridge']
|
||||
vlan_interface = CONF.vmwareapi_vlan_interface
|
||||
vlan_interface = CONF.vmware.vlan_interface
|
||||
|
||||
network_ref = network_util.get_network_with_the_name(session, bridge,
|
||||
cluster)
|
||||
|
@ -35,14 +35,16 @@ RESP_NOT_XML_ERROR = 'Response is "text/html", not "text/xml"'
|
||||
CONN_ABORT_ERROR = 'Software caused connection abort'
|
||||
ADDRESS_IN_USE_ERROR = 'Address already in use'
|
||||
|
||||
vmwareapi_wsdl_loc_opt = cfg.StrOpt('vmwareapi_wsdl_loc',
|
||||
vmwareapi_wsdl_loc_opt = cfg.StrOpt('wsdl_location',
|
||||
default=None,
|
||||
deprecated_name='vmwareapi_wsdl_loc',
|
||||
deprecated_group='DEFAULT',
|
||||
help='Optional VIM Service WSDL Location '
|
||||
'e.g http://<server>/vimService.wsdl. '
|
||||
'Optional over-ride to default location for bug work-arounds')
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opt(vmwareapi_wsdl_loc_opt)
|
||||
CONF.register_opt(vmwareapi_wsdl_loc_opt, 'vmware')
|
||||
|
||||
|
||||
if suds:
|
||||
@ -105,7 +107,7 @@ class Vim:
|
||||
:return: string to WSDL location for vSphere WS Management API
|
||||
"""
|
||||
# optional WSDL location over-ride for work-arounds
|
||||
wsdl_url = CONF.vmwareapi_wsdl_loc
|
||||
wsdl_url = CONF.vmware.wsdl_location
|
||||
if wsdl_url is None:
|
||||
# calculate default WSDL location if no override supplied
|
||||
wsdl_url = '%s://%s/sdk/vimService.wsdl' % (protocol, host_name)
|
||||
|
@ -217,7 +217,7 @@ class VMwareVMOps(object):
|
||||
# Set the vnc configuration of the instance, vnc port starts from 5900
|
||||
if CONF.vnc_enabled:
|
||||
vnc_port = self._get_vnc_port(vm_ref)
|
||||
vnc_pass = CONF.vnc_password or ''
|
||||
vnc_pass = CONF.vmware.vnc_password or ''
|
||||
self._set_vnc_config(client_factory, instance, vnc_port, vnc_pass)
|
||||
|
||||
def _create_virtual_disk():
|
||||
@ -345,7 +345,7 @@ class VMwareVMOps(object):
|
||||
self._default_root_device, block_device_info)
|
||||
|
||||
if not ebs_root:
|
||||
linked_clone = CONF.use_linked_clone
|
||||
linked_clone = CONF.vmware.use_linked_clone
|
||||
if linked_clone:
|
||||
upload_folder = self._instance_path_base
|
||||
upload_name = instance['image_ref']
|
||||
@ -1087,7 +1087,7 @@ class VMwareVMOps(object):
|
||||
"""Return connection info for a vnc console."""
|
||||
vm_ref = vm_util.get_vm_ref(self._session, instance)
|
||||
|
||||
return {'host': CONF.vmwareapi_host_ip,
|
||||
return {'host': CONF.vmware.host_ip,
|
||||
'port': self._get_vnc_port(vm_ref),
|
||||
'internal_access_path': None}
|
||||
|
||||
@ -1115,7 +1115,7 @@ class VMwareVMOps(object):
|
||||
def _get_vnc_port(vm_ref):
|
||||
"""Return VNC port for an VM."""
|
||||
vm_id = int(vm_ref.value.replace('vm-', ''))
|
||||
port = CONF.vnc_port + vm_id % CONF.vnc_port_total
|
||||
port = CONF.vmware.vnc_port + vm_id % CONF.vmware.vnc_port_total
|
||||
|
||||
return port
|
||||
|
||||
|
@ -123,9 +123,9 @@ class VMwareVolumeOps(object):
|
||||
"""Return volume connector information."""
|
||||
iqn = volume_util.get_host_iqn(self._session, self._cluster)
|
||||
return {
|
||||
'ip': CONF.vmwareapi_host_ip,
|
||||
'ip': CONF.vmware.host_ip,
|
||||
'initiator': iqn,
|
||||
'host': CONF.vmwareapi_host_ip
|
||||
'host': CONF.vmware.host_ip
|
||||
}
|
||||
|
||||
def attach_volume(self, connection_info, instance, mountpoint):
|
||||
|
Loading…
x
Reference in New Issue
Block a user