[virt-tools-list] [virt-manager PATCH] cli: append "--attach" to virt-viewer if graphics has listen type none

Pavel Hrdina phrdina at redhat.com
Fri Jan 5 08:26:40 UTC 2018


Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1527834

Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 virtinst/cli.py   | 4 ++--
 virtinst/guest.py | 7 +++++++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/virtinst/cli.py b/virtinst/cli.py
index cfe5ff07..b0e4fab5 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -442,8 +442,8 @@ def _gfx_console(guest):
             "--wait", guest.name]
 
     # Currently virt-viewer needs attaching to the local display while
-    # spice gl is enabled.
-    if guest.has_gl():
+    # spice gl is enabled or listen type none is used.
+    if guest.has_gl() or guest.has_listen_none():
         args.append("--attach")
 
     logging.debug("Launching virt-viewer for graphics type '%s'",
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 5b3b9d1f..903ee188 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -1243,6 +1243,13 @@ class Guest(XMLBuilder):
             if gfx.gl:
                 return True
 
+    def has_listen_none(self):
+        for gfx in self.get_devices("graphics"):
+            listen = gfx.get_first_listen_type()
+            if listen and listen == "none":
+                return True
+        return False
+
     def _set_video_defaults(self):
         if self.has_spice():
             self._add_spice_channels()
-- 
2.14.3




More information about the virt-tools-list mailing list