File libvirt-migration-Don-t-propagate-VIR_MIGRATE_ABORT_ON_ERROR.patch of Package libvirt

From 83dfa37d6855f883c48dd83264860e917ce295a5 Mon Sep 17 00:00:00 2001
Message-Id: <83dfa37d6855f883c48dd83264860e917ce295a5.1373885147.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Thu, 4 Jul 2013 11:50:24 +0200
Subject: [PATCH] migration: Don't propagate VIR_MIGRATE_ABORT_ON_ERROR

https://bugzilla.redhat.com/show_bug.cgi?id=972675

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.
(cherry picked from commit 5379bb0f33f1529f530a40958a10e8f02eb868bb)

Conflicts:
	src/libvirt.c - driver lock still exists
	src/qemu/qemu_migration.c - driver lock still exists
---
 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 f4d2fe7..73b3cae 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -4524,6 +4524,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);
@@ -4545,7 +4547,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;
 
@@ -4572,7 +4574,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);
 
@@ -4618,6 +4620,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);
@@ -4662,7 +4666,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)
@@ -4702,7 +4706,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) {
@@ -4761,6 +4765,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",
@@ -4800,7 +4805,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) {
@@ -4870,7 +4875,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 cf90eae..9c39d1a 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2370,6 +2370,8 @@ static int doPeer2PeerMigrate2(struct qemud_driver *driver,
     virErrorPtr orig_err = NULL;
     int 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),
@@ -2399,13 +2401,13 @@ static int doPeer2PeerMigrate2(struct qemud_driver *driver,
 
         qemuDomainObjEnterRemoteWithDriver(driver, vm);
         ret = dconn->driver->domainMigratePrepareTunnel
-            (dconn, st, flags, dname, resource, dom_xml);
+            (dconn, st, destflags, dname, resource, dom_xml);
         qemuDomainObjExitRemoteWithDriver(driver, vm);
     } else {
         qemuDomainObjEnterRemoteWithDriver(driver, vm);
         ret = dconn->driver->domainMigratePrepare2
             (dconn, &cookie, &cookielen, NULL, &uri_out,
-             flags, dname, resource, dom_xml);
+             destflags, dname, resource, dom_xml);
         qemuDomainObjExitRemoteWithDriver(driver, vm);
     }
     VIR_FREE(dom_xml);
@@ -2463,7 +2465,7 @@ finish:
     qemuDomainObjEnterRemoteWithDriver(driver, vm);
     ddomain = dconn->driver->domainMigrateFinish2
         (dconn, dname, cookie, cookielen,
-         uri_out ? uri_out : dconnuri, flags, cancelled);
+         uri_out ? uri_out : dconnuri, destflags, cancelled);
     qemuDomainObjExitRemoteWithDriver(driver, vm);
 
 cleanup:
@@ -2513,6 +2515,8 @@ static int doPeer2PeerMigrate3(struct qemud_driver *driver,
     virErrorPtr orig_err = NULL;
     int 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),
@@ -2545,13 +2549,13 @@ static int doPeer2PeerMigrate3(struct qemud_driver *driver,
         ret = dconn->driver->domainMigratePrepareTunnel3
             (dconn, st, cookiein, cookieinlen,
              &cookieout, &cookieoutlen,
-             flags, dname, resource, dom_xml);
+             destflags, dname, resource, dom_xml);
         qemuDomainObjExitRemoteWithDriver(driver, vm);
     } else {
         qemuDomainObjEnterRemoteWithDriver(driver, 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);
         qemuDomainObjExitRemoteWithDriver(driver, vm);
     }
     VIR_FREE(dom_xml);
@@ -2619,7 +2623,7 @@ finish:
     qemuDomainObjEnterRemoteWithDriver(driver, 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);
     qemuDomainObjExitRemoteWithDriver(driver, vm);
 
     /* If ddomain is NULL, then we were unable to start
-- 
1.8.3.2

openSUSE Build Service is sponsored by