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

[libvirt] [PATCH 15/19] qemu: Remove special case for virDomainBlockStats



Like other query commands, this can now be called directly during
migration.
---
 src/qemu/qemu_domain.h    |    4 ---
 src/qemu/qemu_driver.c    |   54 +++++++++++++++------------------------------
 src/qemu/qemu_migration.c |   18 ---------------
 3 files changed, 18 insertions(+), 58 deletions(-)

diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 0958bf2..c2ad456 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -70,15 +70,11 @@ enum qemuDomainJobSignals {
     QEMU_JOB_SIGNAL_SUSPEND = 1 << 1, /* Request VM suspend to finish live migration offline */
     QEMU_JOB_SIGNAL_MIGRATE_DOWNTIME = 1 << 2, /* Request migration downtime change */
     QEMU_JOB_SIGNAL_MIGRATE_SPEED = 1 << 3, /* Request migration speed change */
-    QEMU_JOB_SIGNAL_BLKSTAT = 1 << 4, /* Request blkstat during migration */
 };
 
 struct qemuDomainJobSignalsData {
     unsigned long long migrateDowntime; /* Data for QEMU_JOB_SIGNAL_MIGRATE_DOWNTIME */
     unsigned long migrateBandwidth; /* Data for QEMU_JOB_SIGNAL_MIGRATE_SPEED */
-    char *statDevName; /* Device name used by blkstat calls */
-    virDomainBlockStatsPtr blockStat; /* Block statistics for QEMU_JOB_SIGNAL_BLKSTAT */
-    int *statRetCode; /* Return code for the blkstat calls */
 };
 
 struct qemuDomainJobObj {
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 76dfbd8..cd64f85 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6008,46 +6008,28 @@ qemudDomainBlockStats (virDomainPtr dom,
     }
 
     priv = vm->privateData;
-    if ((priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_OUT)
-        || (priv->job.asyncJob == QEMU_ASYNC_JOB_SAVE)) {
-        virDomainObjRef(vm);
-        while (priv->job.signals & QEMU_JOB_SIGNAL_BLKSTAT)
-            ignore_value(virCondWait(&priv->job.signalCond, &vm->lock));
-
-        priv->job.signalsData.statDevName = disk->info.alias;
-        priv->job.signalsData.blockStat = stats;
-        priv->job.signalsData.statRetCode = &ret;
-        priv->job.signals |= QEMU_JOB_SIGNAL_BLKSTAT;
-
-        while (priv->job.signals & QEMU_JOB_SIGNAL_BLKSTAT)
-            ignore_value(virCondWait(&priv->job.signalCond, &vm->lock));
-
-        if (virDomainObjUnref(vm) == 0)
-            vm = NULL;
-    } else {
-        if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
-            goto cleanup;
+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
+        goto cleanup;
 
-        if (!virDomainObjIsActive(vm)) {
-            qemuReportError(VIR_ERR_OPERATION_INVALID,
-                            "%s", _("domain is not running"));
-            goto endjob;
-        }
+    if (!virDomainObjIsActive(vm)) {
+        qemuReportError(VIR_ERR_OPERATION_INVALID,
+                        "%s", _("domain is not running"));
+        goto endjob;
+    }
 
-        ignore_value(qemuDomainObjEnterMonitor(driver, vm));
-        ret = qemuMonitorGetBlockStatsInfo(priv->mon,
-                                           disk->info.alias,
-                                           &stats->rd_req,
-                                           &stats->rd_bytes,
-                                           &stats->wr_req,
-                                           &stats->wr_bytes,
-                                           &stats->errs);
-        qemuDomainObjExitMonitor(driver, vm);
+    ignore_value(qemuDomainObjEnterMonitor(driver, vm));
+    ret = qemuMonitorGetBlockStatsInfo(priv->mon,
+                                       disk->info.alias,
+                                       &stats->rd_req,
+                                       &stats->rd_bytes,
+                                       &stats->wr_req,
+                                       &stats->wr_bytes,
+                                       &stats->errs);
+    qemuDomainObjExitMonitor(driver, vm);
 
 endjob:
-        if (qemuDomainObjEndJob(driver, vm) == 0)
-            vm = NULL;
-    }
+    if (qemuDomainObjEndJob(driver, vm) == 0)
+        vm = NULL;
 
 cleanup:
     if (vm)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 8a14d2e..a7566f4 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -801,24 +801,6 @@ qemuMigrationProcessJobSignals(struct qemud_driver *driver,
         }
         if (ret < 0)
             VIR_WARN("Unable to set migration speed");
-    } else if (priv->job.signals & QEMU_JOB_SIGNAL_BLKSTAT) {
-        ret = qemuDomainObjEnterMonitorWithDriver(driver, vm);
-        if (ret == 0) {
-            ret = qemuMonitorGetBlockStatsInfo(priv->mon,
-                                  priv->job.signalsData.statDevName,
-                                  &priv->job.signalsData.blockStat->rd_req,
-                                  &priv->job.signalsData.blockStat->rd_bytes,
-                                  &priv->job.signalsData.blockStat->wr_req,
-                                  &priv->job.signalsData.blockStat->wr_bytes,
-                                  &priv->job.signalsData.blockStat->errs);
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
-        }
-
-        *priv->job.signalsData.statRetCode = ret;
-        priv->job.signals ^= QEMU_JOB_SIGNAL_BLKSTAT;
-
-        if (ret < 0)
-            VIR_WARN("Unable to get block statistics");
     } else {
         ret = 0;
     }
-- 
1.7.6


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