render / rpms / libvirt

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