486963
From 38e3785cc76842f5a00c9f744f3a581a65b2a73a Mon Sep 17 00:00:00 2001
486963
Message-Id: <38e3785cc76842f5a00c9f744f3a581a65b2a73a@dist-git>
486963
From: Michal Privoznik <mprivozn@redhat.com>
486963
Date: Mon, 21 Mar 2022 17:09:40 +0100
486963
Subject: [PATCH] qemu_validate: Validate prealloc threads against qemuCpas
486963
486963
Only fairly new QEMUs are capable of user provided number of
486963
preallocation threads. Validate this assumption.
486963
486963
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
486963
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
486963
(cherry picked from commit 75a4e0165ef199809974e97b507d3953e1de01d1)
486963
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2075628
486963
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
486963
---
486963
 src/qemu/qemu_validate.c | 7 +++++++
486963
 1 file changed, 7 insertions(+)
486963
486963
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
486963
index 3a69733f81..7bc14293d6 100644
486963
--- a/src/qemu/qemu_validate.c
486963
+++ b/src/qemu/qemu_validate.c
486963
@@ -739,6 +739,13 @@ qemuValidateDomainDefMemory(const virDomainDef *def,
486963
         return -1;
486963
     }
486963
 
486963
+    if (mem->allocation_threads > 0 &&
486963
+        !virQEMUCapsGet(qemuCaps, QEMU_CAPS_MEMORY_BACKEND_PREALLOC_THREADS)) {
486963
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
486963
+                       _("preallocation threads are unsupported with this QEMU"));
486963
+        return -1;
486963
+    }
486963
+
486963
     if (mem->source == VIR_DOMAIN_MEMORY_SOURCE_ANONYMOUS) {
486963
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
486963
                        _("hugepages are not allowed with anonymous "
486963
-- 
486963
2.35.1
486963