]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Validate presence of uefi-vars device
authorAndrea Bolognani <abologna@redhat.com>
Fri, 21 Nov 2025 18:32:31 +0000 (19:32 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Tue, 24 Feb 2026 10:29:06 +0000 (11:29 +0100)
The use of varstore requires the uefi-vars device to be present
in the QEMU binary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/qemu/qemu_validate.c

index 16dd5fef1aafea95657b32dee79f06c3395900cd..0eb5d5ea3b7d875bc6397539dc1e87f4a260a8c2 100644 (file)
@@ -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++) {