Blob Blame History Raw
From 92c2af7fd7fa73cce11a6b0a51aaa3c01caf7a17 Mon Sep 17 00:00:00 2001
From: Pavel Hrdina <phrdina@redhat.com>
Date: Thu, 23 Mar 2017 15:26:19 +0100
Subject: [virt-manager PATCH 1/6] graphics: skip authentication only for VNC
 with listen type none

This is in fact a bug in QEMU so we have to workaround this issue
to allow to connect to guest with VNC and listen type none.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit cb182f7e3a569bde926818a4c55bb8427fba2728)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 virtManager/domain.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/virtManager/domain.py b/virtManager/domain.py
index 3478cc58..fc5f54a6 100644
--- a/virtManager/domain.py
+++ b/virtManager/domain.py
@@ -1190,8 +1190,17 @@ class vmmDomain(vmmLibvirtObject):
         return self._backend.openConsole(devname, stream, flags)
 
     def open_graphics_fd(self):
-        return self._backend.openGraphicsFD(0,
-                libvirt.VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH)
+        flags = 0
+
+        # Ugly workaround for VNC bug where the display cannot be opened
+        # if the listen type is "none".  When this gets fixed in QEMU
+        # we should skip auth only for broken QEMUs.
+        graphics = self.get_graphics_devices()[0]
+        if (graphics.type == "vnc" and
+            graphics.get_first_listen_type() == "none"):
+            flags = libvirt.VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH
+
+        return self._backend.openGraphicsFD(0, flags)
 
     def refresh_snapshots(self):
         self._snapshot_list = None
-- 
2.12.2