]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: Don't format actual network definition in migratable XML
authorLuyao Huang <lhuang@redhat.com>
Thu, 25 Dec 2014 03:38:00 +0000 (11:38 +0800)
committerJiri Denemark <jdenemar@redhat.com>
Wed, 7 Jan 2015 12:11:02 +0000 (13:11 +0100)
https://bugzilla.redhat.com/show_bug.cgi?id=1177194

When migrate a vm, we will generate a xml via qemuDomainDefFormatLive and
pass this xml to target libvirtd. Libvirt will use the current network
state in def->data.network.actual to generate the xml, this will make
migrate failed when we set a network type guest interface use a macvtap
network as a source in a vm then migrate vm to another host(which has the
different macvtap network settings: different interface name, bridge name...)

Add a flag check in virDomainNetDefFormat, if we set a VIR_DOMAIN_XML_MIGRATABLE
flag when call virDomainNetDefFormat, we won't get the current vm interface
state.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
src/conf/domain_conf.c

index b9858cd519bb8d14881d43e1ccff277a4d164c75..d1a483add0aab56674c9fd197fc34e5b4879b268 100644 (file)
@@ -17705,18 +17705,23 @@ virDomainNetDefFormat(virBufferPtr buf,
                       virDomainNetDefPtr def,
                       unsigned int flags)
 {
-    /* publicActual is true if we should report the current state in
-     * def->data.network.actual *instead of* the config (*not* in
-     * addition to)
-     */
     unsigned int actualType = virDomainNetGetActualType(def);
-    bool publicActual
-       = (def->type == VIR_DOMAIN_NET_TYPE_NETWORK && def->data.network.actual &&
-          !(flags & (VIR_DOMAIN_XML_INACTIVE | VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET)));
+    bool publicActual = false;
     const char *typeStr;
     virDomainHostdevDefPtr hostdef = NULL;
     char macstr[VIR_MAC_STRING_BUFLEN];
 
+    /* publicActual is true if we should report the current state in
+     * def->data.network.actual *instead of* the config (*not* in
+     * addition to)
+     */
+    if (def->type == VIR_DOMAIN_NET_TYPE_NETWORK &&
+        def->data.network.actual &&
+        !(flags & (VIR_DOMAIN_XML_INACTIVE |
+                   VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET |
+                   VIR_DOMAIN_XML_MIGRATABLE)))
+        publicActual = true;
+
     if (publicActual) {
         if (!(typeStr = virDomainNetTypeToString(actualType))) {
             virReportError(VIR_ERR_INTERNAL_ERROR,