]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_validate: Validate prealloc threads against qemuCpas
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 21 Mar 2022 16:09:40 +0000 (17:09 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 24 Mar 2022 14:46:00 +0000 (15:46 +0100)
Only fairly new QEMUs are capable of user provided number of
preallocation threads. Validate this assumption.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/qemu/qemu_validate.c

index f27e480696faddbc07a4cf88c0e8b9f6977452c1..e0708b8a762bf8d49ae26e0744dcc69459eea3d5 100644 (file)
@@ -739,6 +739,13 @@ qemuValidateDomainDefMemory(const virDomainDef *def,
         return -1;
     }
 
+    if (mem->allocation_threads > 0 &&
+        !virQEMUCapsGet(qemuCaps, QEMU_CAPS_MEMORY_BACKEND_PREALLOC_THREADS)) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("preallocation threads are unsupported with this QEMU"));
+        return -1;
+    }
+
     if (mem->source == VIR_DOMAIN_MEMORY_SOURCE_ANONYMOUS) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("hugepages are not allowed with anonymous "