render / rpms / libvirt

Forked from rpms/libvirt 11 months ago
Clone
9119d9
From 0373f12faad115fd5ff148ec7b4952a04e9bbdd9 Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <0373f12faad115fd5ff148ec7b4952a04e9bbdd9@dist-git>
9119d9
From: Luyao Huang <lhuang@redhat.com>
9119d9
Date: Thu, 25 Dec 2014 11:38:00 +0800
9119d9
Subject: [PATCH] conf: Don't format actual network definition in migratable
9119d9
 XML
9119d9
9119d9
https://bugzilla.redhat.com/show_bug.cgi?id=1177194
9119d9
9119d9
When migrate a vm, we will generate a xml via qemuDomainDefFormatLive and
9119d9
pass this xml to target libvirtd. Libvirt will use the current network
9119d9
state in def->data.network.actual to generate the xml, this will make
9119d9
migrate failed when we set a network type guest interface use a macvtap
9119d9
network as a source in a vm then migrate vm to another host(which has the
9119d9
different macvtap network settings: different interface name, bridge name...)
9119d9
9119d9
Add a flag check in virDomainNetDefFormat, if we set a VIR_DOMAIN_XML_MIGRATABLE
9119d9
flag when call virDomainNetDefFormat, we won't get the current vm interface
9119d9
state.
9119d9
9119d9
Signed-off-by: Luyao Huang <lhuang@redhat.com>
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
(cherry picked from commit db19a4a3c6f72e464bc3ad00e904d8df13887382)
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 src/conf/domain_conf.c | 19 ++++++++++++-------
9119d9
 1 file changed, 12 insertions(+), 7 deletions(-)
9119d9
9119d9
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
9119d9
index 8c161b5..bbd204a 100644
9119d9
--- a/src/conf/domain_conf.c
9119d9
+++ b/src/conf/domain_conf.c
9119d9
@@ -16977,18 +16977,23 @@ virDomainNetDefFormat(virBufferPtr buf,
9119d9
                       virDomainNetDefPtr def,
9119d9
                       unsigned int flags)
9119d9
 {
9119d9
-    /* publicActual is true if we should report the current state in
9119d9
-     * def->data.network.actual *instead of* the config (*not* in
9119d9
-     * addition to)
9119d9
-     */
9119d9
     unsigned int actualType = virDomainNetGetActualType(def);
9119d9
-    bool publicActual
9119d9
-       = (def->type == VIR_DOMAIN_NET_TYPE_NETWORK && def->data.network.actual &&
9119d9
-          !(flags & (VIR_DOMAIN_XML_INACTIVE | VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET)));
9119d9
+    bool publicActual = false;
9119d9
     const char *typeStr;
9119d9
     virDomainHostdevDefPtr hostdef = NULL;
9119d9
     char macstr[VIR_MAC_STRING_BUFLEN];
9119d9
 
9119d9
+    /* publicActual is true if we should report the current state in
9119d9
+     * def->data.network.actual *instead of* the config (*not* in
9119d9
+     * addition to)
9119d9
+     */
9119d9
+    if (def->type == VIR_DOMAIN_NET_TYPE_NETWORK &&
9119d9
+        def->data.network.actual &&
9119d9
+        !(flags & (VIR_DOMAIN_XML_INACTIVE |
9119d9
+                   VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET |
9119d9
+                   VIR_DOMAIN_XML_MIGRATABLE)))
9119d9
+        publicActual = true;
9119d9
+
9119d9
     if (publicActual) {
9119d9
         if (!(typeStr = virDomainNetTypeToString(actualType))) {
9119d9
             virReportError(VIR_ERR_INTERNAL_ERROR,
9119d9
-- 
9119d9
2.2.1
9119d9