]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: command: Generate commandline of iothread objects JSON
authorPeter Krempa <pkrempa@redhat.com>
Thu, 26 Nov 2020 18:07:03 +0000 (19:07 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 12 Mar 2021 15:15:05 +0000 (16:15 +0100)
The commandline generator for 'iothread' objects has a private
implementation of the properties. Convert it to JSON so that it can be
later validated.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_command.c

index 97f88f00f63f4273334e9da1ff465de598bfb091..5717f7b98d727795da708c8f3da487edaa4ea0ec 100644 (file)
@@ -7270,15 +7270,19 @@ qemuBuildIOThreadCommandLine(virCommandPtr cmd,
     if (def->niothreadids == 0)
         return 0;
 
-    /* Create iothread objects using the defined iothreadids list
-     * and the defined id and name from the list. These may be used
-     * by a disk definition which will associate to an iothread by
-     * supplying a value of an id from the list
-     */
     for (i = 0; i < def->niothreadids; i++) {
+        g_autoptr(virJSONValue) props = NULL;
+        g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+        g_autofree char *alias = g_strdup_printf("iothread%u", def->iothreadids[i]->iothread_id);
+
+        if (qemuMonitorCreateObjectProps(&props, "iothread", alias, NULL) < 0)
+            return -1;
+
+        if (virQEMUBuildObjectCommandlineFromJSON(&buf, props) < 0)
+            return -1;
+
         virCommandAddArg(cmd, "-object");
-        virCommandAddArgFormat(cmd, "iothread,id=iothread%u",
-                               def->iothreadids[i]->iothread_id);
+        virCommandAddArgBuffer(cmd, &buf);
     }
 
     return 0;