[PATCH v3 10/38] qemu: Validate presence of uefi-vars device

Andrea Bolognani via Devel posted 38 patches 1 week, 5 days ago
There is a newer version of this series
[PATCH v3 10/38] qemu: Validate presence of uefi-vars device
Posted by Andrea Bolognani via Devel 1 week, 5 days ago
The use of varstore requires the uefi-vars device to be present
in the QEMU binary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 src/qemu/qemu_validate.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 16dd5fef1a..0eb5d5ea3b 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -753,6 +753,23 @@ qemuValidateDomainDefNvram(const virDomainDef *def,
 }
 
 
+static int
+qemuValidateDomainDefVarstore(const virDomainDef *def,
+                              virQEMUCaps *qemuCaps)
+{
+    if (!def->os.varstore)
+        return 0;
+
+    if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_UEFI_VARS)) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("The uefi-vars device is not supported by this QEMU binary"));
+        return -1;
+    }
+
+    return 0;
+}
+
+
 static int
 qemuValidateDomainDefBoot(const virDomainDef *def,
                           virQEMUCaps *qemuCaps)
@@ -796,6 +813,9 @@ qemuValidateDomainDefBoot(const virDomainDef *def,
 
         if (qemuValidateDomainDefNvram(def, qemuCaps) < 0)
             return -1;
+
+        if (qemuValidateDomainDefVarstore(def, qemuCaps) < 0)
+            return -1;
     }
 
     for (i = 0; i < def->os.nacpiTables; i++) {
-- 
2.53.0
Re: [PATCH v3 10/38] qemu: Validate presence of uefi-vars device
Posted by Daniel P. Berrangé via Devel 1 week ago
On Wed, Feb 18, 2026 at 01:05:33PM +0100, Andrea Bolognani via Devel wrote:
> The use of varstore requires the uefi-vars device to be present
> in the QEMU binary.
> 
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
>  src/qemu/qemu_validate.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|