[PATCH 15/16] qemu_validate: Check if QEMU's capable of setting main loop pool size

Michal Privoznik mprivozn at redhat.com
Thu Jun 2 07:18:05 UTC 2022


Since the main-loop and iothread classes are derived from the
same class (EventLoopBaseClass) we don't need new capability and
can use QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX directly to check
whether QEMU's capable of setting worker pool size.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/qemu/qemu_validate.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 21b3407b2f..36153c69c7 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -405,6 +405,23 @@ qemuValidateDomainDefIOThreads(const virDomainDef *def,
 }
 
 
+static int
+qemuValidateDomainDefMainLoop(const virDomainDef *def,
+                              virQEMUCaps *qemuCaps)
+{
+    if (!def->mainLoop)
+        return 0;
+
+    if ((def->mainLoop->pool_min >= 0 || def->mainLoop->pool_max >= 0) &&
+        !virQEMUCapsGet(qemuCaps, QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX)) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("pool_min and pool_max is not supported by this QEMU binary"));
+        return -1;
+    }
+
+    return 0;
+}
+
 static int
 qemuValidateDomainDefClockTimers(const virDomainDef *def,
                                  virQEMUCaps *qemuCaps)
@@ -1192,6 +1209,9 @@ qemuValidateDomainDef(const virDomainDef *def,
     if (qemuValidateDomainDefIOThreads(def, qemuCaps) < 0)
         return -1;
 
+    if (qemuValidateDomainDefMainLoop(def, qemuCaps) < 0)
+        return -1;
+
     if (qemuValidateDomainDefClockTimers(def, qemuCaps) < 0)
         return -1;
 
-- 
2.35.1



More information about the libvir-list mailing list