- qemu_firmware: Drop support for kernel descriptors (RHEL-82645) - qemu_firmware: Drop 'nvram' local variable (RHEL-82645) - qemu_firmware: Move format=raw compat exception (RHEL-82645) - qemu_firmware: Move copying of nvram.format to loader.format (RHEL-82645) - tests: Add firmware-manual-efi-rw-nvram (RHEL-82645) - domain_validate: Reject NVRAM with read/write firmware (RHEL-82645) - tests: Add firmware-auto-bios-rw (RHEL-82645) - tests: Add firmware-manual-bios-rw (RHEL-82645) - domain_validate: Reject read/write ROMs (RHEL-82645) - tests: Add firmware-auto-efi-format-loader-qcow2-rom (RHEL-82645) - domain_validate: Reject ROMs with format other than raw (RHEL-82645) - qemu_firmware: Ignore stateless/combined when NVRAM is configured (RHEL-82645) - qemu_firmware: Drop fallback for absent nvramTemplateFormat (RHEL-82645) - schemas: Allow templateFormat without template path (RHEL-82645) - tests: Add firmware-manual-efi-nvram-template-nonstandard-format (RHEL-82645) - tests: Add firmware-manual-efi-nvram-template-nonstandard-legacy-paths (RHEL-82645) - tests: Add firmware-auto-efi-format-nvram-raw (RHEL-82645) - tests: Add firmware-auto-efi-format-nvram-raw-loader-path (RHEL-82645) - tests: Add firmware-auto-efi-format-nvram-raw-nvramtemplate-path (RHEL-82645) - tests: Add firmware-auto-efi-format-nvramtemplate-qcow2 (RHEL-82645) - tests: Add firmware-auto-efi-format-mismatch-nvramtemplate (RHEL-82645) - qemu_firmware: Introduce qemuFirmwareFillDomainCustom() (RHEL-82645) - qemu_firmware: Set templateFormat for custom paths (RHEL-82645) - qemu_firmware: Simplify handling of legacy paths (RHEL-82645) - qemu_firmware: Refactor setting NVRAM format (RHEL-82645) - qemu_firmware: Prefer template format to loader format (RHEL-82645) - qemu_firmware: Retain user-specified NVRAM format (RHEL-82645) - qemu_firmware: Take templateFormat into account when matching (RHEL-82645) - qemu_firmware: Take NVRAM format into account when matching (RHEL-82645) - qemu_firmware: Remove NVRAM to loader format copy hack (RHEL-82645) - tests: Add firmware-manual-efi-sev-snp (RHEL-82645) - tests: Add firmware-manual-efi-tdx (RHEL-82645) - qemu_firmware: ROM firmware is always in raw format (RHEL-82645) - qemu_firmware: Don't skip autoselection for ROM (RHEL-82645) - qemu_firmware: Allow matching both UEFI and BIOS for ROM loader (RHEL-82645) - schema: Add firmwareFeatures element for domaincaps (RHEL-82645) - conf: Add firmwareFeatures element for domaincaps (RHEL-82645) - qemu: Fill in firmwareFeature element for domaincaps (RHEL-82645) - docs: Document firmwareFeature element for domaincaps (RHEL-82645) - docs: Rename "BIOS bootloader" section to "guest firmware" (RHEL-82645) - docs: Improvement related to firmware selection (RHEL-82645) - qemu_firmware: Only set format for custom loader if path is present (RHEL-82645) - conf: Move type=rom default for loader to drivers (RHEL-82645) - tests: Rename custom JSON firmware descriptors (RHEL-82645) - schema: Introduce osnvram define (RHEL-82645) - conf: Parse and format varstore element (RHEL-82645) - conf: Update validation to consider varstore element (RHEL-82645) - qemu_capabilities: Introduce QEMU_CAPS_DEVICE_UEFI_VARS (RHEL-82645) - qemu: Validate presence of uefi-vars device (RHEL-82645) - tests: Add firmware-manual-efi-varstore-q35 (RHEL-82645) - tests: Add firmware-manual-efi-varstore-aarch64 (RHEL-82645) - tests: Add firmware-auto-efi-varstore-q35 (RHEL-82645) - tests: Add firmware-auto-efi-varstore-aarch64 (RHEL-82645) - tests: Add firmware-auto-efi-enrolled-keys-aarch64 (RHEL-82645) - qemu_firmware: Parse host-uefi-vars firmware feature (RHEL-82645) - qemu_firmware: Split sanity check (RHEL-82645) - qemu_firmware: Consider host-uefi-vars feature in sanity check (RHEL-82645) - qemu_firmware: Support extended syntax for ROM firmware descriptors (RHEL-82645) - qemu_firmware: Report NVRAM template path for ROMs (RHEL-82645) - conf: Include varstore element in domcaps (RHEL-82645) - qemu: Fill in varstore element in domcaps (RHEL-82645) - qemu_firmware: Use of NVRAM implies stateful firmware (RHEL-82645) - qemu_firmware: Allow matching stateful ROMs (RHEL-82645) - qemu_firmware: Fill in varstore information (RHEL-82645) - qemu: Introduce varstoreDir (RHEL-82645) - qemu_firmware: Generate varstore path when necessary (RHEL-82645) - qemu: Introduce qemuPrepareNVRAMFileCommon() (RHEL-82645) - qemu: Create and delete varstore file (RHEL-82645) - security: Mark ROMs as read only when using AppArmor (RHEL-82645) - security: Handle varstore file (RHEL-82645) - tests: Add firmware descriptors for uefi-vars builds (RHEL-82645) - qemu_command: Use uefi-vars device where appropriate (RHEL-82645) - include: Mention varstore where applicable (RHEL-82645) - virsh: Update for varstore handling (RHEL-82645) - domain_conf: initialize network hostdev private data (RHEL-151916) - qemu_hotplug: enter monitor in order to rollback passed FD (RHEL-151916) Resolves: RHEL-151916, RHEL-82645
119 lines
4.3 KiB
Diff
119 lines
4.3 KiB
Diff
From ab8dbe11d56790f6fd140919559ad7610cc1f535 Mon Sep 17 00:00:00 2001
|
|
Message-ID: <ab8dbe11d56790f6fd140919559ad7610cc1f535.1772815314.git.jdenemar@redhat.com>
|
|
From: Andrea Bolognani <abologna@redhat.com>
|
|
Date: Fri, 23 Jan 2026 19:47:13 +0100
|
|
Subject: [PATCH] qemu: Create and delete varstore file
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Simply mimicking what is currently done for NVRAM files does
|
|
the trick. A few user-visible messages are updated to reflect
|
|
the fact that they apply both to NVRAM and varstore.
|
|
|
|
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>
|
|
(cherry picked from commit 5dc97de2c4fb4c2097c29cbe0eb38e3cdb4e92b0)
|
|
|
|
https://issues.redhat.com/browse/RHEL-82645
|
|
|
|
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
|
---
|
|
src/qemu/qemu_driver.c | 14 +++++++++-----
|
|
src/qemu/qemu_process.c | 28 ++++++++++++++++++++++++++--
|
|
2 files changed, 35 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
index d314aa94ce..ad894c7584 100644
|
|
--- a/src/qemu/qemu_driver.c
|
|
+++ b/src/qemu/qemu_driver.c
|
|
@@ -6639,22 +6639,26 @@ qemuDomainUndefineFlags(virDomainPtr dom,
|
|
}
|
|
}
|
|
|
|
- if (vm->def->os.loader && vm->def->os.loader->nvram &&
|
|
- virStorageSourceIsLocalStorage(vm->def->os.loader->nvram)) {
|
|
- nvram_path = g_strdup(vm->def->os.loader->nvram->path);
|
|
+ if (vm->def->os.loader) {
|
|
+ if (vm->def->os.loader->nvram &&
|
|
+ virStorageSourceIsLocalStorage(vm->def->os.loader->nvram)) {
|
|
+ nvram_path = g_strdup(vm->def->os.loader->nvram->path);
|
|
+ } else if (vm->def->os.varstore && vm->def->os.varstore->path) {
|
|
+ nvram_path = g_strdup(vm->def->os.varstore->path);
|
|
+ }
|
|
}
|
|
|
|
if (nvram_path && virFileExists(nvram_path)) {
|
|
if ((flags & VIR_DOMAIN_UNDEFINE_NVRAM)) {
|
|
if (unlink(nvram_path) < 0) {
|
|
virReportSystemError(errno,
|
|
- _("failed to remove nvram: %1$s"),
|
|
+ _("Failed to remove NVRAM/varstore: %1$s"),
|
|
nvram_path);
|
|
goto endjob;
|
|
}
|
|
} else if (!(flags & VIR_DOMAIN_UNDEFINE_KEEP_NVRAM)) {
|
|
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
|
- _("cannot undefine domain with nvram"));
|
|
+ _("Cannot undefine domain with NVRAM/varstore"));
|
|
goto endjob;
|
|
}
|
|
}
|
|
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
|
index 47deb9abb9..3ca87df284 100644
|
|
--- a/src/qemu/qemu_process.c
|
|
+++ b/src/qemu/qemu_process.c
|
|
@@ -5031,6 +5031,27 @@ qemuPrepareNVRAM(virQEMUDriver *driver,
|
|
}
|
|
|
|
|
|
+static int
|
|
+qemuPrepareVarstore(virQEMUDriver *driver,
|
|
+ virDomainDef *def,
|
|
+ bool reset_nvram)
|
|
+{
|
|
+ virDomainLoaderDef *loader = def->os.loader;
|
|
+ virDomainVarstoreDef *varstore = def->os.varstore;
|
|
+
|
|
+ if (!loader || !varstore)
|
|
+ return 0;
|
|
+
|
|
+ VIR_DEBUG("varstore='%s'", NULLSTR(varstore->path));
|
|
+
|
|
+ if (qemuPrepareNVRAMFileCommon(driver, varstore->path,
|
|
+ varstore->template, reset_nvram) < 0)
|
|
+ return -1;
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+
|
|
static void
|
|
qemuLogOperation(virDomainObj *vm,
|
|
const char *msg,
|
|
@@ -7795,6 +7816,7 @@ qemuProcessPrepareHost(virQEMUDriver *driver,
|
|
unsigned int hostdev_flags = 0;
|
|
qemuDomainObjPrivate *priv = vm->privateData;
|
|
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
|
|
+ bool reset_nvram = !!(flags & VIR_QEMU_PROCESS_START_RESET_NVRAM);
|
|
|
|
/*
|
|
* Create all per-domain directories in order to make sure domain
|
|
@@ -7804,8 +7826,10 @@ qemuProcessPrepareHost(virQEMUDriver *driver,
|
|
qemuProcessMakeDir(driver, vm, priv->channelTargetDir) < 0)
|
|
return -1;
|
|
|
|
- if (qemuPrepareNVRAM(driver, vm->def,
|
|
- !!(flags & VIR_QEMU_PROCESS_START_RESET_NVRAM)) < 0)
|
|
+ if (qemuPrepareNVRAM(driver, vm->def, reset_nvram) < 0)
|
|
+ return -1;
|
|
+
|
|
+ if (qemuPrepareVarstore(driver, vm->def, reset_nvram) < 0)
|
|
return -1;
|
|
|
|
if (vm->def->vsock) {
|
|
--
|
|
2.53.0
|