From 46b1ff4e8025435a86c8cbba1b3e0ca983715d7e Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Mon, 31 Aug 2020 14:28:58 +0100 Subject: [PATCH] libvirt: Remove '[vnc] keymap', '[spice] keymap' options These options were deprecated way back in Rocky due to buggy behavior they introduced. We can remove them now. Change-Id: I9266edfd4ea6315239c54ff8d91e37d197c760c0 Signed-off-by: Stephen Finucane --- doc/source/admin/remote-console-access.rst | 4 -- nova/conf/spice.py | 17 -------- nova/conf/vnc.py | 25 ----------- nova/tests/unit/virt/libvirt/test_driver.py | 43 ++----------------- .../tests/unit/virt/vmwareapi/test_vm_util.py | 19 ++------ nova/virt/libvirt/driver.py | 16 ------- nova/virt/vmwareapi/driver.py | 6 --- nova/virt/vmwareapi/vm_util.py | 5 +-- ...emove-keymap-options-8db6d03ccf098db1.yaml | 19 ++++++++ 9 files changed, 28 insertions(+), 126 deletions(-) create mode 100644 releasenotes/notes/remove-keymap-options-8db6d03ccf098db1.yaml diff --git a/doc/source/admin/remote-console-access.rst b/doc/source/admin/remote-console-access.rst index 39f21ce782bc..01ef44810c38 100644 --- a/doc/source/admin/remote-console-access.rst +++ b/doc/source/admin/remote-console-access.rst @@ -138,7 +138,6 @@ noVNC-based VNC console support: - :oslo.config:option:`vnc.novncproxy_base_url` - :oslo.config:option:`vnc.server_listen` - :oslo.config:option:`vnc.server_proxyclient_address` -- :oslo.config:option:`vnc.keymap` If using the VMware compute driver, the following additional options are supported: @@ -155,7 +154,6 @@ For example, to configure this via a ``nova.conf`` file: novncproxy_base_url = http://IP_ADDRESS:6082/vnc_auto.html server_listen = 127.0.0.1 server_proxyclient_address = 127.0.0.1 - keymap = en-us Replace ``IP_ADDRESS`` with the IP address from which the proxy is accessible by the outside world. For example, this may be the management interface IP @@ -349,7 +347,6 @@ SPICE console support. - :oslo.config:option:`spice.html5proxy_base_url` - :oslo.config:option:`spice.server_listen` - :oslo.config:option:`spice.server_proxyclient_address` -- :oslo.config:option:`spice.keymap` For example, to configure this via a ``nova.conf`` file: @@ -361,7 +358,6 @@ For example, to configure this via a ``nova.conf`` file: html5proxy_base_url = http://IP_ADDRESS:6082/spice_auto.html server_listen = 127.0.0.1 server_proxyclient_address = 127.0.0.1 - keymap = en-us Replace ``IP_ADDRESS`` with the IP address from which the proxy is accessible by the outside world. For example, this may be the management interface IP diff --git a/nova/conf/spice.py b/nova/conf/spice.py index 4a51f6d1e897..59ed4e80a03b 100644 --- a/nova/conf/spice.py +++ b/nova/conf/spice.py @@ -142,23 +142,6 @@ Related options: The proxy client must be able to access the address specified in ``server_listen`` using the value of this option. """), - cfg.StrOpt('keymap', - deprecated_for_removal=True, - deprecated_since='18.0.0', - deprecated_reason=""" -Configuring this option forces QEMU to do keymap conversions. These conversions -are lossy and can result in significant issues for users of non en-US -keyboards. Refer to bug #1682020 for more information.""", - help=""" -A keyboard layout which is supported by the underlying hypervisor on this -node. - -Possible values: - -* This is usually an 'IETF language tag' (default is 'en-us'). If you - use QEMU as hypervisor, you should find the list of supported keyboard - layouts at /usr/share/qemu/keymaps. -""") ] ALL_OPTS.extend(CLI_OPTS) diff --git a/nova/conf/vnc.py b/nova/conf/vnc.py index d25c3e13ac61..7a6c579dd175 100644 --- a/nova/conf/vnc.py +++ b/nova/conf/vnc.py @@ -36,31 +36,6 @@ Guests will get created with graphical devices to support this. Clients (for example Horizon) can then establish a VNC connection to the guest. """), - cfg.StrOpt( - 'keymap', - deprecated_group='DEFAULT', - deprecated_name='vnc_keymap', - deprecated_for_removal=True, - deprecated_since='18.0.0', - deprecated_reason=""" -Configuring this option forces QEMU to do keymap conversions. These conversions -are lossy and can result in significant issues for users of non en-US -keyboards. You should instead use a VNC client that supports Extended Key Event -messages, such as noVNC 1.0.0. Refer to bug #1682020 for more information.""", - help=""" -Keymap for VNC. - -The keyboard mapping (keymap) determines which keyboard layout a VNC -session should use by default. - -Possible values: - -* A keyboard layout which is supported by the underlying hypervisor on - this node. This is usually an 'IETF language tag' (for example - 'en-us'). If you use QEMU as hypervisor, you should find the list - of supported keyboard layouts at ``/usr/share/qemu/keymaps``. -"""), - cfg.HostAddressOpt( 'server_listen', default='127.0.0.1', diff --git a/nova/tests/unit/virt/libvirt/test_driver.py b/nova/tests/unit/virt/libvirt/test_driver.py index de41339bcc96..a443dcc68363 100644 --- a/nova/tests/unit/virt/libvirt/test_driver.py +++ b/nova/tests/unit/virt/libvirt/test_driver.py @@ -5566,10 +5566,7 @@ class LibvirtConnTestCase(test.NoDBTestCase, return cfg def test_get_guest_config_with_vnc(self): - self.flags(enabled=True, - server_listen='10.0.0.1', - keymap='en-ie', - group='vnc') + self.flags(enabled=True, server_listen='10.0.0.1', group='vnc') self.flags(virt_type='kvm', group='libvirt') self.flags(pointer_model='ps2mouse') self.flags(enabled=False, group='spice') @@ -5593,8 +5590,8 @@ class LibvirtConnTestCase(test.NoDBTestCase, vconfig.LibvirtConfigMemoryBalloon) self.assertEqual(cfg.devices[3].type, 'vnc') - self.assertEqual(cfg.devices[3].keymap, 'en-ie') self.assertEqual(cfg.devices[3].listen, '10.0.0.1') + self.assertIsNone(cfg.devices[3].keymap) def test_get_guest_config_with_vnc_and_tablet(self): self.flags(enabled=True, group='vnc') @@ -5634,7 +5631,6 @@ class LibvirtConnTestCase(test.NoDBTestCase, self.flags(enabled=True, agent_enabled=False, server_listen='10.0.0.1', - keymap='en-ie', group='spice') cfg = self._get_guest_config_with_graphics() @@ -5659,8 +5655,8 @@ class LibvirtConnTestCase(test.NoDBTestCase, self.assertEqual(cfg.devices[3].type, 'tablet') self.assertEqual(cfg.devices[4].type, 'spice') - self.assertEqual(cfg.devices[4].keymap, 'en-ie') self.assertEqual(cfg.devices[4].listen, '10.0.0.1') + self.assertIsNone(cfg.devices[4].keymap) def test_get_guest_config_with_spice_and_agent(self): self.flags(enabled=False, group='vnc') @@ -5699,34 +5695,6 @@ class LibvirtConnTestCase(test.NoDBTestCase, self.assertEqual(cfg.devices[4].type, "spice") self.assertEqual(cfg.devices[5].type, video_type) - def test_get_guest_config_with_vnc_no_keymap(self): - self.flags(virt_type='kvm', group='libvirt') - self.flags(enabled=True, keymap=None, group='vnc') - self.flags(enabled=False, group='spice') - - cfg = self._get_guest_config_with_graphics() - - for device in cfg.devices: - if device.root_name == 'graphics': - self.assertIsInstance(device, - vconfig.LibvirtConfigGuestGraphics) - self.assertEqual('vnc', device.type) - self.assertIsNone(device.keymap) - - def test_get_guest_config_with_spice_no_keymap(self): - self.flags(virt_type='kvm', group='libvirt') - self.flags(enabled=True, keymap=None, group='spice') - self.flags(enabled=False, group='vnc') - - cfg = self._get_guest_config_with_graphics() - - for device in cfg.devices: - if device.root_name == 'graphics': - self.assertIsInstance(device, - vconfig.LibvirtConfigGuestGraphics) - self.assertEqual('spice', device.type) - self.assertIsNone(device.keymap) - @mock.patch.object(host.Host, 'get_guest') @mock.patch.object(libvirt_driver.LibvirtDriver, '_get_serial_ports_from_guest') @@ -7748,10 +7716,7 @@ class LibvirtConnTestCase(test.NoDBTestCase, self.stub_out('nova.virt.libvirt.host.Host.get_capabilities', get_host_capabilities_stub) - self.flags(enabled=True, - server_listen='10.0.0.1', - keymap='en-ie', - group='vnc') + self.flags(enabled=True, server_listen='10.0.0.1', group='vnc') self.flags(virt_type='kvm', group='libvirt') self.flags(enabled=False, group='spice') diff --git a/nova/tests/unit/virt/vmwareapi/test_vm_util.py b/nova/tests/unit/virt/vmwareapi/test_vm_util.py index 9b47e1746e0f..b120ae93618e 100644 --- a/nova/tests/unit/virt/vmwareapi/test_vm_util.py +++ b/nova/tests/unit/virt/vmwareapi/test_vm_util.py @@ -502,10 +502,10 @@ class VMwareVMUtilTestCase(test.NoDBTestCase): self.assertEqual(0, unit_number) self.assertEqual(1, controller_spec.device.busNumber) - def _test_get_vnc_config_spec(self, keymap): + def test_get_vnc_config_spec(self): + self.flags(vnc_keymap='en-ie', group='vmware') fake_factory = fake.FakeFactory() - result = vm_util.get_vnc_config_spec(fake_factory, - 7) + result = vm_util.get_vnc_config_spec(fake_factory, 7) expected = fake_factory.create('ns0:VirtualMachineConfigSpec') expected.extraConfig = [] @@ -520,23 +520,12 @@ class VMwareVMUtilTestCase(test.NoDBTestCase): expected.extraConfig.append(remote_display_vnc_port) remote_display_vnc_keymap = fake_factory.create('ns0:OptionValue') - remote_display_vnc_keymap.value = keymap + remote_display_vnc_keymap.value = 'en-ie' remote_display_vnc_keymap.key = 'RemoteDisplay.vnc.keyMap' expected.extraConfig.append(remote_display_vnc_keymap) self.assertEqual(expected, result) - def test_get_vnc_config_spec(self): - # TODO(stephenfin): Fold this back in and stop overridding the keymap - # option once we remove the '[vnc] keymap' option - self.flags(vnc_keymap='en-ie', group='vmware') - self._test_get_vnc_config_spec('en-ie') - - def test_get_vnc_config_spec__legacy_keymap(self): - self.flags(keymap='en-uk', group='vnc') - self.flags(vnc_keymap='en-ie', group='vmware') - self._test_get_vnc_config_spec('en-uk') - def _create_fake_vms(self): fake_vms = fake.FakeRetrieveResult() OptionValue = collections.namedtuple('OptionValue', ['key', 'value']) diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 2c8049ac05d6..6a7ec66d4197 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -621,18 +621,6 @@ class LibvirtDriver(driver.ComputeDriver): {'arch': hostarch}, ) - if CONF.vnc.keymap: - LOG.warning('The option "[vnc] keymap" has been deprecated ' - 'in favor of configuration within the guest. ' - 'Update nova.conf to address this change and ' - 'refer to bug #1682020 for more information.') - - if CONF.spice.keymap: - LOG.warning('The option "[spice] keymap" has been deprecated ' - 'in favor of configuration within the guest. ' - 'Update nova.conf to address this change and ' - 'refer to bug #1682020 for more information.') - def _handle_conn_event(self, enabled, reason): LOG.info("Connection event '%(enabled)d' reason '%(reason)s'", {'enabled': enabled, 'reason': reason}) @@ -6376,16 +6364,12 @@ class LibvirtDriver(driver.ComputeDriver): if CONF.vnc.enabled and guest.virt_type not in ('lxc', 'uml'): graphics = vconfig.LibvirtConfigGuestGraphics() graphics.type = "vnc" - if CONF.vnc.keymap: - graphics.keymap = CONF.vnc.keymap graphics.listen = CONF.vnc.server_listen guest.add_device(graphics) add_video_driver = True if CONF.spice.enabled and guest.virt_type not in ('lxc', 'uml', 'xen'): graphics = vconfig.LibvirtConfigGuestGraphics() graphics.type = "spice" - if CONF.spice.keymap: - graphics.keymap = CONF.spice.keymap graphics.listen = CONF.spice.server_listen guest.add_device(graphics) add_video_driver = True diff --git a/nova/virt/vmwareapi/driver.py b/nova/virt/vmwareapi/driver.py index c25aebb95a98..b413a9160cbe 100644 --- a/nova/virt/vmwareapi/driver.py +++ b/nova/virt/vmwareapi/driver.py @@ -110,12 +110,6 @@ class VMwareVCDriver(driver.ComputeDriver): raise Exception(_("Must specify host_ip, host_username and " "host_password to use vmwareapi.VMwareVCDriver")) - if CONF.vnc.keymap: - LOG.warning('The option "[vnc] keymap" has been deprecated in ' - 'favor of the VMWare-specific "[vmware] vnc_keymap" ' - 'option. Please update nova.conf to address this ' - 'change') - self._datastore_regex = None if CONF.vmware.datastore_regex: try: diff --git a/nova/virt/vmwareapi/vm_util.py b/nova/virt/vmwareapi/vm_util.py index fdd3d74dcdf8..fd295dcdfb9b 100644 --- a/nova/virt/vmwareapi/vm_util.py +++ b/nova/virt/vmwareapi/vm_util.py @@ -1039,10 +1039,7 @@ def get_vnc_config_spec(client_factory, port): opt_port.value = port opt_keymap = client_factory.create('ns0:OptionValue') opt_keymap.key = "RemoteDisplay.vnc.keyMap" - if CONF.vnc.keymap: - opt_keymap.value = CONF.vnc.keymap - else: - opt_keymap.value = CONF.vmware.vnc_keymap + opt_keymap.value = CONF.vmware.vnc_keymap extras = [opt_enabled, opt_port, opt_keymap] diff --git a/releasenotes/notes/remove-keymap-options-8db6d03ccf098db1.yaml b/releasenotes/notes/remove-keymap-options-8db6d03ccf098db1.yaml new file mode 100644 index 000000000000..90f75d363ae3 --- /dev/null +++ b/releasenotes/notes/remove-keymap-options-8db6d03ccf098db1.yaml @@ -0,0 +1,19 @@ +--- +upgrade: + - | + The ``[vnc] keymap`` and ``[spice] keymap`` configuration options, first + deprecated in 18.0.0 (Rocky), have now been removed. The VNC option + affected the libvirt and VMWare virt drivers, while the SPICE option only + affected libvirt. For the libvirt driver, configuring these options + resulted in lossy keymap conversions for the given graphics method. Users + can replace this host-level configuration with guest-level configuration. + This requires noVNC 1.0.0 or greater, which provides support for QEMU's + Extended Key Event messages. Refer to `bug #1682020`__ and the `QEMU RFB + pull request`__ for more information. + + For the VMWare driver, only the VNC option applied. However, the + ``[vmware] vnc_keymap`` option was introduce in 18.0.0 (Rocky) and can be + used to replace ``[vnc] keymap``. + + __ https://bugs.launchpad.net/nova/+bug/1682020 + __ https://github.com/novnc/noVNC/pull/596