mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
qemuMonitorSetBlockIoThrottle: Remove booleans controlling used fields
All supported QEMU versions have all the fields so we can remove the booleans controlling which fields are used on the monitor. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
059103869e
commit
88f7511923
@ -16179,9 +16179,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
|
||||
|
||||
qemuDomainObjEnterMonitor(driver, vm);
|
||||
ret = qemuMonitorSetBlockIoThrottle(priv->mon, drivealias, qdevid,
|
||||
&info, true,
|
||||
set_fields & QEMU_BLOCK_IOTUNE_SET_GROUP_NAME,
|
||||
true);
|
||||
&info);
|
||||
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
||||
ret = -1;
|
||||
if (ret < 0)
|
||||
|
@ -566,8 +566,7 @@ qemuDomainChangeMediaBlockdev(virQEMUDriver *driver,
|
||||
qemuDiskConfigBlkdeviotuneEnabled(disk)) {
|
||||
rc = qemuMonitorSetBlockIoThrottle(priv->mon, NULL,
|
||||
diskPriv->qomName,
|
||||
&disk->blkdeviotune,
|
||||
true, true, true);
|
||||
&disk->blkdeviotune);
|
||||
}
|
||||
|
||||
if (rc == 0)
|
||||
@ -806,8 +805,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriver *driver,
|
||||
qemuDiskConfigBlkdeviotuneEnabled(disk)) {
|
||||
qemuDomainDiskPrivate *diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
||||
if (qemuMonitorSetBlockIoThrottle(priv->mon, NULL, diskPriv->qomName,
|
||||
&disk->blkdeviotune,
|
||||
true, true, true) < 0)
|
||||
&disk->blkdeviotune) < 0)
|
||||
VIR_WARN("failed to set blkdeviotune for '%s' of '%s'", disk->dst, vm->def->name);
|
||||
}
|
||||
|
||||
|
@ -3333,20 +3333,14 @@ int
|
||||
qemuMonitorSetBlockIoThrottle(qemuMonitor *mon,
|
||||
const char *drivealias,
|
||||
const char *qomid,
|
||||
virDomainBlockIoTuneInfo *info,
|
||||
bool supportMaxOptions,
|
||||
bool supportGroupNameOption,
|
||||
bool supportMaxLengthOptions)
|
||||
virDomainBlockIoTuneInfo *info)
|
||||
{
|
||||
VIR_DEBUG("drivealias=%s, qomid=%s, info=%p",
|
||||
NULLSTR(drivealias), NULLSTR(qomid), info);
|
||||
|
||||
QEMU_CHECK_MONITOR(mon);
|
||||
|
||||
return qemuMonitorJSONSetBlockIoThrottle(mon, drivealias, qomid, info,
|
||||
supportMaxOptions,
|
||||
supportGroupNameOption,
|
||||
supportMaxLengthOptions);
|
||||
return qemuMonitorJSONSetBlockIoThrottle(mon, drivealias, qomid, info);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1112,10 +1112,7 @@ int qemuMonitorOpenGraphics(qemuMonitor *mon,
|
||||
int qemuMonitorSetBlockIoThrottle(qemuMonitor *mon,
|
||||
const char *drivealias,
|
||||
const char *qomid,
|
||||
virDomainBlockIoTuneInfo *info,
|
||||
bool supportMaxOptions,
|
||||
bool supportGroupNameOption,
|
||||
bool supportMaxLengthOptions);
|
||||
virDomainBlockIoTuneInfo *info);
|
||||
|
||||
int qemuMonitorGetBlockIoThrottle(qemuMonitor *mon,
|
||||
const char *drivealias,
|
||||
|
@ -5423,66 +5423,35 @@ qemuMonitorJSONBlockIoThrottleInfo(virJSONValue *io_throttle,
|
||||
int qemuMonitorJSONSetBlockIoThrottle(qemuMonitor *mon,
|
||||
const char *drivealias,
|
||||
const char *qomid,
|
||||
virDomainBlockIoTuneInfo *info,
|
||||
bool supportMaxOptions,
|
||||
bool supportGroupNameOption,
|
||||
bool supportMaxLengthOptions)
|
||||
virDomainBlockIoTuneInfo *info)
|
||||
{
|
||||
g_autoptr(virJSONValue) cmd = NULL;
|
||||
g_autoptr(virJSONValue) result = NULL;
|
||||
g_autoptr(virJSONValue) args = NULL;
|
||||
|
||||
if (!(cmd = qemuMonitorJSONMakeCommand("block_set_io_throttle", NULL)))
|
||||
return -1;
|
||||
|
||||
if (virJSONValueObjectCreate(&args,
|
||||
"S:device", drivealias,
|
||||
"S:id", qomid,
|
||||
"U:bps", info->total_bytes_sec,
|
||||
"U:bps_rd", info->read_bytes_sec,
|
||||
"U:bps_wr", info->write_bytes_sec,
|
||||
"U:iops", info->total_iops_sec,
|
||||
"U:iops_rd", info->read_iops_sec,
|
||||
"U:iops_wr", info->write_iops_sec,
|
||||
NULL) < 0)
|
||||
return -1;
|
||||
|
||||
if (supportMaxOptions &&
|
||||
virJSONValueObjectAdd(args,
|
||||
"U:bps_max", info->total_bytes_sec_max,
|
||||
"U:bps_rd_max", info->read_bytes_sec_max,
|
||||
"U:bps_wr_max", info->write_bytes_sec_max,
|
||||
"U:iops_max", info->total_iops_sec_max,
|
||||
"U:iops_rd_max", info->read_iops_sec_max,
|
||||
"U:iops_wr_max", info->write_iops_sec_max,
|
||||
"U:iops_size", info->size_iops_sec,
|
||||
NULL) < 0)
|
||||
return -1;
|
||||
|
||||
if (supportGroupNameOption &&
|
||||
virJSONValueObjectAdd(args,
|
||||
"S:group", info->group_name,
|
||||
NULL) < 0)
|
||||
return -1;
|
||||
|
||||
if (supportMaxLengthOptions &&
|
||||
virJSONValueObjectAdd(args,
|
||||
"P:bps_max_length",
|
||||
info->total_bytes_sec_max_length,
|
||||
"P:bps_rd_max_length",
|
||||
info->read_bytes_sec_max_length,
|
||||
"P:bps_wr_max_length",
|
||||
info->write_bytes_sec_max_length,
|
||||
"P:iops_max_length",
|
||||
info->total_iops_sec_max_length,
|
||||
"P:iops_rd_max_length",
|
||||
info->read_iops_sec_max_length,
|
||||
"P:iops_wr_max_length",
|
||||
info->write_iops_sec_max_length,
|
||||
NULL) < 0)
|
||||
return -1;
|
||||
|
||||
if (virJSONValueObjectAppend(cmd, "arguments", &args) < 0)
|
||||
if (!(cmd = qemuMonitorJSONMakeCommand("block_set_io_throttle",
|
||||
"S:device", drivealias,
|
||||
"S:id", qomid,
|
||||
"U:bps", info->total_bytes_sec,
|
||||
"U:bps_rd", info->read_bytes_sec,
|
||||
"U:bps_wr", info->write_bytes_sec,
|
||||
"U:iops", info->total_iops_sec,
|
||||
"U:iops_rd", info->read_iops_sec,
|
||||
"U:iops_wr", info->write_iops_sec,
|
||||
"U:bps_max", info->total_bytes_sec_max,
|
||||
"U:bps_rd_max", info->read_bytes_sec_max,
|
||||
"U:bps_wr_max", info->write_bytes_sec_max,
|
||||
"U:iops_max", info->total_iops_sec_max,
|
||||
"U:iops_rd_max", info->read_iops_sec_max,
|
||||
"U:iops_wr_max", info->write_iops_sec_max,
|
||||
"U:iops_size", info->size_iops_sec,
|
||||
"S:group", info->group_name,
|
||||
"P:bps_max_length", info->total_bytes_sec_max_length,
|
||||
"P:bps_rd_max_length", info->read_bytes_sec_max_length,
|
||||
"P:bps_wr_max_length", info->write_bytes_sec_max_length,
|
||||
"P:iops_max_length", info->total_iops_sec_max_length,
|
||||
"P:iops_rd_max_length", info->read_iops_sec_max_length,
|
||||
"P:iops_wr_max_length", info->write_iops_sec_max_length,
|
||||
NULL)))
|
||||
return -1;
|
||||
|
||||
if (qemuMonitorJSONCommand(mon, cmd, &result) < 0)
|
||||
|
@ -361,10 +361,7 @@ int qemuMonitorJSONOpenGraphics(qemuMonitor *mon,
|
||||
int qemuMonitorJSONSetBlockIoThrottle(qemuMonitor *mon,
|
||||
const char *drivealias,
|
||||
const char *qomid,
|
||||
virDomainBlockIoTuneInfo *info,
|
||||
bool supportMaxOptions,
|
||||
bool supportGroupNameOption,
|
||||
bool supportMaxLengthOptions);
|
||||
virDomainBlockIoTuneInfo *info);
|
||||
|
||||
int qemuMonitorJSONGetBlockIoThrottle(qemuMonitor *mon,
|
||||
const char *drivealias,
|
||||
|
@ -6888,8 +6888,7 @@ qemuProcessSetupDiskThrottlingBlockdev(virQEMUDriver *driver,
|
||||
continue;
|
||||
|
||||
if (qemuMonitorSetBlockIoThrottle(qemuDomainGetMonitor(vm), NULL,
|
||||
diskPriv->qomName, &disk->blkdeviotune,
|
||||
true, true, true) < 0)
|
||||
diskPriv->qomName, &disk->blkdeviotune) < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1962,8 +1962,7 @@ testQemuMonitorJSONqemuMonitorJSONSetBlockIoThrottle(const void *opaque)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuMonitorJSONSetBlockIoThrottle(qemuMonitorTestGetMonitor(test),
|
||||
"drive-virtio-disk1", NULL, &info, true,
|
||||
true, true) < 0)
|
||||
"drive-virtio-disk1", NULL, &info) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user