[libvirt PATCH v2 26/81] qemu: Generate migration cookie in Finish phase earlier

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

 



The final part of Finish phase will be refactored into a dedicated
function and we don't want to generate the cookie there.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
Reviewed-by: Peter Krempa <pkrempa@xxxxxxxxxx>
Reviewed-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---

Notes:
    Version 2:
    - no change

 src/qemu/qemu_migration.c | 38 ++++++++++++++++++++------------------
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 792033daa0..170caf77e7 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -5948,12 +5948,27 @@ qemuMigrationDstFinish(virQEMUDriver *driver,
         qemuDomainJobDataUpdateDowntime(jobData);
     }
 
+    if (inPostCopy &&
+        qemuMigrationDstWaitForCompletion(driver, vm,
+                                          VIR_ASYNC_JOB_MIGRATION_IN,
+                                          false) < 0) {
+        goto error;
+    }
+
+    if (jobData) {
+        priv->job.completed = g_steal_pointer(&jobData);
+        priv->job.completed->status = VIR_DOMAIN_JOB_STATUS_COMPLETED;
+        qemuDomainJobSetStatsType(priv->job.completed,
+                                  QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION);
+    }
+
+    if (qemuMigrationCookieFormat(mig, driver, vm,
+                                  QEMU_MIGRATION_DESTINATION,
+                                  cookieout, cookieoutlen,
+                                  QEMU_MIGRATION_COOKIE_STATS) < 0)
+        VIR_WARN("Unable to encode migration cookie");
+
     if (inPostCopy) {
-        if (qemuMigrationDstWaitForCompletion(driver, vm,
-                                              VIR_ASYNC_JOB_MIGRATION_IN,
-                                              false) < 0) {
-            goto error;
-        }
         if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
             virDomainObjSetState(vm,
                                  VIR_DOMAIN_RUNNING,
@@ -5987,19 +6002,6 @@ qemuMigrationDstFinish(virQEMUDriver *driver,
     /* Guest is successfully running, so cancel previous auto destroy */
     qemuProcessAutoDestroyRemove(driver, vm);
 
-    if (jobData) {
-        priv->job.completed = g_steal_pointer(&jobData);
-        priv->job.completed->status = VIR_DOMAIN_JOB_STATUS_COMPLETED;
-        qemuDomainJobSetStatsType(priv->job.completed,
-                                  QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION);
-    }
-
-    if (qemuMigrationCookieFormat(mig, driver, vm,
-                                  QEMU_MIGRATION_DESTINATION,
-                                  cookieout, cookieoutlen,
-                                  QEMU_MIGRATION_COOKIE_STATS) < 0)
-        VIR_WARN("Unable to encode migration cookie");
-
     /* Remove completed stats for post-copy, everything but timing fields
      * is obsolete anyway.
      */
-- 
2.35.1




[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