Use the drive alias for all cases when we can't generate qomName. This is meant to handle disks on 'sd' bus which are instantiated via -drive if=sd as there isn't any specific QOM name for them. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_driver.c | 16 ++++++++++------ src/qemu/qemu_process.c | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c7eb62f10d..1617f79d34 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -10892,7 +10892,7 @@ qemuDomainBlocksStatsGather(virQEMUDriverPtr driver, goto cleanup; } - if (blockdev) { + if (blockdev && QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) { entryname = QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName; } else { if (!disk->info.alias) { @@ -10948,7 +10948,7 @@ qemuDomainBlocksStatsGather(virQEMUDriverPtr driver, disk = vm->def->disks[i]; entryname = disk->info.alias; - if (blockdev) + if (blockdev && QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) entryname = QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName; if (!entryname) @@ -19283,7 +19283,8 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, if (!(disk = qemuDomainDiskByName(def, path))) goto endjob; - if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && + QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) { qdevid = QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName; } else { if (!(drivealias = qemuAliasDiskDriveFromDisk(disk))) @@ -19473,7 +19474,8 @@ qemuDomainGetBlockIoTune(virDomainPtr dom, if (!(disk = qemuDomainDiskByName(def, path))) goto endjob; - if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && + QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) { qdevid = QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName; } else { if (!(drivealias = qemuAliasDiskDriveFromDisk(disk))) @@ -19608,7 +19610,7 @@ qemuDomainGetDiskErrors(virDomainPtr dom, qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); const char *entryname = disk->info.alias; - if (blockdev) + if (blockdev && diskPriv->qomName) entryname = diskPriv->qomName; if ((info = virHashLookup(table, entryname)) && @@ -21426,7 +21428,9 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDefPtr disk, for (n = disk->src; virStorageSourceIsBacking(n); n = n->backingStore) { g_autofree char *alias = NULL; - if (blockdev) { + /* for 'sd' disks we won't be displaying stats for the backing chain + * as we don't update the stats correctly */ + if (blockdev && QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) { frontendalias = QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName; backendalias = n->nodeformat; backendstoragealias = n->nodestorage; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 488ca91435..fe2ac2dcfe 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7729,7 +7729,7 @@ qemuProcessRefreshDisks(virQEMUDriverPtr driver, struct qemuDomainDiskInfo *info; const char *entryname = disk->info.alias; - if (blockdev) + if (blockdev && diskpriv->qomName) entryname = diskpriv->qomName; if (!(info = virHashLookup(table, entryname))) -- 2.26.2