[PATCH 2/5] qemu: Copy completed migration stats only on success

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

 



The destination host gets detailed statistics about the current
migration form the source host via migration cookie and copies them to
the domain object so that they can be queried using
virDomainGetJobStats. However, we should only copy statistics to the
domain object when migration finished successfully.

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

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index c771db6..ff9491c 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -5671,6 +5671,10 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
 
         dom = virGetDomain(dconn, vm->def->name, vm->def->uuid);
     } else if (retcode == 0) {
+        unsigned long long timeReceived = 0;
+
+        ignore_value(virTimeMillisNow(&timeReceived));
+
         if (!virDomainObjIsActive(vm)) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("guest unexpectedly quit"));
@@ -5678,16 +5682,6 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
             goto endjob;
         }
 
-        if (mig->jobInfo) {
-            qemuDomainJobInfoPtr jobInfo = mig->jobInfo;
-            priv->job.completed = jobInfo;
-            mig->jobInfo = NULL;
-            if (jobInfo->sent && virTimeMillisNow(&jobInfo->received) == 0) {
-                jobInfo->timeDelta = jobInfo->received - jobInfo->sent;
-                jobInfo->timeDeltaSet = true;
-            }
-        }
-
         if (qemuMigrationVPAssociatePortProfiles(vm->def) < 0)
             goto endjob;
 
@@ -5745,7 +5739,16 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
             }
         }
 
-        if (priv->job.completed) {
+        if (mig->jobInfo) {
+            qemuDomainJobInfoPtr jobInfo = mig->jobInfo;
+            priv->job.completed = jobInfo;
+            mig->jobInfo = NULL;
+
+            if (jobInfo->sent && timeReceived) {
+                jobInfo->timeDelta = timeReceived - jobInfo->sent;
+                jobInfo->received = timeReceived;
+                jobInfo->timeDeltaSet = true;
+            }
             qemuDomainJobInfoUpdateTime(priv->job.completed);
             qemuDomainJobInfoUpdateDowntime(priv->job.completed);
         }
-- 
2.6.0

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