7a3408
From 180a82fb0eb876cd8d42aedb4ecf05f0423ffe9b Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <180a82fb0eb876cd8d42aedb4ecf05f0423ffe9b@dist-git>
7a3408
From: Jiri Denemark <jdenemar@redhat.com>
7a3408
Date: Wed, 23 Sep 2015 14:48:06 +0200
7a3408
Subject: [PATCH] domain: Fix migratable XML with graphics/@listen
7a3408
7a3408
As of commit 6992994, we set graphics/@listen attribute according to the
7a3408
first listen child element even if that element is of type='network'.
7a3408
This was done for backward compatibility with applications which only
7a3408
support the original listen attribute. However, by doing so we broke
7a3408
migration to older libvirt which tried to check that the listen
7a3408
attribute matches one of the listen child elements but which did not
7a3408
take type='network' elements into account.
7a3408
7a3408
We are not concerned about compatibility with old applications when
7a3408
formatting domain XML for migration for two reasons. The XML is consumed
7a3408
only by libvirtd and the IP address associated with type='network'
7a3408
listen address on the source host is just useless on the destination
7a3408
host. Thus, we can safely avoid propagating the type='network' IP
7a3408
address to graphics/@listen attribute when creating migratable XML.
7a3408
7a3408
https://bugzilla.redhat.com/show_bug.cgi?id=1265111
7a3408
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
(cherry picked from commit c0806dc30bda562810b0d686e33c903862e3c8f1)
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/conf/domain_conf.c | 16 +++++++---------
7a3408
 1 file changed, 7 insertions(+), 9 deletions(-)
7a3408
7a3408
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
7a3408
index f5320fe..a0ecc94 100644
7a3408
--- a/src/conf/domain_conf.c
7a3408
+++ b/src/conf/domain_conf.c
7a3408
@@ -20824,19 +20824,17 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
7a3408
     * <graphics>. This is done to improve backward compatibility.
7a3408
     */
7a3408
     for (i = 0; i < def->nListens; i++) {
7a3408
-        virDomainGraphicsListenType listenType;
7a3408
-
7a3408
         if (flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE &&
7a3408
             def->listens[i].fromConfig)
7a3408
             continue;
7a3408
-        listenType = virDomainGraphicsListenGetType(def, i);
7a3408
 
7a3408
-        if (listenType == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS ||
7a3408
-            (listenType == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK &&
7a3408
-             !(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE))) {
7a3408
-            if ((listenAddr = virDomainGraphicsListenGetAddress(def, i)))
7a3408
-                break;
7a3408
-        }
7a3408
+        if (def->listens[i].type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK &&
7a3408
+            flags & (VIR_DOMAIN_DEF_FORMAT_INACTIVE |
7a3408
+                     VIR_DOMAIN_DEF_FORMAT_MIGRATABLE))
7a3408
+            continue;
7a3408
+
7a3408
+        if ((listenAddr = virDomainGraphicsListenGetAddress(def, i)))
7a3408
+            break;
7a3408
     }
7a3408
 
7a3408
     virBufferAsprintf(buf, "
7a3408
-- 
7a3408
2.5.3
7a3408