Skip to content

Commit

Permalink
vmware: Switch mks console to webmks
Browse files Browse the repository at this point in the history
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
  • Loading branch information
joker-at-work committed Nov 18, 2024
1 parent 6fdee07 commit 66f29b0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
7 changes: 2 additions & 5 deletions nova/tests/unit/virt/vmwareapi/test_vmops.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand Down
9 changes: 2 additions & 7 deletions nova/virt/vmwareapi/vmops.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 66f29b0

Please sign in to comment.