[PATCH v2 2/7] qemu: Properly update completed migration stats

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

 



We should not overwrite all migration statistics on the source with the
numbers sent by the destination since the source may have an updated
view in some cases (such as post-copy migration). It's safer to update
just the timing info we need to get from the destination and be prepared
for the future. And we should only do all this after a successful
migration.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---

Notes:
    Version 2:
    - do not touch jobInfo->type

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

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 97e98bb..d587bb6 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3867,6 +3867,8 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver,
     virObjectEventPtr event = NULL;
     int rv = -1;
     virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+    qemuDomainObjPrivatePtr priv = vm->privateData;
+    qemuDomainJobInfoPtr jobInfo = NULL;
 
     VIR_DEBUG("driver=%p, conn=%p, vm=%p, cookiein=%s, cookieinlen=%d, "
               "flags=%x, retcode=%d",
@@ -3884,12 +3886,18 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver,
                                        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 (retcode == 0)
+        jobInfo = priv->job.completed;
+    else
         VIR_FREE(priv->job.completed);
-        priv->job.completed = mig->jobInfo;
-        mig->jobInfo = NULL;
+
+    /* Update times with the values sent by the destination daemon */
+    if (mig->jobInfo && jobInfo) {
+        qemuDomainJobInfoUpdateTime(jobInfo);
+        jobInfo->timeDeltaSet = mig->jobInfo->timeDeltaSet;
+        jobInfo->timeDelta = mig->jobInfo->timeDelta;
+        jobInfo->stats.downtime_set = mig->jobInfo->stats.downtime_set;
+        jobInfo->stats.downtime = mig->jobInfo->stats.downtime;
     }
 
     if (flags & VIR_MIGRATE_OFFLINE)
-- 
2.7.2

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