]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu_validate: Check if QEMU's capable of setting <defaultiothread/> pool size
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 16 May 2022 11:57:18 +0000 (13:57 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 10 Jun 2022 12:01:06 +0000 (14:01 +0200)
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 defaultiothread pool size.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/qemu/qemu_validate.c

index 7d11ae2c929b11b63aa80f234e392f2fecccee7e..654850f92559228575f2168623b1c00fa01e1762 100644 (file)
@@ -389,18 +389,30 @@ qemuValidateDomainDefIOThreads(const virDomainDef *def,
                                virQEMUCaps *qemuCaps)
 {
     size_t i;
+    bool needsThreadPoolCap = false;
 
     for (i = 0; i < def->niothreadids; i++) {
         virDomainIOThreadIDDef *iothread = def->iothreadids[i];
 
-        if ((iothread->thread_pool_min != -1 || iothread->thread_pool_max != -1) &&
-            !virQEMUCapsGet(qemuCaps, QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX)) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("thread_pool_min and thread_pool_max is not supported by this QEMU binary"));
-            return -1;
+        if (iothread->thread_pool_min != -1 || iothread->thread_pool_max != -1) {
+            needsThreadPoolCap = true;
+            break;
         }
     }
 
+    if (def->defaultIOThread &&
+        (def->defaultIOThread->thread_pool_min >= 0 ||
+         def->defaultIOThread->thread_pool_max >= 0)) {
+        needsThreadPoolCap = true;
+    }
+
+    if (needsThreadPoolCap &&
+        !virQEMUCapsGet(qemuCaps, QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX)) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("thread_pool_min and thread_pool_max is not supported by this QEMU binary"));
+        return -1;
+    }
+
     return 0;
 }