From 66f29b0ce459ab6ba4244cb697f268a2a33592fc Mon Sep 17 00:00:00 2001 From: Johannes Kulik Date: Mon, 18 Nov 2024 15:22:08 +0100 Subject: [PATCH] vmware: Switch mks console to `webmks` Since vSphere 6, VMware supports `webmks` as `ticketType` in addition to `mks`. `webmks` provides the remote console of a VM via WebSocket endpoint and is supposed to be used with their SDK. It does fall back to normal VNC which can be used with e.g. `noVNC` though. With this change, we can follow-up by removing our custom mks proxy code, as we plan to expose `webmks` via Nginx directly. Change-Id: I99294d7f6bf0539d20887322eeadb2580297fc8a --- nova/tests/unit/virt/vmwareapi/test_vmops.py | 7 ++----- nova/virt/vmwareapi/vmops.py | 9 ++------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/nova/tests/unit/virt/vmwareapi/test_vmops.py b/nova/tests/unit/virt/vmwareapi/test_vmops.py index 393c95f9834..59ef1429920 100644 --- a/nova/tests/unit/virt/vmwareapi/test_vmops.py +++ b/nova/tests/unit/virt/vmwareapi/test_vmops.py @@ -18,7 +18,6 @@ import time import ddt -from oslo_serialization import jsonutils from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import units from oslo_utils import uuidutils @@ -4061,10 +4060,8 @@ def test_get_mks_console(self, mock_get_vm_ref): console = self._vmops.get_mks_console(self._instance) self.assertEqual('esx1', console.host) self.assertEqual(902, console.port) - path = jsonutils.loads(console.internal_access_path) - self.assertEqual('fira', path['ticket']) - self.assertEqual('aabbccddeeff', path['thumbprint']) - self.assertEqual('[ds1] fira/foo.vmx', path['cfgFile']) + path = console.internal_access_path + self.assertEqual(f"/ticket/{ticket.ticket}", path) def test_get_cores_per_socket(self): extra_specs = {'hw:cpu_sockets': 7} diff --git a/nova/virt/vmwareapi/vmops.py b/nova/virt/vmwareapi/vmops.py index 6978fa3244a..aa32f1c552f 100644 --- a/nova/virt/vmwareapi/vmops.py +++ b/nova/virt/vmwareapi/vmops.py @@ -38,7 +38,6 @@ from oslo_concurrency import lockutils from oslo_log import log as logging import oslo_messaging as messaging -from oslo_serialization import jsonutils from oslo_utils import excutils from oslo_utils import strutils from oslo_utils import timeutils @@ -4202,12 +4201,8 @@ def get_mks_console(self, instance): ticket = self._session._call_method(self._session.vim, 'AcquireTicket', vm_ref, - ticketType='mks') - thumbprint = ticket.sslThumbprint.replace(':', '').lower() - mks_auth = {'ticket': ticket.ticket, - 'cfgFile': ticket.cfgFile, - 'thumbprint': thumbprint} - internal_access_path = jsonutils.dumps(mks_auth) + ticketType='webmks') + internal_access_path = f"/ticket/{ticket.ticket}" return ctype.ConsoleMKS(ticket.host, ticket.port, internal_access_path) @staticmethod