[libvirt PATCH 2/2] qemu_migration: Fix p2p post-copy recovery

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

 



Although the qemuMigrationSrcPerformResume actually got called
indirectly via qemuMigrationSrcPerformNative and the recovery process
worked, wrong job phases were used for the "perform" phase, which could
cause issues when libvirt daemon crashed (or was otherwise restarted)
during post-copy recovery.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/qemu/qemu_migration.c | 41 +++++++++++++++++++++++----------------
 1 file changed, 24 insertions(+), 17 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index e8e0474558..9b98ffb527 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -5642,33 +5642,40 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriver *driver,
      * confirm migration completion.
      */
     VIR_DEBUG("Perform3 %p uri=%s", sconn, NULLSTR(uri));
-    ignore_value(qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_PERFORM3));
     VIR_FREE(cookiein);
     cookiein = g_steal_pointer(&cookieout);
     cookieinlen = cookieoutlen;
     cookieoutlen = 0;
-    if (flags & VIR_MIGRATE_TUNNELLED) {
-        ret = qemuMigrationSrcPerformTunnel(driver, vm, st, persist_xml,
+
+    if (flags & VIR_MIGRATE_POSTCOPY_RESUME) {
+        ret = qemuMigrationSrcPerformResume(driver, dconn, vm, uri, migParams,
                                             cookiein, cookieinlen,
-                                            &cookieout, &cookieoutlen,
-                                            flags, bandwidth, dconn, graphicsuri,
-                                            nmigrate_disks, migrate_disks,
-                                            migParams);
+                                            &cookieout, &cookieoutlen, flags);
     } else {
-        ret = qemuMigrationSrcPerformNative(driver, vm, persist_xml, uri,
-                                            cookiein, cookieinlen,
-                                            &cookieout, &cookieoutlen,
-                                            flags, bandwidth, dconn, graphicsuri,
-                                            nmigrate_disks, migrate_disks,
-                                            migParams, nbdURI);
+        ignore_value(qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_PERFORM3));
+        if (flags & VIR_MIGRATE_TUNNELLED) {
+            ret = qemuMigrationSrcPerformTunnel(driver, vm, st, persist_xml,
+                                                cookiein, cookieinlen,
+                                                &cookieout, &cookieoutlen,
+                                                flags, bandwidth, dconn, graphicsuri,
+                                                nmigrate_disks, migrate_disks,
+                                                migParams);
+        } else {
+            ret = qemuMigrationSrcPerformNative(driver, vm, persist_xml, uri,
+                                                cookiein, cookieinlen,
+                                                &cookieout, &cookieoutlen,
+                                                flags, bandwidth, dconn, graphicsuri,
+                                                nmigrate_disks, migrate_disks,
+                                                migParams, nbdURI);
+        }
+
+        if (ret == 0)
+            ignore_value(qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_PERFORM3_DONE));
     }
 
     /* Perform failed. Make sure Finish doesn't overwrite the error */
-    if (ret < 0) {
+    if (ret < 0)
         virErrorPreserveLast(&orig_err);
-    } else {
-        ignore_value(qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_PERFORM3_DONE));
-    }
 
     /* If Perform returns < 0, then we need to cancel the VM
      * startup on the destination
-- 
2.39.0




[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]

  Powered by Linux