From dc1c9982654f5f7a5aeac2f574969d851d4093d8 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Mon, 11 Nov 2024 14:04:37 -0500 Subject: [PATCH] console: Handle autoconnect=off for serial console too Fixes: https://github.com/virt-manager/virt-manager/issues/584 Signed-off-by: Cole Robinson --- ui/console.ui | 54 +++++++++++++++++----------------- virtManager/details/console.py | 17 +++++++---- 2 files changed, 38 insertions(+), 33 deletions(-) diff --git a/ui/console.ui b/ui/console.ui index b4d5fcb00..c8ca40028 100644 --- a/ui/console.ui +++ b/ui/console.ui @@ -1,5 +1,5 @@ - + @@ -253,32 +253,6 @@ False - - - _Connect to console - True - True - True - center - center - True - - - - 3 - - - - - True - False - Connect - - - 3 - False - - 2 @@ -295,6 +269,32 @@ False + + + _Connect to console + True + True + True + center + center + True + + + + 3 + + + + + True + False + Connect + + + 3 + False + + console-pages diff --git a/virtManager/details/console.py b/virtManager/details/console.py index c183d6894..28b69958b 100644 --- a/virtManager/details/console.py +++ b/virtManager/details/console.py @@ -20,13 +20,13 @@ from ..lib.keyring import vmmKeyring # console-pages IDs (_CONSOLE_PAGE_UNAVAILABLE, _CONSOLE_PAGE_SERIAL, - _CONSOLE_PAGE_GRAPHICS) = range(3) + _CONSOLE_PAGE_GRAPHICS, + _CONSOLE_PAGE_CONNECT) = range(4) # console-gfx-pages IDs (_GFX_PAGE_VIEWER, _GFX_PAGE_AUTH, - _GFX_PAGE_UNAVAILABLE, - _GFX_PAGE_CONNECT) = range(4) + _GFX_PAGE_UNAVAILABLE) = range(3) class _TimedRevealer(vmmGObject): @@ -625,8 +625,8 @@ class vmmConsolePages(vmmGObjectUI): if self._viewer: self._viewer.console_grab_focus() - def _activate_gfx_connect_page(self): - self.widget("console-gfx-pages").set_current_page(_GFX_PAGE_CONNECT) + def _activate_console_connect_page(self): + self.widget("console-pages").set_current_page(_CONSOLE_PAGE_CONNECT) def _viewer_is_visible(self): is_visible = self.widget("console-pages").is_visible() @@ -659,7 +659,7 @@ class vmmConsolePages(vmmGObjectUI): if (not self.vm.get_console_autoconnect() and not self._viewer_connect_clicked): - self._activate_gfx_connect_page() + self._activate_console_connect_page() return self._activate_gfx_unavailable_page( @@ -856,6 +856,11 @@ class vmmConsolePages(vmmGObjectUI): self.widget("serial-pages").append_page(serial.get_box(), title) self._serial_consoles.append(serial) + if (not self.vm.get_console_autoconnect() and + not self._viewer_connect_clicked): + self._activate_console_connect_page() + return + serial.open_console() page_idx = self._serial_consoles.index(serial) self.widget("console-pages").set_current_page(_CONSOLE_PAGE_SERIAL)