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

[libvirt] [PATCH 05/10] qemu: Remove special case for virDomainGetBlockInfo



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

diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 45fae55..37c9515 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -77,7 +77,6 @@ enum qemuDomainJobSignals {
     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 */
-    QEMU_JOB_SIGNAL_BLKINFO = 1 << 5, /* Request blkinfo during migration */
 };
 
 struct qemuDomainJobSignalsData {
@@ -86,9 +85,6 @@ struct qemuDomainJobSignalsData {
     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 */
-    char *infoDevName; /* Device name used by blkinfo calls */
-    virDomainBlockInfoPtr blockInfo; /* Block information for QEMU_JOB_SIGNAL_BLKINFO */
-    int *infoRetCode; /* Return code for the blkinfo calls */
 };
 
 struct qemuDomainJobObj {
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b378cb7..407f52f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6510,39 +6510,21 @@ static int qemuDomainGetBlockInfo(virDomainPtr dom,
         virDomainObjIsActive(vm)) {
         qemuDomainObjPrivatePtr 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_BLKINFO)
-                ignore_value(virCondWait(&priv->job.signalCond, &vm->lock));
-
-            priv->job.signalsData.infoDevName = disk->info.alias;
-            priv->job.signalsData.blockInfo = info;
-            priv->job.signalsData.infoRetCode = &ret;
-            priv->job.signals |= QEMU_JOB_SIGNAL_BLKINFO;
-
-            while (priv->job.signals & QEMU_JOB_SIGNAL_BLKINFO)
-                ignore_value(virCondWait(&priv->job.signalCond, &vm->lock));
+        if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
+            goto cleanup;
 
-            if (virDomainObjUnref(vm) == 0)
-                vm = NULL;
+        if (virDomainObjIsActive(vm)) {
+            ignore_value(qemuDomainObjEnterMonitor(driver, vm));
+            ret = qemuMonitorGetBlockExtent(priv->mon,
+                                            disk->info.alias,
+                                            &info->allocation);
+            qemuDomainObjExitMonitor(driver, vm);
         } else {
-            if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
-                goto cleanup;
-
-            if (virDomainObjIsActive(vm)) {
-                ignore_value(qemuDomainObjEnterMonitor(driver, vm));
-                ret = qemuMonitorGetBlockExtent(priv->mon,
-                                                disk->info.alias,
-                                                &info->allocation);
-                qemuDomainObjExitMonitor(driver, vm);
-            } else {
-                ret = 0;
-            }
-
-            if (qemuDomainObjEndJob(driver, vm) == 0)
-                vm = NULL;
+            ret = 0;
         }
+
+        if (qemuDomainObjEndJob(driver, vm) == 0)
+            vm = NULL;
     } else {
         ret = 0;
     }
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 3eeb67f..d90219c 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -819,20 +819,6 @@ qemuMigrationProcessJobSignals(struct qemud_driver *driver,
 
         if (ret < 0)
             VIR_WARN("Unable to get block statistics");
-    } else if (priv->job.signals & QEMU_JOB_SIGNAL_BLKINFO) {
-        ret = qemuDomainObjEnterMonitorWithDriver(driver, vm);
-        if (ret == 0) {
-            ret = qemuMonitorGetBlockExtent(priv->mon,
-                               priv->job.signalsData.infoDevName,
-                               &priv->job.signalsData.blockInfo->allocation);
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
-        }
-
-        *priv->job.signalsData.infoRetCode = ret;
-        priv->job.signals ^= QEMU_JOB_SIGNAL_BLKINFO;
-
-        if (ret < 0)
-            VIR_WARN("Unable to get block information");
     } else {
         ret = 0;
     }
-- 
1.7.6


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