Blame SOURCES/libvirt-conf-fix-migratable-XML-for-graphics-if-socket-is-generated-based-on-config.patch

404507
From a1c433306e79ec6b5c0ca4b3e3243875ccabdeb2 Mon Sep 17 00:00:00 2001
404507
Message-Id: <a1c433306e79ec6b5c0ca4b3e3243875ccabdeb2@dist-git>
404507
From: Pavel Hrdina <phrdina@redhat.com>
404507
Date: Thu, 30 Nov 2017 17:56:41 +0100
404507
Subject: [PATCH] conf: fix migratable XML for graphics if socket is generated
404507
 based on config
404507
404507
The graphics code is complex and there are a lot of exceptions and
404507
backward compatible combinations.  One of them is the possibility
404507
to configure "spice_auto_unix_socket" in qemu.conf which will convert
404507
all spice graphics with listen type "address" without any address
404507
specified to listen type "socket" when the guest is started.
404507
404507
We don't format this generated socket into migratable XML to make
404507
migration work with older libvirt.  However, spice has another
404507
exception that if autoport='no' and there is no port configured
404507
it is converted to listen type "none".  Because of this we need
404507
to format autoport='yes' to make sure that the listen type will
404507
be the same as the offline XML.
404507
404507
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1511407
404507
404507
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
404507
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
404507
(cherry picked from commit cb06ea57ad80a964028f22fb49d6ab96648ae741)
404507
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
404507
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
404507
---
404507
 src/conf/domain_conf.c | 12 ++++++++++++
404507
 1 file changed, 12 insertions(+)
404507
404507
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
404507
index c58dae197c..ec138ea861 100644
404507
--- a/src/conf/domain_conf.c
404507
+++ b/src/conf/domain_conf.c
404507
@@ -25150,6 +25150,18 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
404507
             break;
404507
 
404507
         case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET:
404507
+            /* If socket is auto-generated based on config option we don't
404507
+             * add any listen element into migratable XML because the original
404507
+             * listen type is "address".
404507
+             * We need to set autoport to make sure that libvirt on destination
404507
+             * will parse it as listen type "address", without autoport it is
404507
+             * parsed as listen type "none". */
404507
+            if ((flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE) &&
404507
+                glisten->fromConfig) {
404507
+                virBufferAddStr(buf, " autoport='yes'");
404507
+            }
404507
+            break;
404507
+
404507
         case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST:
404507
             break;
404507
         }
404507
-- 
404507
2.15.1
404507