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 <pkre...@redhat.com> --- src/qemu/qemu_driver.c | 4 +- src/qemu/qemu_hotplug.c | 6 +-- src/qemu/qemu_monitor.c | 10 +---- src/qemu/qemu_monitor.h | 5 +-- src/qemu/qemu_monitor_json.c | 81 +++++++++++------------------------- src/qemu/qemu_monitor_json.h | 5 +-- src/qemu/qemu_process.c | 3 +- tests/qemumonitorjsontest.c | 3 +- 8 files changed, 34 insertions(+), 83 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index fc7cbc8c86..66d498062e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -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) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index c00e8a7852..c3c49fe080 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -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); } diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 5d7b686136..14fb605e92 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -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); } diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 05ec228800..f2659d650e 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -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, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 7727d1e7fb..8e5af9f79a 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -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) diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 01a3ba25f1..fbeab2bf6d 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -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, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 0bd3cbafd6..884b3fa028 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -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; } diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 2122d9d999..6d7ecb0ab1 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -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; -- 2.31.1