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 | 9 ++++++++-
src/qemu/qemu_process.c | 7 ++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 55bb8f71fe..a97235614b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18724,6 +18724,7 @@ qemuDomainGetDiskErrors(virDomainPtr dom,
virDomainObjPtr vm = NULL;
qemuDomainObjPrivatePtr priv;
virHashTablePtr table = NULL;
+ bool blockdev = false;
int ret = -1;
size_t i;
int n = 0;
@@ -18734,6 +18735,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;
@@ -18759,8 +18761,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 6e0b4b0027..15e7c951b6 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -7589,6 +7589,7 @@ 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;
@@ -7606,8 +7607,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