]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_validate: Check if QEMU's capable of setting iothread pool size
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 10 May 2022 10:26:29 +0000 (12:26 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 10 Jun 2022 12:00:11 +0000 (14:00 +0200)
Now that we have a capability that reflects whether QEMU is
capable of setting iothread pool size, let's introduce a
validator check to make sure users are not trying to use this
feature with QEMU that doesn't support it.

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

index 9b6245e6d73bfeb26a27708b759b8b3240a67437..7d11ae2c929b11b63aa80f234e392f2fecccee7e 100644 (file)
@@ -384,6 +384,27 @@ qemuValidateDomainDefCpu(virQEMUDriver *driver,
 }
 
 
+static int
+qemuValidateDomainDefIOThreads(const virDomainDef *def,
+                               virQEMUCaps *qemuCaps)
+{
+    size_t i;
+
+    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;
+        }
+    }
+
+    return 0;
+}
+
+
 static int
 qemuValidateDomainDefClockTimers(const virDomainDef *def,
                                  virQEMUCaps *qemuCaps)
@@ -1168,6 +1189,9 @@ qemuValidateDomainDef(const virDomainDef *def,
     if (qemuDomainDefValidateMemoryHotplug(def, NULL) < 0)
         return -1;
 
+    if (qemuValidateDomainDefIOThreads(def, qemuCaps) < 0)
+        return -1;
+
     if (qemuValidateDomainDefClockTimers(def, qemuCaps) < 0)
         return -1;