The file extension needs to match the format. In the case of JSON, we're ditching the _VARS part of the filename too.
Having that in there made a lot of sense in the beginning, when OVMF_CODE.fd and OVMF_VARS.fd were used for the executable and NVRAM template respectively, and a similar pattern was used for AAVMF (aka edk2 on aarch64) as well. These days, the aarch64 build of edk2 has ditched the pattern, so the only remaining holdout is the x86_64 build; the uefi-vars build doesn't use _CODE and _VARS on any architecture. It's a good time to get rid of this vestigial part of the filename. Signed-off-by: Andrea Bolognani <[email protected]> --- src/qemu/qemu_firmware.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c index 962d6cdee7..0504eef727 100644 --- a/src/qemu/qemu_firmware.c +++ b/src/qemu/qemu_firmware.c @@ -1073,7 +1073,7 @@ qemuFirmwareEnsureNVRAM(virDomainDef *def, g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); virDomainLoaderDef *loader = def->os.loader; virStorageFileFormat nvramFormat = VIR_STORAGE_FILE_NONE; - const char *ext = NULL; + const char *suffix = NULL; if (!loader) return; @@ -1134,16 +1134,18 @@ qemuFirmwareEnsureNVRAM(virDomainDef *def, if (abiUpdate && loader->nvramTemplate && virStringHasSuffix(loader->nvramTemplate, ".raw")) - ext = ".raw"; + suffix = "_VARS.raw"; else - ext = ".fd"; + suffix = "_VARS.fd"; } if (loader->nvram->format == VIR_STORAGE_FILE_QCOW2) - ext = ".qcow2"; + suffix = "_VARS.qcow2"; + if (loader->nvram->format == VIR_STORAGE_FILE_JSON) + suffix = ".json"; - loader->nvram->path = g_strdup_printf("%s/%s_VARS%s", + loader->nvram->path = g_strdup_printf("%s/%s%s", cfg->nvramDir, def->name, - NULLSTR_EMPTY(ext)); + NULLSTR_EMPTY(suffix)); } -- 2.52.0
