Blame SOURCES/libvirt-qemu-Make-updating-stats-in-qemuMigrationCheckJobStatus-optional.patch

7a3408
From 71a02a994244ade016cadf1cc51b0cfa32482b8c Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <71a02a994244ade016cadf1cc51b0cfa32482b8c@dist-git>
7a3408
From: Jiri Denemark <jdenemar@redhat.com>
7a3408
Date: Mon, 5 Oct 2015 14:32:58 +0200
7a3408
Subject: [PATCH] qemu: Make updating stats in qemuMigrationCheckJobStatus
7a3408
 optional
7a3408
7a3408
With new QEMU which supports migration events,
7a3408
qemuMigrationCheckJobStatus needs to explicitly query QEMU for migration
7a3408
statistics once migration is completed to make sure the caller sees
7a3408
up-to-date statistics with both old and new QEMU. However, some callers
7a3408
are not interested in the statistics at all and once we start waiting
7a3408
for a completed migration on the destination host too, checking the
7a3408
statistics would even fail. Let's push the decision whether to update
7a3408
the statistics or not to the caller.
7a3408
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
(cherry picked from commit 829c62b7a5268a639116bc1cea51d1c6598f4bf4)
7a3408
7a3408
https://bugzilla.redhat.com/show_bug.cgi?id=1265902
7a3408
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/qemu/qemu_migration.c | 14 +++++++++-----
7a3408
 1 file changed, 9 insertions(+), 5 deletions(-)
7a3408
7a3408
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
7a3408
index 17c1276..83614f5 100644
7a3408
--- a/src/qemu/qemu_migration.c
7a3408
+++ b/src/qemu/qemu_migration.c
7a3408
@@ -2562,7 +2562,8 @@ qemuMigrationUpdateJobStatus(virQEMUDriverPtr driver,
7a3408
 static int
7a3408
 qemuMigrationCheckJobStatus(virQEMUDriverPtr driver,
7a3408
                             virDomainObjPtr vm,
7a3408
-                            qemuDomainAsyncJob asyncJob)
7a3408
+                            qemuDomainAsyncJob asyncJob,
7a3408
+                            bool updateJobStats)
7a3408
 {
7a3408
     qemuDomainObjPrivatePtr priv = vm->privateData;
7a3408
     qemuDomainJobInfoPtr jobInfo = priv->job.current;
7a3408
@@ -2592,7 +2593,7 @@ qemuMigrationCheckJobStatus(virQEMUDriverPtr driver,
7a3408
 
7a3408
     case VIR_DOMAIN_JOB_COMPLETED:
7a3408
         /* Fetch statistics of a completed migration */
7a3408
-        if (events &&
7a3408
+        if (events && updateJobStats &&
7a3408
             qemuMigrationUpdateJobStatus(driver, vm, asyncJob) < 0)
7a3408
             return -1;
7a3408
         break;
7a3408
@@ -2609,6 +2610,7 @@ qemuMigrationCheckJobStatus(virQEMUDriverPtr driver,
7a3408
 enum qemuMigrationCompletedFlags {
7a3408
     QEMU_MIGRATION_COMPLETED_ABORT_ON_ERROR = (1 << 0),
7a3408
     QEMU_MIGRATION_COMPLETED_CHECK_STORAGE  = (1 << 1),
7a3408
+    QEMU_MIGRATION_COMPLETED_UPDATE_STATS   = (1 << 2),
7a3408
 };
7a3408
 
7a3408
 /**
7a3408
@@ -2627,8 +2629,9 @@ qemuMigrationCompleted(virQEMUDriverPtr driver,
7a3408
     qemuDomainObjPrivatePtr priv = vm->privateData;
7a3408
     qemuDomainJobInfoPtr jobInfo = priv->job.current;
7a3408
     int pauseReason;
7a3408
+    bool updateStats = !!(flags & QEMU_MIGRATION_COMPLETED_UPDATE_STATS);
7a3408
 
7a3408
-    if (qemuMigrationCheckJobStatus(driver, vm, asyncJob) < 0)
7a3408
+    if (qemuMigrationCheckJobStatus(driver, vm, asyncJob, updateStats) < 0)
7a3408
         goto error;
7a3408
 
7a3408
     if (flags & QEMU_MIGRATION_COMPLETED_CHECK_STORAGE &&
7a3408
@@ -2682,7 +2685,7 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver,
7a3408
     qemuDomainObjPrivatePtr priv = vm->privateData;
7a3408
     qemuDomainJobInfoPtr jobInfo = priv->job.current;
7a3408
     bool events = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT);
7a3408
-    unsigned int flags = 0;
7a3408
+    unsigned int flags = QEMU_MIGRATION_COMPLETED_UPDATE_STATS;
7a3408
     int rv;
7a3408
 
7a3408
     if (abort_on_error)
7a3408
@@ -4352,7 +4355,8 @@ qemuMigrationRun(virQEMUDriverPtr driver,
7a3408
          * connection from qemu which may never be initiated.
7a3408
          */
7a3408
         if (qemuMigrationCheckJobStatus(driver, vm,
7a3408
-                                        QEMU_ASYNC_JOB_MIGRATION_OUT) < 0)
7a3408
+                                        QEMU_ASYNC_JOB_MIGRATION_OUT,
7a3408
+                                        false) < 0)
7a3408
             goto cancel;
7a3408
 
7a3408
         while ((fd = accept(spec->dest.unix_socket.sock, NULL, NULL)) < 0) {
7a3408
-- 
7a3408
2.6.1
7a3408