[PATCH v2 09/12] qemu: drop fetch flag in qemuDomainGetJobStatsInternal

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

 



Basically this optimization skips acquiring jobs condition
in case no job is running. But as we are going to add
mirroring statistics it is simplier to drop this optimization.
---
 src/qemu/qemu_driver.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 84db59d..21e3f9c 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13019,7 +13019,6 @@ qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver,
                               qemuDomainJobInfoPtr jobInfo)
 {
     qemuDomainObjPrivatePtr priv = vm->privateData;
-    bool fetch = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT);
     int ret = -1;
 
     if (completed) {
@@ -13032,14 +13031,8 @@ qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver,
         return 0;
     }
 
-    /* Do not ask QEMU if migration is not even running yet  */
-    if (!priv->job.current || !priv->job.current->stats.status)
-        fetch = false;
-
-    if (fetch) {
-        if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
-            return -1;
-    }
+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
+        return -1;
 
     if (!virDomainObjIsActive(vm)) {
         virReportError(VIR_ERR_OPERATION_INVALID, "%s",
@@ -13060,7 +13053,8 @@ qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver,
         goto cleanup;
     }
 
-    if (fetch) {
+    if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT) &&
+        priv->job.current->stats.status) {
         int rv;
 
         qemuDomainObjEnterMonitor(driver, vm);
@@ -13077,8 +13071,7 @@ qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver,
     ret = 0;
 
  cleanup:
-    if (fetch)
-        qemuDomainObjEndJob(driver, vm);
+    qemuDomainObjEndJob(driver, vm);
     return ret;
 }
 
-- 
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