render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Blob Blame History Raw
From 39f02fffffa1d7686cedd9ba5fcdce05d312676d Mon Sep 17 00:00:00 2001
Message-Id: <39f02fffffa1d7686cedd9ba5fcdce05d312676d@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Thu, 28 Aug 2014 16:39:58 +0200
Subject: [PATCH] qemu: Transfer recomputed stats back to source

After the previous commit, migration statistics on the source and
destination hosts are not equal because the destination updated time
statistics. Let's send the result back so that the same data can be
queried on both sides of the migration.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit a1c0180d0eba1f29a2ff0b970b4dec470fd1c1ed)

https://bugzilla.redhat.com/show_bug.cgi?id=1063724
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/qemu/qemu_migration.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index c7a41b1..3934566 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3019,9 +3019,27 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver,
                              ? QEMU_MIGRATION_PHASE_CONFIRM3
                              : QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED);
 
-    if (!(mig = qemuMigrationEatCookie(driver, vm, cookiein, cookieinlen, 0)))
+    if (!(mig = qemuMigrationEatCookie(driver, vm, cookiein, cookieinlen,
+                                       QEMU_MIGRATION_COOKIE_STATS)))
         goto cleanup;
 
+    /* Update total times with the values sent by the destination daemon */
+    if (mig->jobInfo) {
+        qemuDomainObjPrivatePtr priv = vm->privateData;
+        if (priv->job.completed) {
+            qemuDomainJobInfoPtr jobInfo = priv->job.completed;
+            if (mig->jobInfo->status.downtime_set) {
+                jobInfo->status.downtime = mig->jobInfo->status.downtime;
+                jobInfo->status.downtime_set = true;
+            }
+            if (mig->jobInfo->timeElapsed)
+                jobInfo->timeElapsed = mig->jobInfo->timeElapsed;
+        } else {
+            priv->job.completed = mig->jobInfo;
+            mig->jobInfo = NULL;
+        }
+    }
+
     if (flags & VIR_MIGRATE_OFFLINE)
         goto done;
 
@@ -4860,7 +4878,8 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
                                          VIR_DOMAIN_EVENT_STOPPED_FAILED);
     }
 
-    if (qemuMigrationBakeCookie(mig, driver, vm, cookieout, cookieoutlen, 0) < 0)
+    if (qemuMigrationBakeCookie(mig, driver, vm, cookieout, cookieoutlen,
+                                QEMU_MIGRATION_COOKIE_STATS) < 0)
         VIR_WARN("Unable to encode migration cookie");
 
  endjob:
-- 
2.1.0