[PATCH] Paused domain should remain paused after migration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

If a domain is paused before migration starts, we need to tell that to
the destination libvirtd to prevent it from resuming the domain at the
end of migration. This regression was introduced by commit 5379bb0.
---
 src/libvirt.c             | 22 +++++++++++++---------
 src/qemu/qemu_migration.c |  9 ++++++---
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/src/libvirt.c b/src/libvirt.c
index bc1694a..8e19c64 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -4563,16 +4563,17 @@ virDomainMigrateVersion1(virDomainPtr domain,
     char *cookie = NULL;
     int cookielen = 0, ret;
     virDomainInfo info;
-    unsigned int destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR;
+    unsigned int destflags;
 
     VIR_DOMAIN_DEBUG(domain,
                      "dconn=%p, flags=%lx, dname=%s, uri=%s, bandwidth=%lu",
                      dconn, flags, NULLSTR(dname), NULLSTR(uri), bandwidth);
 
     ret = virDomainGetInfo(domain, &info);
-    if (ret == 0 && info.state == VIR_DOMAIN_PAUSED) {
+    if (ret == 0 && info.state == VIR_DOMAIN_PAUSED)
         flags |= VIR_MIGRATE_PAUSED;
-    }
+
+    destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR;
 
     /* Prepare the migration.
      *
@@ -4659,7 +4660,7 @@ virDomainMigrateVersion2(virDomainPtr domain,
     virErrorPtr orig_err = NULL;
     unsigned int getxml_flags = 0;
     int cancelled;
-    unsigned int destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR;
+    unsigned long destflags;
 
     VIR_DOMAIN_DEBUG(domain,
                      "dconn=%p, flags=%lx, dname=%s, uri=%s, bandwidth=%lu",
@@ -4699,11 +4700,12 @@ virDomainMigrateVersion2(virDomainPtr domain,
         return NULL;
 
     ret = virDomainGetInfo(domain, &info);
-    if (ret == 0 && info.state == VIR_DOMAIN_PAUSED) {
+    if (ret == 0 && info.state == VIR_DOMAIN_PAUSED)
         flags |= VIR_MIGRATE_PAUSED;
-    }
 
-    VIR_DEBUG("Prepare2 %p flags=%lx", dconn, flags);
+    destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR;
+
+    VIR_DEBUG("Prepare2 %p flags=%lx", dconn, destflags);
     ret = dconn->driver->domainMigratePrepare2
         (dconn, &cookie, &cookielen, uri, &uri_out, destflags, dname,
          bandwidth, dom_xml);
@@ -4811,7 +4813,7 @@ virDomainMigrateVersion3Full(virDomainPtr domain,
     int cancelled = 1;
     unsigned long protection = 0;
     bool notify_source = true;
-    unsigned int destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR;
+    unsigned int destflags;
     int state;
     virTypedParameterPtr tmp;
 
@@ -4870,7 +4872,9 @@ virDomainMigrateVersion3Full(virDomainPtr domain,
     if (ret == 0 && state == VIR_DOMAIN_PAUSED)
         flags |= VIR_MIGRATE_PAUSED;
 
-    VIR_DEBUG("Prepare3 %p flags=%x", dconn, flags);
+    destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR;
+
+    VIR_DEBUG("Prepare3 %p flags=%x", dconn, destflags);
     cookiein = cookieout;
     cookieinlen = cookieoutlen;
     cookieout = NULL;
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 49e9e65..6b488ca 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3503,7 +3503,7 @@ static int doPeer2PeerMigrate2(virQEMUDriverPtr driver,
     virErrorPtr orig_err = NULL;
     bool cancelled;
     virStreamPtr st = NULL;
-    unsigned int destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR;
+    unsigned long destflags;
 
     VIR_DEBUG("driver=%p, sconn=%p, dconn=%p, vm=%p, dconnuri=%s, "
               "flags=%lx, dname=%s, resource=%lu",
@@ -3522,6 +3522,8 @@ static int doPeer2PeerMigrate2(virQEMUDriverPtr driver,
     if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED)
         flags |= VIR_MIGRATE_PAUSED;
 
+    destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR;
+
     VIR_DEBUG("Prepare2 %p", dconn);
     if (flags & VIR_MIGRATE_TUNNELLED) {
         /*
@@ -3651,8 +3653,7 @@ doPeer2PeerMigrate3(virQEMUDriverPtr driver,
     virErrorPtr orig_err = NULL;
     bool cancelled = true;
     virStreamPtr st = NULL;
-    unsigned int destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR;
-
+    unsigned long destflags;
     virTypedParameterPtr params = NULL;
     int nparams = 0;
     int maxparams = 0;
@@ -3705,6 +3706,8 @@ doPeer2PeerMigrate3(virQEMUDriverPtr driver,
     if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED)
         flags |= VIR_MIGRATE_PAUSED;
 
+    destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR;
+
     VIR_DEBUG("Prepare3 %p", dconn);
     cookiein = cookieout;
     cookieinlen = cookieoutlen;
-- 
1.8.2.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]