On Thu, Jun 02, 2022 at 09:18:00 +0200, Michal Privoznik wrote:
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_command.c | 15 ++++++-
...othreads-ids-pool-sizes.x86_64-latest.args | 44 +++++++++++++++++++
tests/qemuxml2argvtest.c | 1 +
3 files changed, 59 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/iothreads-ids-pool-sizes.x86_64-latest.args
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 52e4ef03cd..86b5193651 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7437,11 +7437,24 @@ qemuBuildIOThreadCommandLine(virCommand *cmd,
for (i = 0; i < def->niothreadids; i++) {
g_autoptr(virJSONValue) props = NULL;
- g_autofree char *alias = g_strdup_printf("iothread%u",
def->iothreadids[i]->iothread_id);
+ const virDomainIOThreadIDDef *iothread = def->iothreadids[i];
+ g_autofree char *alias = NULL;
+
+ alias = g_strdup_printf("iothread%u", iothread->iothread_id);
if (qemuMonitorCreateObjectProps(&props, "iothread", alias, NULL)
< 0)
return -1;
I've sent a patch introducing a 'K' modifier for adding non-negative
longs via the classic machinery:
https://listman.redhat.com/archives/libvir-list/2022-June/232136.html
+ if (iothread->pool_min >= 0 &&
+ virJSONValueObjectAppendNumberLong(props, "thread-pool-min",
+ iothread->pool_min) < 0)
+ return -1;
+
+ if (iothread->pool_max >= 0 &&
+ virJSONValueObjectAppendNumberLong(props, "thread-pool-max",
+ iothread->pool_max) < 0)
+ return -1;
Please rewrite this as
if (qemuMonitorCreateObjectProps(&props, "iothread", alias,
"K:thread-pool-min", iothread->pool_min,
"K:thread-pool-max", iothread->pool_max,
NULL) < 0)
+
if (qemuBuildObjectCommandlineFromJSON(cmd, props, qemuCaps) < 0)
return -1;
}
With the above:
Reviewed-by: Peter Krempa <pkrempa(a)redhat.com>