[PATCH v3 26/38] qemu_firmware: Fill in varstore information

Andrea Bolognani via Devel posted 38 patches 1 week, 5 days ago
There is a newer version of this series
[PATCH v3 26/38] qemu_firmware: Fill in varstore information
Posted by Andrea Bolognani via Devel 1 week, 5 days ago
If the matching firmware requires the use of varstore, we
have to bubble up information about it, namely the path to
the template. If the struct member doesn't exist yet, we need
to allocate it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 src/qemu/qemu_firmware.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c
index 094dd023f9..24f12c0cf1 100644
--- a/src/qemu/qemu_firmware.c
+++ b/src/qemu/qemu_firmware.c
@@ -1493,6 +1493,7 @@ qemuFirmwareEnableFeaturesModern(virDomainDef *def,
     const qemuFirmwareMappingFlash *flash = &fw->mapping.data.flash;
     const qemuFirmwareMappingMemory *memory = &fw->mapping.data.memory;
     virDomainLoaderDef *loader = NULL;
+    virDomainVarstoreDef *varstore = NULL;
     virStorageFileFormat format;
     bool hasSecureBoot = false;
     bool hasEnrolledKeys = false;
@@ -1553,8 +1554,17 @@ qemuFirmwareEnableFeaturesModern(virDomainDef *def,
         VIR_FREE(loader->path);
         loader->path = g_strdup(memory->filename);
 
-        VIR_DEBUG("decided on loader '%s'",
-                  loader->path);
+        if (memory->template) {
+            if (!def->os.varstore)
+                def->os.varstore = virDomainVarstoreDefNew();
+            varstore = def->os.varstore;
+
+            VIR_FREE(varstore->template);
+            varstore->template = g_strdup(memory->template);
+        }
+
+        VIR_DEBUG("decided on loader '%s' template '%s'",
+                  loader->path, NULLSTR(varstore ? varstore->template : NULL));
         break;
 
     case QEMU_FIRMWARE_DEVICE_NONE:
-- 
2.53.0
Re: [PATCH v3 26/38] qemu_firmware: Fill in varstore information
Posted by Daniel P. Berrangé via Devel 1 week ago
On Wed, Feb 18, 2026 at 01:05:49PM +0100, Andrea Bolognani via Devel wrote:
> If the matching firmware requires the use of varstore, we
> have to bubble up information about it, namely the path to
> the template. If the struct member doesn't exist yet, we need
> to allocate it.
> 
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
>  src/qemu/qemu_firmware.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)

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 :|