[PATCH v2 04/12] qemu: drop QEMU_MIGRATION_COMPLETED_UPDATE_STATS

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

 



This way we get stats only in one place. The former code waits for
complete/postcopy status basically and don't need to mess with stats.

The patch drops raising an error on stats updates failure. This
does not make much sense anyway.
---
 src/qemu/qemu_migration.c | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 64e5b91..05ff2a0 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2644,8 +2644,7 @@ qemuMigrationUpdateJobStatus(virQEMUDriverPtr driver,
 static int
 qemuMigrationCheckJobStatus(virQEMUDriverPtr driver,
                             virDomainObjPtr vm,
-                            qemuDomainAsyncJob asyncJob,
-                            bool updateJobStats)
+                            qemuDomainAsyncJob asyncJob)
 {
     qemuDomainObjPrivatePtr priv = vm->privateData;
     qemuDomainJobInfoPtr jobInfo = priv->job.current;
@@ -2674,12 +2673,6 @@ qemuMigrationCheckJobStatus(virQEMUDriverPtr driver,
         return -1;
 
     case QEMU_DOMAIN_JOB_STATUS_COMPLETED:
-        /* Fetch statistics of a completed migration */
-        if (events && updateJobStats &&
-            qemuMigrationUpdateJobStatus(driver, vm, asyncJob) < 0)
-            return -1;
-        break;
-
     case QEMU_DOMAIN_JOB_STATUS_ACTIVE:
     case QEMU_DOMAIN_JOB_STATUS_POSTCOPY:
         break;
@@ -2691,10 +2684,10 @@ qemuMigrationCheckJobStatus(virQEMUDriverPtr driver,
 enum qemuMigrationCompletedFlags {
     QEMU_MIGRATION_COMPLETED_ABORT_ON_ERROR = (1 << 0),
     QEMU_MIGRATION_COMPLETED_CHECK_STORAGE  = (1 << 1),
-    QEMU_MIGRATION_COMPLETED_UPDATE_STATS   = (1 << 2),
-    QEMU_MIGRATION_COMPLETED_POSTCOPY       = (1 << 3),
+    QEMU_MIGRATION_COMPLETED_POSTCOPY       = (1 << 2),
 };
 
+
 /**
  * Returns 1 if migration completed successfully,
  *         0 if the domain is still being migrated,
@@ -2711,9 +2704,8 @@ qemuMigrationCompleted(virQEMUDriverPtr driver,
     qemuDomainObjPrivatePtr priv = vm->privateData;
     qemuDomainJobInfoPtr jobInfo = priv->job.current;
     int pauseReason;
-    bool updateStats = !!(flags & QEMU_MIGRATION_COMPLETED_UPDATE_STATS);
 
-    if (qemuMigrationCheckJobStatus(driver, vm, asyncJob, updateStats) < 0)
+    if (qemuMigrationCheckJobStatus(driver, vm, asyncJob) < 0)
         goto error;
 
     if (flags & QEMU_MIGRATION_COMPLETED_CHECK_STORAGE &&
@@ -2741,9 +2733,6 @@ qemuMigrationCompleted(virQEMUDriverPtr driver,
     if (flags & QEMU_MIGRATION_COMPLETED_POSTCOPY &&
         jobInfo->status == QEMU_DOMAIN_JOB_STATUS_POSTCOPY) {
         VIR_DEBUG("Migration switched to post-copy");
-        if (updateStats &&
-            qemuMigrationUpdateJobStatus(driver, vm, asyncJob) < 0)
-            goto error;
         return 1;
     }
 
@@ -2782,8 +2771,6 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver,
     bool events = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT);
     int rv;
 
-    flags |= QEMU_MIGRATION_COMPLETED_UPDATE_STATS;
-
     jobInfo->status = QEMU_DOMAIN_JOB_STATUS_ACTIVE;
     while ((rv = qemuMigrationCompleted(driver, vm, asyncJob,
                                         dconn, flags)) != 1) {
@@ -2805,6 +2792,9 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver,
         }
     }
 
+    if (events)
+        ignore_value(qemuMigrationUpdateJobStatus(driver, vm, asyncJob));
+
     qemuDomainJobInfoUpdateDowntime(jobInfo);
     VIR_FREE(priv->job.completed);
     if (VIR_ALLOC(priv->job.completed) == 0)
-- 
1.8.3.1

--
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]
  Powered by Linux