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 63c1a85d5a..6ee826029b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18738,6 +18738,7 @@ qemuDomainGetDiskErrors(virDomainPtr dom,
virDomainObjPtr vm = NULL;
qemuDomainObjPrivatePtr priv;
virHashTablePtr table = NULL;
+ bool blockdev = false;
int ret = -1;
size_t i;
int n = 0;
@@ -18748,6 +18749,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;
@@ -18773,8 +18775,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 2183127133..fceaf95fab 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -7561,6 +7561,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;
@@ -7578,8 +7579,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