qemuMonitorGetBlockIoThrottle: Drop 'diskalias' argument

Every caller will pass 'qdevid' as it's populated in the data
mandatorily with qemu-4.2 and onwards due to mandatory -blockdev use.

Thus we can drop compatibility with the old way of matching the disk via
alias.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2023-05-23 15:32:49 +02:00
parent 52c874d913
commit f0296aa9a3
6 changed files with 8 additions and 22 deletions

View File

@ -15240,8 +15240,6 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,
virDomainDef *def = NULL;
virDomainDef *persistentDef = NULL;
virDomainBlockIoTuneInfo reply = {0};
g_autofree char *drivealias = NULL;
const char *qdevid = NULL;
int ret = -1;
int maxparams;
@ -15288,14 +15286,8 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,
if (!qemuDomainDiskBlockIoTuneIsSupported(disk))
goto endjob;
if (QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) {
qdevid = QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName;
} else {
if (!(drivealias = qemuAliasDiskDriveFromDisk(disk)))
goto endjob;
}
qemuDomainObjEnterMonitor(vm);
rc = qemuMonitorGetBlockIoThrottle(priv->mon, drivealias, qdevid, &reply);
rc = qemuMonitorGetBlockIoThrottle(priv->mon, QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName, &reply);
qemuDomainObjExitMonitor(vm);
if (rc < 0)

View File

@ -2988,16 +2988,14 @@ qemuMonitorSetBlockIoThrottle(qemuMonitor *mon,
int
qemuMonitorGetBlockIoThrottle(qemuMonitor *mon,
const char *drivealias,
const char *qdevid,
virDomainBlockIoTuneInfo *reply)
{
VIR_DEBUG("drivealias=%s, qdevid=%s, reply=%p",
NULLSTR(drivealias), NULLSTR(qdevid), reply);
VIR_DEBUG("qdevid=%s, reply=%p", NULLSTR(qdevid), reply);
QEMU_CHECK_MONITOR(mon);
return qemuMonitorJSONGetBlockIoThrottle(mon, drivealias, qdevid, reply);
return qemuMonitorJSONGetBlockIoThrottle(mon, qdevid, reply);
}

View File

@ -1057,7 +1057,6 @@ int qemuMonitorSetBlockIoThrottle(qemuMonitor *mon,
virDomainBlockIoTuneInfo *info);
int qemuMonitorGetBlockIoThrottle(qemuMonitor *mon,
const char *drivealias,
const char *qdevid,
virDomainBlockIoTuneInfo *reply);

View File

@ -4517,7 +4517,6 @@ int qemuMonitorJSONOpenGraphics(qemuMonitor *mon,
}
static int
qemuMonitorJSONBlockIoThrottleInfo(virJSONValue *io_throttle,
const char *drivealias,
const char *qdevid,
virDomainBlockIoTuneInfo *reply)
{
@ -4547,8 +4546,8 @@ qemuMonitorJSONBlockIoThrottleInfo(virJSONValue *io_throttle,
return -1;
}
if ((drivealias && current_drive && STRNEQ(current_drive, drivealias)) ||
(qdevid && current_qdev && STRNEQ(current_qdev, qdevid)))
if (STRNEQ_NULLABLE(current_qdev, qdevid) &&
STRNEQ_NULLABLE(current_drive, qdevid))
continue;
found = true;
@ -4587,7 +4586,7 @@ qemuMonitorJSONBlockIoThrottleInfo(virJSONValue *io_throttle,
if (!found) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot find throttling info for device '%1$s'"),
drivealias ? drivealias : qdevid);
qdevid);
return -1;
}
@ -4640,7 +4639,6 @@ int qemuMonitorJSONSetBlockIoThrottle(qemuMonitor *mon,
}
int qemuMonitorJSONGetBlockIoThrottle(qemuMonitor *mon,
const char *drivealias,
const char *qdevid,
virDomainBlockIoTuneInfo *reply)
{
@ -4649,7 +4647,7 @@ int qemuMonitorJSONGetBlockIoThrottle(qemuMonitor *mon,
if (!(devices = qemuMonitorJSONQueryBlock(mon)))
return -1;
return qemuMonitorJSONBlockIoThrottleInfo(devices, drivealias, qdevid, reply);
return qemuMonitorJSONBlockIoThrottleInfo(devices, qdevid, reply);
}
int qemuMonitorJSONSystemWakeup(qemuMonitor *mon)

View File

@ -407,7 +407,6 @@ qemuMonitorJSONSetBlockIoThrottle(qemuMonitor *mon,
int
qemuMonitorJSONGetBlockIoThrottle(qemuMonitor *mon,
const char *drivealias,
const char *qdevid,
virDomainBlockIoTuneInfo *reply);

View File

@ -1897,7 +1897,7 @@ testQemuMonitorJSONqemuMonitorJSONSetBlockIoThrottle(const void *opaque)
return -1;
if (qemuMonitorJSONGetBlockIoThrottle(qemuMonitorTestGetMonitor(test),
"drive-virtio-disk0", NULL, &info) < 0)
"drive-virtio-disk0", &info) < 0)
goto cleanup;
if (testValidateGetBlockIoThrottle(&info, &expectedInfo) < 0)