[RFC PATCH] virt-manager: console disconnected after rebooting virtual machine in Xen mode

Charles Arnold carnold at suse.com
Wed Oct 13 19:30:31 UTC 2021

Running with virt-manager 3.2.0, not a problem in 2.2.1.

When rebooting an HVM guest on Xen, virt-manager gets a disconnected
event which closes the viewer. See
self._viewer.connect("disconnected", self._viewer_disconnected).
Running on KVM, this event does not seem to occur on VM reboot.

Both Xen and KVM get a state changed event,
self.vm.connect("state-changed", self._vm_state_changed_cb)
but for Xen, the viewer is gone due to the prior disconnect and when
calling into _activate_default_console_page(), the viewer does not
exist nor does it get created.
The VM comes up fine but you need to close the console window and
open it again to see the running VM.

This patch resolves the issue for me.

diff --git a/virtManager/details/console.py 
index fafb7202..f8a005ee 100644
--- a/virtManager/details/console.py
+++ b/virtManager/details/console.py
@@ -913,6 +913,8 @@ class vmmConsolePages(vmmGObjectUI):

          cpage = self.widget("console-pages").get_current_page()
+        if cpage == _CONSOLE_PAGE_GRAPHICS:
+            self._init_viewer()
          if cpage != _CONSOLE_PAGE_UNAVAILABLE:

More information about the virt-tools-list mailing list