Merge "VMware: remove deprecated configuration variable"

This commit is contained in:
Jenkins
2013-10-15 01:04:09 +00:00
committed by Gerrit Code Review
6 changed files with 7 additions and 53 deletions

View File

@@ -3293,12 +3293,6 @@
# Total number of VNC ports (integer value) # Total number of VNC ports (integer value)
#vnc_port_total=10000 #vnc_port_total=10000
# DEPRECATED. VNC password. The password-based access to VNC
# consoles will be removed in the next release. The default
# value will disable password protection on the VNC console.
# (string value)
#vnc_password=<None>
# Whether to use linked clone (boolean value) # Whether to use linked clone (boolean value)
#use_linked_clone=true #use_linked_clone=true

View File

@@ -768,10 +768,6 @@ class VMwareAPIVMTestCase(test.NoDBTestCase):
def test_get_vnc_console(self): def test_get_vnc_console(self):
self._test_get_vnc_console() self._test_get_vnc_console()
def test_get_vnc_console_with_password(self):
self.flags(vnc_password='vmware', group='vmware')
self._test_get_vnc_console()
def test_host_ip_addr(self): def test_host_ip_addr(self):
self.assertEqual(self.conn.get_host_ip_addr(), "test_url") self.assertEqual(self.conn.get_host_ip_addr(), "test_url")

View File

