qemuMonitorSetBlockIoThrottle: 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 f0296aa9a3
commit 9d6867198d
8 changed files with 12 additions and 31 deletions

View File

@ -14914,8 +14914,6 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
virDomainDef *persistentDef = NULL; virDomainDef *persistentDef = NULL;
virDomainBlockIoTuneInfo info; virDomainBlockIoTuneInfo info;
virDomainBlockIoTuneInfo conf_info; virDomainBlockIoTuneInfo conf_info;
g_autofree char *drivealias = NULL;
const char *qdevid = NULL;
int ret = -1; int ret = -1;
size_t i; size_t i;
virDomainDiskDef *conf_disk = NULL; virDomainDiskDef *conf_disk = NULL;
@ -15111,13 +15109,6 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
if (!qemuDomainDiskBlockIoTuneIsSupported(disk)) if (!qemuDomainDiskBlockIoTuneIsSupported(disk))
goto endjob; goto endjob;
if (QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) {
qdevid = QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName;
} else {
if (!(drivealias = qemuAliasDiskDriveFromDisk(disk)))
goto endjob;
}
cur_info = qemuDomainFindGroupBlockIoTune(def, disk, &info); cur_info = qemuDomainFindGroupBlockIoTune(def, disk, &info);
if (qemuDomainSetBlockIoTuneDefaults(&info, cur_info, if (qemuDomainSetBlockIoTuneDefaults(&info, cur_info,
@ -15167,7 +15158,9 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
int rc = 0; int rc = 0;
qemuDomainObjEnterMonitor(vm); qemuDomainObjEnterMonitor(vm);
rc = qemuMonitorSetBlockIoThrottle(priv->mon, drivealias, qdevid, &info); rc = qemuMonitorSetBlockIoThrottle(priv->mon,
QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName,
&info);
qemuDomainObjExitMonitor(vm); qemuDomainObjExitMonitor(vm);
if (rc < 0) if (rc < 0)

View File

@ -517,7 +517,7 @@ qemuDomainChangeMediaBlockdev(virDomainObj *vm,
if (rc == 0 && if (rc == 0 &&
!virStorageSourceIsEmpty(newsrc) && !virStorageSourceIsEmpty(newsrc) &&
qemuDiskConfigBlkdeviotuneEnabled(disk)) { qemuDiskConfigBlkdeviotuneEnabled(disk)) {
rc = qemuMonitorSetBlockIoThrottle(priv->mon, NULL, rc = qemuMonitorSetBlockIoThrottle(priv->mon,
diskPriv->qomName, diskPriv->qomName,
&disk->blkdeviotune); &disk->blkdeviotune);
} }
@ -734,7 +734,7 @@ qemuDomainAttachDiskGeneric(virDomainObj *vm,
g_autoptr(GHashTable) blockinfo = NULL; g_autoptr(GHashTable) blockinfo = NULL;
if (qemuDiskConfigBlkdeviotuneEnabled(disk)) { if (qemuDiskConfigBlkdeviotuneEnabled(disk)) {
if (qemuMonitorSetBlockIoThrottle(priv->mon, NULL, diskPriv->qomName, if (qemuMonitorSetBlockIoThrottle(priv->mon, diskPriv->qomName,
&disk->blkdeviotune) < 0) &disk->blkdeviotune) < 0)
VIR_WARN("failed to set blkdeviotune for '%s' of '%s'", disk->dst, vm->def->name); VIR_WARN("failed to set blkdeviotune for '%s' of '%s'", disk->dst, vm->def->name);
} }

View File

@ -2973,16 +2973,14 @@ qemuMonitorJobComplete(qemuMonitor *mon,
int int
qemuMonitorSetBlockIoThrottle(qemuMonitor *mon, qemuMonitorSetBlockIoThrottle(qemuMonitor *mon,
const char *drivealias,
const char *qomid, const char *qomid,
virDomainBlockIoTuneInfo *info) virDomainBlockIoTuneInfo *info)
{ {
VIR_DEBUG("drivealias=%s, qomid=%s, info=%p", VIR_DEBUG("qomid=%s, info=%p", NULLSTR(qomid), info);
NULLSTR(drivealias), NULLSTR(qomid), info);
QEMU_CHECK_MONITOR(mon); QEMU_CHECK_MONITOR(mon);
return qemuMonitorJSONSetBlockIoThrottle(mon, drivealias, qomid, info); return qemuMonitorJSONSetBlockIoThrottle(mon, qomid, info);
} }

View File

@ -1052,7 +1052,6 @@ int qemuMonitorOpenGraphics(qemuMonitor *mon,
bool skipauth); bool skipauth);
int qemuMonitorSetBlockIoThrottle(qemuMonitor *mon, int qemuMonitorSetBlockIoThrottle(qemuMonitor *mon,
const char *drivealias,
const char *qomid, const char *qomid,
virDomainBlockIoTuneInfo *info); virDomainBlockIoTuneInfo *info);

View File

@ -4596,7 +4596,6 @@ qemuMonitorJSONBlockIoThrottleInfo(virJSONValue *io_throttle,
#undef GET_THROTTLE_STATS_OPTIONAL #undef GET_THROTTLE_STATS_OPTIONAL
int qemuMonitorJSONSetBlockIoThrottle(qemuMonitor *mon, int qemuMonitorJSONSetBlockIoThrottle(qemuMonitor *mon,
const char *drivealias,
const char *qomid, const char *qomid,
virDomainBlockIoTuneInfo *info) virDomainBlockIoTuneInfo *info)
{ {
@ -4604,8 +4603,7 @@ int qemuMonitorJSONSetBlockIoThrottle(qemuMonitor *mon,
g_autoptr(virJSONValue) result = NULL; g_autoptr(virJSONValue) result = NULL;
if (!(cmd = qemuMonitorJSONMakeCommand("block_set_io_throttle", if (!(cmd = qemuMonitorJSONMakeCommand("block_set_io_throttle",
"S:device", drivealias, "s:id", qomid,
"S:id", qomid,
"U:bps", info->total_bytes_sec, "U:bps", info->total_bytes_sec,
"U:bps_rd", info->read_bytes_sec, "U:bps_rd", info->read_bytes_sec,
"U:bps_wr", info->write_bytes_sec, "U:bps_wr", info->write_bytes_sec,

View File

@ -401,7 +401,6 @@ qemuMonitorJSONOpenGraphics(qemuMonitor *mon,
int int
qemuMonitorJSONSetBlockIoThrottle(qemuMonitor *mon, qemuMonitorJSONSetBlockIoThrottle(qemuMonitor *mon,
const char *drivealias,
const char *qomid, const char *qomid,
virDomainBlockIoTuneInfo *info); virDomainBlockIoTuneInfo *info);

View File

@ -7307,13 +7307,6 @@ qemuProcessSetupDiskThrottling(virDomainObj *vm,
for (i = 0; i < vm->def->ndisks; i++) { for (i = 0; i < vm->def->ndisks; i++) {
virDomainDiskDef *disk = vm->def->disks[i]; virDomainDiskDef *disk = vm->def->disks[i];
qemuDomainDiskPrivate *diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
g_autofree char *drivealias = NULL;
if (!QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) {
if (!(drivealias = qemuAliasDiskDriveFromDisk(disk)))
goto cleanup;
}
/* Setting throttling for empty drives fails */ /* Setting throttling for empty drives fails */
if (virStorageSourceIsEmpty(disk->src)) if (virStorageSourceIsEmpty(disk->src))
@ -7322,8 +7315,9 @@ qemuProcessSetupDiskThrottling(virDomainObj *vm,
if (!qemuDiskConfigBlkdeviotuneEnabled(disk)) if (!qemuDiskConfigBlkdeviotuneEnabled(disk))
continue; continue;
if (qemuMonitorSetBlockIoThrottle(qemuDomainGetMonitor(vm), drivealias, if (qemuMonitorSetBlockIoThrottle(qemuDomainGetMonitor(vm),
diskPriv->qomName, &disk->blkdeviotune) < 0) QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName,
&disk->blkdeviotune) < 0)
goto cleanup; goto cleanup;
} }

View File

@ -1904,7 +1904,7 @@ testQemuMonitorJSONqemuMonitorJSONSetBlockIoThrottle(const void *opaque)
goto cleanup; goto cleanup;
if (qemuMonitorJSONSetBlockIoThrottle(qemuMonitorTestGetMonitor(test), if (qemuMonitorJSONSetBlockIoThrottle(qemuMonitorTestGetMonitor(test),
NULL, "drive-virtio-disk1", &info) < 0) "drive-virtio-disk1", &info) < 0)
goto cleanup; goto cleanup;
ret = 0; ret = 0;