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(a)redhat.com>
---
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