mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
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:
parent
f0296aa9a3
commit
9d6867198d
@ -14914,8 +14914,6 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
|
||||
virDomainDef *persistentDef = NULL;
|
||||
virDomainBlockIoTuneInfo info;
|
||||
virDomainBlockIoTuneInfo conf_info;
|
||||
g_autofree char *drivealias = NULL;
|
||||
const char *qdevid = NULL;
|
||||
int ret = -1;
|
||||
size_t i;
|
||||
virDomainDiskDef *conf_disk = NULL;
|
||||
@ -15111,13 +15109,6 @@ qemuDomainSetBlockIoTune(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;
|
||||
}
|
||||
|
||||
cur_info = qemuDomainFindGroupBlockIoTune(def, disk, &info);
|
||||
|
||||
if (qemuDomainSetBlockIoTuneDefaults(&info, cur_info,
|
||||
@ -15167,7 +15158,9 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
|
||||
int rc = 0;
|
||||
|
||||
qemuDomainObjEnterMonitor(vm);
|
||||
rc = qemuMonitorSetBlockIoThrottle(priv->mon, drivealias, qdevid, &info);
|
||||
rc = qemuMonitorSetBlockIoThrottle(priv->mon,
|
||||
QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName,
|
||||
&info);
|
||||
qemuDomainObjExitMonitor(vm);
|
||||
|
||||
if (rc < 0)
|
||||
|
@ -517,7 +517,7 @@ qemuDomainChangeMediaBlockdev(virDomainObj *vm,
|
||||
if (rc == 0 &&
|
||||
!virStorageSourceIsEmpty(newsrc) &&
|
||||
qemuDiskConfigBlkdeviotuneEnabled(disk)) {
|
||||
rc = qemuMonitorSetBlockIoThrottle(priv->mon, NULL,
|
||||
rc = qemuMonitorSetBlockIoThrottle(priv->mon,
|
||||
diskPriv->qomName,
|
||||
&disk->blkdeviotune);
|
||||
}
|
||||
@ -734,7 +734,7 @@ qemuDomainAttachDiskGeneric(virDomainObj *vm,
|
||||
g_autoptr(GHashTable) blockinfo = NULL;
|
||||
|
||||
if (qemuDiskConfigBlkdeviotuneEnabled(disk)) {
|
||||
if (qemuMonitorSetBlockIoThrottle(priv->mon, NULL, diskPriv->qomName,
|
||||
if (qemuMonitorSetBlockIoThrottle(priv->mon, diskPriv->qomName,
|
||||
&disk->blkdeviotune) < 0)
|
||||
VIR_WARN("failed to set blkdeviotune for '%s' of '%s'", disk->dst, vm->def->name);
|
||||
}
|
||||
|
@ -2973,16 +2973,14 @@ qemuMonitorJobComplete(qemuMonitor *mon,
|
||||
|
||||
int
|
||||
qemuMonitorSetBlockIoThrottle(qemuMonitor *mon,
|
||||
const char *drivealias,
|
||||
const char *qomid,
|
||||
virDomainBlockIoTuneInfo *info)
|
||||
{
|
||||
VIR_DEBUG("drivealias=%s, qomid=%s, info=%p",
|
||||
NULLSTR(drivealias), NULLSTR(qomid), info);
|
||||
VIR_DEBUG("qomid=%s, info=%p", NULLSTR(qomid), info);
|
||||
|
||||
QEMU_CHECK_MONITOR(mon);
|
||||
|
||||
return qemuMonitorJSONSetBlockIoThrottle(mon, drivealias, qomid, info);
|
||||
return qemuMonitorJSONSetBlockIoThrottle(mon, qomid, info);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1052,7 +1052,6 @@ int qemuMonitorOpenGraphics(qemuMonitor *mon,
|
||||
bool skipauth);
|
||||
|
||||
int qemuMonitorSetBlockIoThrottle(qemuMonitor *mon,
|
||||
const char *drivealias,
|
||||
const char *qomid,
|
||||
virDomainBlockIoTuneInfo *info);
|
||||
|
||||
|
@ -4596,7 +4596,6 @@ qemuMonitorJSONBlockIoThrottleInfo(virJSONValue *io_throttle,
|
||||
#undef GET_THROTTLE_STATS_OPTIONAL
|
||||
|
||||
int qemuMonitorJSONSetBlockIoThrottle(qemuMonitor *mon,
|
||||
const char *drivealias,
|
||||
const char *qomid,
|
||||
virDomainBlockIoTuneInfo *info)
|
||||
{
|
||||
@ -4604,8 +4603,7 @@ int qemuMonitorJSONSetBlockIoThrottle(qemuMonitor *mon,
|
||||
g_autoptr(virJSONValue) result = NULL;
|
||||
|
||||
if (!(cmd = qemuMonitorJSONMakeCommand("block_set_io_throttle",
|
||||
"S:device", drivealias,
|
||||
"S:id", qomid,
|
||||
"s:id", qomid,
|
||||
"U:bps", info->total_bytes_sec,
|
||||
"U:bps_rd", info->read_bytes_sec,
|
||||
"U:bps_wr", info->write_bytes_sec,
|
||||
|
@ -401,7 +401,6 @@ qemuMonitorJSONOpenGraphics(qemuMonitor *mon,
|
||||
|
||||
int
|
||||
qemuMonitorJSONSetBlockIoThrottle(qemuMonitor *mon,
|
||||
const char *drivealias,
|
||||
const char *qomid,
|
||||
virDomainBlockIoTuneInfo *info);
|
||||
|
||||
|
@ -7307,13 +7307,6 @@ qemuProcessSetupDiskThrottling(virDomainObj *vm,
|
||||
|
||||
for (i = 0; i < vm->def->ndisks; 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 */
|
||||
if (virStorageSourceIsEmpty(disk->src))
|
||||
@ -7322,8 +7315,9 @@ qemuProcessSetupDiskThrottling(virDomainObj *vm,
|
||||
if (!qemuDiskConfigBlkdeviotuneEnabled(disk))
|
||||
continue;
|
||||
|
||||
if (qemuMonitorSetBlockIoThrottle(qemuDomainGetMonitor(vm), drivealias,
|
||||
diskPriv->qomName, &disk->blkdeviotune) < 0)
|
||||
if (qemuMonitorSetBlockIoThrottle(qemuDomainGetMonitor(vm),
|
||||
QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName,
|
||||
&disk->blkdeviotune) < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1904,7 +1904,7 @@ testQemuMonitorJSONqemuMonitorJSONSetBlockIoThrottle(const void *opaque)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuMonitorJSONSetBlockIoThrottle(qemuMonitorTestGetMonitor(test),
|
||||
NULL, "drive-virtio-disk1", &info) < 0)
|
||||
"drive-virtio-disk1", &info) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user