From ee92961fe5275f85779634aad637d00c15802b49 Mon Sep 17 00:00:00 2001 From: Alban Lecorps Date: Mon, 31 Oct 2022 11:52:53 +0100 Subject: Remove console_type parameter for server_mks_console function The "get_mks_console" use "console_type" as param, but causes an issue on Nova. In horizon logs we have "Recoverable error: No available console found." and in the dashboard we have "Unable to load console. Please reload page to try again." when we load the console. There is no need to call the function with this parameter, as it's already defined automatically since microversion 2.53. Change-Id: I776b19f053ca74c699ca069e04553740f1e83b3e --- openstack_dashboard/api/nova.py | 4 ++-- openstack_dashboard/test/unit/api/test_nova.py | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'openstack_dashboard') diff --git a/openstack_dashboard/api/nova.py b/openstack_dashboard/api/nova.py index 03bdee1a9..3d403caa2 100644 --- a/openstack_dashboard/api/nova.py +++ b/openstack_dashboard/api/nova.py @@ -222,10 +222,10 @@ def server_serial_console(request, instance_id, console_type='serial'): @profiler.trace -def server_mks_console(request, instance_id, console_type='mks'): +def server_mks_console(request, instance_id): microver = get_microversion(request, "remote_console_mks") nc = _nova.novaclient(request, microver) - console = nc.servers.get_mks_console(instance_id, console_type) + console = nc.servers.get_mks_console(instance_id) return MKSConsole(console['remote_console']) diff --git a/openstack_dashboard/test/unit/api/test_nova.py b/openstack_dashboard/test/unit/api/test_nova.py index d394b78f7..fb0df1d7d 100644 --- a/openstack_dashboard/test/unit/api/test_nova.py +++ b/openstack_dashboard/test/unit/api/test_nova.py @@ -151,19 +151,17 @@ class ComputeApiTests(test.APIMockTestCase): def test_server_mks_console(self, mock_novaclient): server = self.servers.first() console = self.servers.mks_console_data - console_type = console["remote_console"]["type"] novaclient = mock_novaclient.return_value self._mock_current_version(novaclient, '2.53') novaclient.servers.get_mks_console.return_value = console ret_val = api.nova.server_mks_console(self.request, - server.id, - console_type) + server.id) self.assertIsInstance(ret_val, api.nova.MKSConsole) novaclient.versions.get_current.assert_called_once_with() novaclient.servers.get_mks_console.assert_called_once_with( - server.id, console_type) + server.id) @mock.patch.object(api._nova, 'novaclient') def test_server_list(self, mock_novaclient): -- cgit v1.2.1