@@ -298,14 +298,14 @@ class VMwareVMUtilTestCase(test.NoDBTestCase):
vmdk_adapter_type = vm_util.get_vmdk_adapter_type("dummyAdapter") vmdk_adapter_type = vm_util.get_vmdk_adapter_type("dummyAdapter")
self.assertEqual("dummyAdapter", vmdk_adapter_type) self.assertEqual("dummyAdapter", vmdk_adapter_type)
def _test_get_vnc_config_spec(self, port, password): def _test_get_vnc_config_spec(self, port):
result = vm_util.get_vnc_config_spec(fake.FakeFactory(), result = vm_util.get_vnc_config_spec(fake.FakeFactory(),
port, password) port)
return result return result
def test_get_vnc_config_spec(self): def test_get_vnc_config_spec(self):
result = self._test_get_vnc_config_spec(7, None) result = self._test_get_vnc_config_spec(7)
expected = """{'extraConfig': [ expected = """{'extraConfig': [
{'value': 'true', {'value': 'true',
'key': 'RemoteDisplay.vnc.enabled', 'key': 'RemoteDisplay.vnc.enabled',
@@ -318,23 +318,6 @@ class VMwareVMUtilTestCase(test.NoDBTestCase):
result = re.sub(r'\s+', '', repr(result)) result = re.sub(r'\s+', '', repr(result))
self.assertEqual(expected, result) self.assertEqual(expected, result)
def test_get_vnc_config_spec_password(self):
result = self._test_get_vnc_config_spec(7, 'password')
expected = """{'extraConfig': [
{'value': 'true',
'key': 'RemoteDisplay.vnc.enabled',
'obj_name': 'ns0:OptionValue'},
{'value': 7,
'key': 'RemoteDisplay.vnc.port',
'obj_name': 'ns0:OptionValue'},
{'value':'password',
'key':'RemoteDisplay.vnc.password',
'obj_name':'ns0:OptionValue'}],
'obj_name': 'ns0:VirtualMachineConfigSpec'}"""
expected = re.sub(r'\s+', '', expected)
result = re.sub(r'\s+', '', repr(result))
self.assertEqual(expected, result)
def test_get_all_cluster_refs_by_name_none(self): def test_get_all_cluster_refs_by_name_none(self):
fake_objects = fake.FakeRetrieveResult() fake_objects = fake.FakeRetrieveResult()
refs = vm_util.get_all_cluster_refs_by_name(fake_session(fake_objects), refs = vm_util.get_all_cluster_refs_by_name(fake_session(fake_objects),

View File

@@ -99,15 +99,6 @@ vmwareapi_opts = [
deprecated_name='vnc_port_total', deprecated_name='vnc_port_total',
deprecated_group='DEFAULT', deprecated_group='DEFAULT',
help='Total number of VNC ports'), help='Total number of VNC ports'),
# Deprecated, remove in Icehouse
cfg.StrOpt('vnc_password',
deprecated_name='vnc_password',
deprecated_group='DEFAULT',
help='DEPRECATED. VNC password. The password-based access to '
'VNC consoles will be removed in the next release. The '
'default value will disable password protection on the '
'VNC console.',
secret=True),
cfg.BoolOpt('use_linked_clone', cfg.BoolOpt('use_linked_clone',
default=True, default=True,
deprecated_name='use_linked_clone', deprecated_name='use_linked_clone',

View File

@@ -557,7 +557,7 @@ def get_add_vswitch_port_group_spec(client_factory, vswitch_name,
return vswitch_port_group_spec return vswitch_port_group_spec
def get_vnc_config_spec(client_factory, port, password): def get_vnc_config_spec(client_factory, port):
"""Builds the vnc config spec.""" """Builds the vnc config spec."""
virtual_machine_config_spec = client_factory.create( virtual_machine_config_spec = client_factory.create(
'ns0:VirtualMachineConfigSpec') 'ns0:VirtualMachineConfigSpec')
@@ -569,15 +569,6 @@ def get_vnc_config_spec(client_factory, port, password):
opt_port.key = "RemoteDisplay.vnc.port" opt_port.key = "RemoteDisplay.vnc.port"
opt_port.value = port opt_port.value = port
extras = [opt_enabled, opt_port] extras = [opt_enabled, opt_port]
if password:
LOG.deprecated(_("The password-based access to VNC consoles will be "
"removed in the next release. Please, switch to "
"using the default value (this will disable password "
"protection on the VNC console)."))
opt_pass = client_factory.create('ns0:OptionValue')
opt_pass.key = "RemoteDisplay.vnc.password"
opt_pass.value = password
extras.append(opt_pass)
virtual_machine_config_spec.extraConfig = extras virtual_machine_config_spec.extraConfig = extras
return virtual_machine_config_spec return virtual_machine_config_spec

View File

@@ -270,8 +270,7 @@ class VMwareVMOps(object):
# Set the vnc configuration of the instance, vnc port starts from 5900 # Set the vnc configuration of the instance, vnc port starts from 5900
if CONF.vnc_enabled: if CONF.vnc_enabled:
vnc_port = self._get_vnc_port(vm_ref) vnc_port = self._get_vnc_port(vm_ref)
vnc_pass = CONF.vmware.vnc_password or '' self._set_vnc_config(client_factory, instance, vnc_port)
self._set_vnc_config(client_factory, instance, vnc_port, vnc_pass)
def _create_virtual_disk(): def _create_virtual_disk():
"""Create a virtual disk of the size of flat vmdk file.""" """Create a virtual disk of the size of flat vmdk file."""
@@ -1389,14 +1388,14 @@ class VMwareVMOps(object):
LOG.debug(_("Reconfigured VM instance to set the machine id"), LOG.debug(_("Reconfigured VM instance to set the machine id"),
instance=instance) instance=instance)
def _set_vnc_config(self, client_factory, instance, port, password): def _set_vnc_config(self, client_factory, instance, port):
""" """
Set the vnc configuration of the VM. Set the vnc configuration of the VM.
""" """
vm_ref = vm_util.get_vm_ref(self._session, instance) vm_ref = vm_util.get_vm_ref(self._session, instance)
vnc_config_spec = vm_util.get_vnc_config_spec( vnc_config_spec = vm_util.get_vnc_config_spec(
client_factory, port, password) client_factory, port)
LOG.debug(_("Reconfiguring VM instance to enable vnc on " LOG.debug(_("Reconfiguring VM instance to enable vnc on "
"port - %(port)s") % {'port': port}, "port - %(port)s") % {'port': port},