render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
7a3408
From 7d1f7fce8d06ca2154be5f0a6f9a07bddcfac794 Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <7d1f7fce8d06ca2154be5f0a6f9a07bddcfac794@dist-git>
7a3408
From: Jiri Denemark <jdenemar@redhat.com>
7a3408
Date: Thu, 1 Oct 2015 21:54:38 +0200
7a3408
Subject: [PATCH] qemu: Copy completed migration stats only on success
7a3408
7a3408
The destination host gets detailed statistics about the current
7a3408
migration form the source host via migration cookie and copies them to
7a3408
the domain object so that they can be queried using
7a3408
virDomainGetJobStats. However, we should only copy statistics to the
7a3408
domain object when migration finished successfully.
7a3408
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
(cherry picked from commit b106c8b910ec49f1018146dd82b0f93833a66600)
7a3408
7a3408
https://bugzilla.redhat.com/show_bug.cgi?id=1265902
7a3408
7a3408
Conflicts:
7a3408
	src/qemu/qemu_migration.c -- missing qemuMigrationFinish
7a3408
        refactoring
7a3408
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/qemu/qemu_migration.c | 25 ++++++++++++++-----------
7a3408
 1 file changed, 14 insertions(+), 11 deletions(-)
7a3408
7a3408
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
7a3408
index 759fd21..e04459d 100644
7a3408
--- a/src/qemu/qemu_migration.c
7a3408
+++ b/src/qemu/qemu_migration.c
7a3408
@@ -5617,6 +5617,10 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
7a3408
      * object, but if no, clean up the empty qemu process.
7a3408
      */
7a3408
     if (retcode == 0) {
7a3408
+        unsigned long long timeReceived = 0;
7a3408
+
7a3408
+        ignore_value(virTimeMillisNow(&timeReceived));
7a3408
+
7a3408
         if (!virDomainObjIsActive(vm) && !(flags & VIR_MIGRATE_OFFLINE)) {
7a3408
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
7a3408
                            _("guest unexpectedly quit"));
7a3408
@@ -5624,16 +5628,6 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
7a3408
             goto endjob;
7a3408
         }
7a3408
 
7a3408
-        if (mig->jobInfo) {
7a3408
-            qemuDomainJobInfoPtr jobInfo = mig->jobInfo;
7a3408
-            priv->job.completed = jobInfo;
7a3408
-            mig->jobInfo = NULL;
7a3408
-            if (jobInfo->sent && virTimeMillisNow(&jobInfo->received) == 0) {
7a3408
-                jobInfo->timeDelta = jobInfo->received - jobInfo->sent;
7a3408
-                jobInfo->timeDeltaSet = true;
7a3408
-            }
7a3408
-        }
7a3408
-
7a3408
         if (!(flags & VIR_MIGRATE_OFFLINE)) {
7a3408
             if (qemuMigrationVPAssociatePortProfiles(vm->def) < 0) {
7a3408
                 qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED,
7a3408
@@ -5737,7 +5731,16 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
7a3408
             }
7a3408
         }
7a3408
 
7a3408
-        if (priv->job.completed) {
7a3408
+        if (mig->jobInfo) {
7a3408
+            qemuDomainJobInfoPtr jobInfo = mig->jobInfo;
7a3408
+            priv->job.completed = jobInfo;
7a3408
+            mig->jobInfo = NULL;
7a3408
+
7a3408
+            if (jobInfo->sent && timeReceived) {
7a3408
+                jobInfo->timeDelta = timeReceived - jobInfo->sent;
7a3408
+                jobInfo->received = timeReceived;
7a3408
+                jobInfo->timeDeltaSet = true;
7a3408
+            }
7a3408
             qemuDomainJobInfoUpdateTime(priv->job.completed);
7a3408
             qemuDomainJobInfoUpdateDowntime(priv->job.completed);
7a3408
         }
7a3408
-- 
7a3408
2.6.1
7a3408