The code which fills 'qomName' does so only when the blockdev capability
is enabled so we don't have to check it separately as it can be only
non-NULL when blockdev is used.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_driver.c | 29 ++++++++++++-----------------
src/qemu/qemu_process.c | 3 +--
2 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index cfb02f7b0f..d5a3181c0d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -10119,16 +10119,15 @@ qemuDomainBlocksStatsGather(virQEMUDriver *driver,
return -1;
}
- if (blockdev && QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) {
+ if (QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName)
entryname = QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName;
- } else {
- if (!disk->info.alias) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("missing disk device alias name for %s"),
disk->dst);
- return -1;
- }
-
+ else
entryname = disk->info.alias;
+
+ if (!entryname) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("missing disk device alias name for %s"),
disk->dst);
+ return -1;
}
}
@@ -10180,7 +10179,7 @@ qemuDomainBlocksStatsGather(virQEMUDriver *driver,
if (virStorageSourceGetActualType(disk->src) ==
VIR_STORAGE_TYPE_VHOST_USER)
continue;
- if (blockdev && QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName)
+ if (QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName)
entryname = QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName;
if (!entryname)
@@ -16312,8 +16311,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
if (!qemuDomainDiskBlockIoTuneIsSupported(disk->src))
goto endjob;
- if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) &&
- QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) {
+ if (QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) {
qdevid = QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName;
} else {
if (!(drivealias = qemuAliasDiskDriveFromDisk(disk)))
@@ -16497,8 +16495,7 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,
if (!qemuDomainDiskBlockIoTuneIsSupported(disk->src))
goto endjob;
- if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) &&
- QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) {
+ if (QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) {
qdevid = QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName;
} else {
if (!(drivealias = qemuAliasDiskDriveFromDisk(disk)))
@@ -16597,7 +16594,6 @@ qemuDomainGetDiskErrors(virDomainPtr dom,
virDomainObj *vm = NULL;
qemuDomainObjPrivate *priv;
g_autoptr(GHashTable) table = NULL;
- bool blockdev = false;
int ret = -1;
size_t i;
int n = 0;
@@ -16608,7 +16604,6 @@ qemuDomainGetDiskErrors(virDomainPtr dom,
goto cleanup;
priv = vm->privateData;
- blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
if (virDomainGetDiskErrorsEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
@@ -16636,7 +16631,7 @@ qemuDomainGetDiskErrors(virDomainPtr dom,
qemuDomainDiskPrivate *diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
const char *entryname = disk->info.alias;
- if (blockdev && diskPriv->qomName)
+ if (diskPriv->qomName)
entryname = diskPriv->qomName;
if ((info = virHashLookup(table, entryname)) &&
@@ -18505,7 +18500,7 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDef *disk,
/* 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) {
+ if (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 438c903578..260116dc67 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8593,7 +8593,6 @@ qemuProcessRefreshDisks(virQEMUDriver *driver,
virDomainAsyncJob asyncJob)
{
qemuDomainObjPrivate *priv = vm->privateData;
- bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
g_autoptr(GHashTable) table = NULL;
size_t i;
@@ -8611,7 +8610,7 @@ qemuProcessRefreshDisks(virQEMUDriver *driver,
struct qemuDomainDiskInfo *info;
const char *entryname = disk->info.alias;
- if (blockdev && diskpriv->qomName)
+ if (diskpriv->qomName)
entryname = diskpriv->qomName;
if (!(info = virHashLookup(table, entryname)))
--
2.36.1