[PATCH v2 15/15] qemu: Generate command line for main-loop pool size

Michal Privoznik mprivozn at redhat.com
Tue Jun 7 12:52:59 UTC 2022


Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2059511
Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/qemu/qemu_command.c                          | 16 +++++++++++++---
 .../iothreads-ids-pool-sizes.x86_64-latest.args  |  1 +
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2734be7679..be20053c0d 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7436,9 +7436,6 @@ qemuBuildIOThreadCommandLine(virCommand *cmd,
 {
     size_t i;
 
-    if (def->niothreadids == 0)
-        return 0;
-
     for (i = 0; i < def->niothreadids; i++) {
         g_autoptr(virJSONValue) props = NULL;
         const virDomainIOThreadIDDef *iothread = def->iothreadids[i];
@@ -7456,6 +7453,19 @@ qemuBuildIOThreadCommandLine(virCommand *cmd,
             return -1;
     }
 
+    if (def->defaultIOThread) {
+        g_autoptr(virJSONValue) props = NULL;
+
+        if (qemuMonitorCreateObjectProps(&props, "main-loop", "main-loop",
+                                         "k:thread-pool-min", def->defaultIOThread->thread_pool_min,
+                                         "k:thread-pool-max", def->defaultIOThread->thread_pool_max,
+                                         NULL) < 0)
+            return -1;
+
+        if (qemuBuildObjectCommandlineFromJSON(cmd, props, qemuCaps) < 0)
+            return -1;
+    }
+
     return 0;
 }
 
diff --git a/tests/qemuxml2argvdata/iothreads-ids-pool-sizes.x86_64-latest.args b/tests/qemuxml2argvdata/iothreads-ids-pool-sizes.x86_64-latest.args
index 32517e3d29..12747b51f0 100644
--- a/tests/qemuxml2argvdata/iothreads-ids-pool-sizes.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/iothreads-ids-pool-sizes.x86_64-latest.args
@@ -22,6 +22,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -object '{"qom-type":"iothread","id":"iothread1"}' \
 -object '{"qom-type":"iothread","id":"iothread3"}' \
 -object '{"qom-type":"iothread","id":"iothread5"}' \
+-object '{"qom-type":"main-loop","id":"main-loop","thread-pool-min":8,"thread-pool-max":16}' \
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
 -display none \
 -no-user-config \
-- 
2.35.1



More information about the libvir-list mailing list