9119d9
From 39f02fffffa1d7686cedd9ba5fcdce05d312676d Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <39f02fffffa1d7686cedd9ba5fcdce05d312676d@dist-git>
9119d9
From: Jiri Denemark <jdenemar@redhat.com>
9119d9
Date: Thu, 28 Aug 2014 16:39:58 +0200
9119d9
Subject: [PATCH] qemu: Transfer recomputed stats back to source
9119d9
9119d9
After the previous commit, migration statistics on the source and
9119d9
destination hosts are not equal because the destination updated time
9119d9
statistics. Let's send the result back so that the same data can be
9119d9
queried on both sides of the migration.
9119d9
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
(cherry picked from commit a1c0180d0eba1f29a2ff0b970b4dec470fd1c1ed)
9119d9
9119d9
https://bugzilla.redhat.com/show_bug.cgi?id=1063724
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 src/qemu/qemu_migration.c | 23 +++++++++++++++++++++--
9119d9
 1 file changed, 21 insertions(+), 2 deletions(-)
9119d9
9119d9
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
9119d9
index c7a41b1..3934566 100644
9119d9
--- a/src/qemu/qemu_migration.c
9119d9
+++ b/src/qemu/qemu_migration.c
9119d9
@@ -3019,9 +3019,27 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver,
9119d9
                              ? QEMU_MIGRATION_PHASE_CONFIRM3
9119d9
                              : QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED);
9119d9
 
9119d9
-    if (!(mig = qemuMigrationEatCookie(driver, vm, cookiein, cookieinlen, 0)))
9119d9
+    if (!(mig = qemuMigrationEatCookie(driver, vm, cookiein, cookieinlen,
9119d9
+                                       QEMU_MIGRATION_COOKIE_STATS)))
9119d9
         goto cleanup;
9119d9
 
9119d9
+    /* Update total times with the values sent by the destination daemon */
9119d9
+    if (mig->jobInfo) {
9119d9
+        qemuDomainObjPrivatePtr priv = vm->privateData;
9119d9
+        if (priv->job.completed) {
9119d9
+            qemuDomainJobInfoPtr jobInfo = priv->job.completed;
9119d9
+            if (mig->jobInfo->status.downtime_set) {
9119d9
+                jobInfo->status.downtime = mig->jobInfo->status.downtime;
9119d9
+                jobInfo->status.downtime_set = true;
9119d9
+            }
9119d9
+            if (mig->jobInfo->timeElapsed)
9119d9
+                jobInfo->timeElapsed = mig->jobInfo->timeElapsed;
9119d9
+        } else {
9119d9
+            priv->job.completed = mig->jobInfo;
9119d9
+            mig->jobInfo = NULL;
9119d9
+        }
9119d9
+    }
9119d9
+
9119d9
     if (flags & VIR_MIGRATE_OFFLINE)
9119d9
         goto done;
9119d9
 
9119d9
@@ -4860,7 +4878,8 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
9119d9
                                          VIR_DOMAIN_EVENT_STOPPED_FAILED);
9119d9
     }
9119d9
 
9119d9
-    if (qemuMigrationBakeCookie(mig, driver, vm, cookieout, cookieoutlen, 0) < 0)
9119d9
+    if (qemuMigrationBakeCookie(mig, driver, vm, cookieout, cookieoutlen,
9119d9
+                                QEMU_MIGRATION_COOKIE_STATS) < 0)
9119d9
         VIR_WARN("Unable to encode migration cookie");
9119d9
 
9119d9
  endjob:
9119d9
-- 
9119d9
2.1.0
9119d9