qemu: Use QOM path with query-block when using -blockdev

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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2018-06-26 18:15:09 +02:00
parent fb0504344c
commit 49510e4191
2 changed files with 14 additions and 2 deletions

View File

@ -18722,6 +18722,7 @@ qemuDomainGetDiskErrors(virDomainPtr dom,
virDomainObjPtr vm = NULL;
qemuDomainObjPrivatePtr priv;
virHashTablePtr table = NULL;
bool blockdev = false;
int ret = -1;
size_t i;
int n = 0;
@ -18732,6 +18733,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;
@ -18757,8 +18759,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 ((info = virHashLookup(table, disk->info.alias)) &&
if (blockdev)
entryname = diskPriv->qomName;
if ((info = virHashLookup(table, entryname)) &&
info->io_status != VIR_DOMAIN_DISK_ERROR_NONE) {
if (n == nerrors)
break;

View File

@ -7591,6 +7591,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;
@ -7608,8 +7609,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 (!(info = virHashLookup(table, disk->info.alias)))
if (blockdev)
entryname = diskpriv->qomName;
if (!(info = virHashLookup(table, entryname)))
continue;
if (info->removable) {