[PATCH RFC 32/39] qemu: Use QOM path with query-block when using -blockdev

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

 



Switch to using the QOM/qdev handles in all calls to
qemuMonitorGetBlockInfo when using -blockdev. The callers also need to
make sure to use the correct handle afterwards to extract the data.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c  | 11 +++++++++--
 src/qemu/qemu_process.c |  9 +++++++--
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 9114800821..9a3c4289ba 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18723,6 +18723,7 @@ qemuDomainGetDiskErrors(virDomainPtr dom,
     virDomainObjPtr vm = NULL;
     qemuDomainObjPrivatePtr priv;
     virHashTablePtr table = NULL;
+    bool blockdev = false;
     int ret = -1;
     size_t i;
     int n = 0;
@@ -18733,6 +18734,7 @@ qemuDomainGetDiskErrors(virDomainPtr dom,
         goto cleanup;

     priv = vm->privateData;
+    blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);

     if (virDomainGetDiskErrorsEnsureACL(dom->conn, vm->def) < 0)
         goto cleanup;
@@ -18749,7 +18751,7 @@ qemuDomainGetDiskErrors(virDomainPtr dom,
     }

     qemuDomainObjEnterMonitor(driver, vm);
-    table = qemuMonitorGetBlockInfo(priv->mon, false);
+    table = qemuMonitorGetBlockInfo(priv->mon, blockdev);
     if (qemuDomainObjExitMonitor(driver, vm) < 0)
         goto endjob;
     if (!table)
@@ -18758,8 +18760,13 @@ qemuDomainGetDiskErrors(virDomainPtr dom,
     for (i = n = 0; i < vm->def->ndisks; i++) {
         struct qemuDomainDiskInfo *info;
         virDomainDiskDefPtr disk = vm->def->disks[i];
+        qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
+        const char *entryname = disk->info.alias;
+
+        if (blockdev)
+            entryname = diskPriv->backendQomName;

-        if ((info = virHashLookup(table, disk->info.alias)) &&
+        if ((info = virHashLookup(table, entryname)) &&
             info->io_status != VIR_DOMAIN_DISK_ERROR_NONE) {
             if (n == nerrors)
                 break;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 2c3133d678..b8724b68ae 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -7559,12 +7559,13 @@ qemuProcessRefreshDisks(virQEMUDriverPtr driver,
                         qemuDomainAsyncJob asyncJob)
 {
     qemuDomainObjPrivatePtr priv = vm->privateData;
+    bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
     virHashTablePtr table = NULL;
     int ret = -1;
     size_t i;

     if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) {
-        table = qemuMonitorGetBlockInfo(priv->mon, false);
+        table = qemuMonitorGetBlockInfo(priv->mon, blockdev);
         if (qemuDomainObjExitMonitor(driver, vm) < 0)
             goto cleanup;
     }
@@ -7576,8 +7577,12 @@ qemuProcessRefreshDisks(virQEMUDriverPtr driver,
         virDomainDiskDefPtr disk = vm->def->disks[i];
         qemuDomainDiskPrivatePtr diskpriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
         struct qemuDomainDiskInfo *info;
+        const char *entryname = disk->info.alias;
+
+        if (blockdev)
+            entryname = diskpriv->backendQomName;

-        if (!(info = virHashLookup(table, disk->info.alias)))
+        if (!(info = virHashLookup(table, entryname)))
             continue;

         if (info->removable) {
-- 
2.16.2

--
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