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
This commit is contained in:
Alban Lecorps 2022-10-31 11:52:53 +01:00
parent 516e57bc89
commit ee92961fe5
2 changed files with 4 additions and 6 deletions

View File

@ -222,10 +222,10 @@ def server_serial_console(request, instance_id, console_type='serial'):
@profiler.trace @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") microver = get_microversion(request, "remote_console_mks")
nc = _nova.novaclient(request, microver) 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']) return MKSConsole(console['remote_console'])

View File

@ -151,19 +151,17 @@ class ComputeApiTests(test.APIMockTestCase):
def test_server_mks_console(self, mock_novaclient): def test_server_mks_console(self, mock_novaclient):
server = self.servers.first() server = self.servers.first()
console = self.servers.mks_console_data console = self.servers.mks_console_data
console_type = console["remote_console"]["type"]
novaclient = mock_novaclient.return_value novaclient = mock_novaclient.return_value
self._mock_current_version(novaclient, '2.53') self._mock_current_version(novaclient, '2.53')
novaclient.servers.get_mks_console.return_value = console novaclient.servers.get_mks_console.return_value = console
ret_val = api.nova.server_mks_console(self.request, ret_val = api.nova.server_mks_console(self.request,
server.id, server.id)
console_type)
self.assertIsInstance(ret_val, api.nova.MKSConsole) self.assertIsInstance(ret_val, api.nova.MKSConsole)
novaclient.versions.get_current.assert_called_once_with() novaclient.versions.get_current.assert_called_once_with()
novaclient.servers.get_mks_console.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') @mock.patch.object(api._nova, 'novaclient')
def test_server_list(self, mock_novaclient): def test_server_list(self, mock_novaclient):