1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00

qemu: Handle cases when 'qomName' isn't present

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@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Peter Krempa 2020-04-17 12:36:07 +02:00
parent b50a8354f6
commit d876a93f05
2 changed files with 11 additions and 7 deletions

View File

@ -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;

View File

@ -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)))