render / rpms / libvirt

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