[libvirt] [PATCH 2/2] migration: Don't propagate VIR_MIGRATE_ABORT_ON_ERROR

Peter Krempa pkrempa at redhat.com
Wed Jun 12 14:11:22 UTC 2013


This flag is meant for errors happening on the source of the migration
and isn't used on the destination. To allow better migration
compatibility, don't propagate it to the destination.
---
 src/libvirt.c             | 17 +++++++++++------
 src/qemu/qemu_migration.c | 16 ++++++++++------
 2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/src/libvirt.c b/src/libvirt.c
index 620dbdd..57e1027 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -4554,6 +4554,8 @@ virDomainMigrateVersion1(virDomainPtr domain,
     char *cookie = NULL;
     int cookielen = 0, ret;
     virDomainInfo info;
+    unsigned int destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR;
+
     VIR_DOMAIN_DEBUG(domain,
                      "dconn=%p, flags=%lx, dname=%s, uri=%s, bandwidth=%lu",
                      dconn, flags, NULLSTR(dname), NULLSTR(uri), bandwidth);
@@ -4575,7 +4577,7 @@ virDomainMigrateVersion1(virDomainPtr domain,
      * the URI, it should leave uri_out as NULL.
      */
     if (dconn->driver->domainMigratePrepare
-        (dconn, &cookie, &cookielen, uri, &uri_out, flags, dname,
+        (dconn, &cookie, &cookielen, uri, &uri_out, destflags, dname,
          bandwidth) == -1)
         goto done;

@@ -4602,7 +4604,7 @@ virDomainMigrateVersion1(virDomainPtr domain,
     dname = dname ? dname : domain->name;
     if (dconn->driver->domainMigrateFinish)
         ddomain = dconn->driver->domainMigrateFinish
-            (dconn, dname, cookie, cookielen, uri, flags);
+            (dconn, dname, cookie, cookielen, uri, destflags);
     else
         ddomain = virDomainLookupByName(dconn, dname);

@@ -4648,6 +4650,8 @@ virDomainMigrateVersion2(virDomainPtr domain,
     virErrorPtr orig_err = NULL;
     unsigned int getxml_flags = 0;
     int cancelled;
+    unsigned int destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR;
+
     VIR_DOMAIN_DEBUG(domain,
                      "dconn=%p, flags=%lx, dname=%s, uri=%s, bandwidth=%lu",
                      dconn, flags, NULLSTR(dname), NULLSTR(uri), bandwidth);
@@ -4692,7 +4696,7 @@ virDomainMigrateVersion2(virDomainPtr domain,

     VIR_DEBUG("Prepare2 %p flags=%lx", dconn, flags);
     ret = dconn->driver->domainMigratePrepare2
-        (dconn, &cookie, &cookielen, uri, &uri_out, flags, dname,
+        (dconn, &cookie, &cookielen, uri, &uri_out, destflags, dname,
          bandwidth, dom_xml);
     VIR_FREE(dom_xml);
     if (ret == -1)
@@ -4732,7 +4736,7 @@ finish:
     dname = dname ? dname : domain->name;
     VIR_DEBUG("Finish2 %p ret=%d", dconn, ret);
     ddomain = dconn->driver->domainMigrateFinish2
-        (dconn, dname, cookie, cookielen, uri, flags, cancelled);
+        (dconn, dname, cookie, cookielen, uri, destflags, cancelled);

  done:
     if (orig_err) {
@@ -4791,6 +4795,7 @@ virDomainMigrateVersion3(virDomainPtr domain,
     int cancelled = 1;
     unsigned long protection = 0;
     bool notify_source = true;
+    unsigned int destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR;

     VIR_DOMAIN_DEBUG(domain, "dconn=%p xmlin=%s, flags=%lx, "
                      "dname=%s, uri=%s, bandwidth=%lu",
@@ -4830,7 +4835,7 @@ virDomainMigrateVersion3(virDomainPtr domain,
     cookieoutlen = 0;
     ret = dconn->driver->domainMigratePrepare3
         (dconn, cookiein, cookieinlen, &cookieout, &cookieoutlen,
-         uri, &uri_out, flags, dname, bandwidth, dom_xml);
+         uri, &uri_out, destflags, dname, bandwidth, dom_xml);
     VIR_FREE(dom_xml);
     if (ret == -1) {
         if (protection) {
@@ -4908,7 +4913,7 @@ finish:
     dname = dname ? dname : domain->name;
     ddomain = dconn->driver->domainMigrateFinish3
         (dconn, dname, cookiein, cookieinlen, &cookieout, &cookieoutlen,
-         NULL, uri, flags, cancelled);
+         NULL, uri, destflags, cancelled);

     /* If ddomain is NULL, then we were unable to start
      * the guest on the target, and must restart on the
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 281467b..16c8aac 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3165,6 +3165,8 @@ static int doPeer2PeerMigrate2(virQEMUDriverPtr driver,
     virErrorPtr orig_err = NULL;
     bool cancelled;
     virStreamPtr st = NULL;
+    unsigned int destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR;
+
     VIR_DEBUG("driver=%p, sconn=%p, dconn=%p, vm=%p, dconnuri=%s, "
               "flags=%lx, dname=%s, resource=%lu",
               driver, sconn, dconn, vm, NULLSTR(dconnuri),
@@ -3194,13 +3196,13 @@ static int doPeer2PeerMigrate2(virQEMUDriverPtr driver,

         qemuDomainObjEnterRemote(vm);
         ret = dconn->driver->domainMigratePrepareTunnel
-            (dconn, st, flags, dname, resource, dom_xml);
+            (dconn, st, destflags, dname, resource, dom_xml);
         qemuDomainObjExitRemote(vm);
     } else {
         qemuDomainObjEnterRemote(vm);
         ret = dconn->driver->domainMigratePrepare2
             (dconn, &cookie, &cookielen, NULL, &uri_out,
-             flags, dname, resource, dom_xml);
+             destflags, dname, resource, dom_xml);
         qemuDomainObjExitRemote(vm);
     }
     VIR_FREE(dom_xml);
@@ -3258,7 +3260,7 @@ finish:
     qemuDomainObjEnterRemote(vm);
     ddomain = dconn->driver->domainMigrateFinish2
         (dconn, dname, cookie, cookielen,
-         uri_out ? uri_out : dconnuri, flags, cancelled);
+         uri_out ? uri_out : dconnuri, destflags, cancelled);
     qemuDomainObjExitRemote(vm);

 cleanup:
@@ -3308,6 +3310,8 @@ static int doPeer2PeerMigrate3(virQEMUDriverPtr driver,
     virErrorPtr orig_err = NULL;
     bool cancelled;
     virStreamPtr st = NULL;
+    unsigned int destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR;
+
     VIR_DEBUG("driver=%p, sconn=%p, dconn=%p, vm=%p, xmlin=%s, "
               "dconnuri=%s, uri=%s, flags=%lx, dname=%s, resource=%lu",
               driver, sconn, dconn, vm, NULLSTR(xmlin),
@@ -3340,13 +3344,13 @@ static int doPeer2PeerMigrate3(virQEMUDriverPtr driver,
         ret = dconn->driver->domainMigratePrepareTunnel3
             (dconn, st, cookiein, cookieinlen,
              &cookieout, &cookieoutlen,
-             flags, dname, resource, dom_xml);
+             destflags, dname, resource, dom_xml);
         qemuDomainObjExitRemote(vm);
     } else {
         qemuDomainObjEnterRemote(vm);
         ret = dconn->driver->domainMigratePrepare3
             (dconn, cookiein, cookieinlen, &cookieout, &cookieoutlen,
-             uri, &uri_out, flags, dname, resource, dom_xml);
+             uri, &uri_out, destflags, dname, resource, dom_xml);
         qemuDomainObjExitRemote(vm);
     }
     VIR_FREE(dom_xml);
@@ -3422,7 +3426,7 @@ finish:
     qemuDomainObjEnterRemote(vm);
     ddomain = dconn->driver->domainMigrateFinish3
         (dconn, dname, cookiein, cookieinlen, &cookieout, &cookieoutlen,
-         dconnuri, uri_out ? uri_out : uri, flags, cancelled);
+         dconnuri, uri_out ? uri_out : uri, destflags, cancelled);
     qemuDomainObjExitRemote(vm);

     /* If ddomain is NULL, then we were unable to start
-- 
1.8.2.1




More information about the libvir-list mailing list