From 3257a92f4c6d28f02a31cce0d7a8c82f5f2bc3ee Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Wed, 18 Jun 2025 17:07:22 +0200 Subject: [PATCH] libvirt-10.10.0-13.el9 - qemuPrepareNVRAMFile: Fix NVRAM image conversion check (RHEL-97758) Resolves: RHEL-97758 --- ...ile-Fix-NVRAM-image-conversion-check.patch | 67 +++++++++++++++++++ libvirt.spec | 6 +- 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 libvirt-qemuPrepareNVRAMFile-Fix-NVRAM-image-conversion-check.patch diff --git a/libvirt-qemuPrepareNVRAMFile-Fix-NVRAM-image-conversion-check.patch b/libvirt-qemuPrepareNVRAMFile-Fix-NVRAM-image-conversion-check.patch new file mode 100644 index 0000000..76d666f --- /dev/null +++ b/libvirt-qemuPrepareNVRAMFile-Fix-NVRAM-image-conversion-check.patch @@ -0,0 +1,67 @@ +From 6e265f4f5faa468497e9bbdd86701d17480fcd38 Mon Sep 17 00:00:00 2001 +Message-ID: <6e265f4f5faa468497e9bbdd86701d17480fcd38.1750259242.git.jdenemar@redhat.com> +From: Peter Krempa +Date: Fri, 28 Feb 2025 14:00:23 +0100 +Subject: [PATCH] qemuPrepareNVRAMFile: Fix NVRAM image conversion check + +In case when user provides custom paths (those not covered by the JSON +firmware descriptor files or the default locations) for the +loader and nvram template no auto-detection will be performed and user's +config will be taken at face value. Historically when 'templateFormat' +didn't exist we assumed that the 'format' field covers both. + +Thus if 'templateFormat' is VIR_STORAGE_FILE_NONE we need to skip the +check forbidding image format conversion for 'file' backed to avoid +breaking legacy configs with manual/non-detected format assuming that +user picked the correct format. + +Add a comment to the declaration of 'nvramTemplateFormat' noting the +above for future reference. + +Resolves: https://issues.redhat.com/browse/RHEL-81731 +Fixes: 2aa644a2fc8 +Signed-off-by: Peter Krempa +Reviewed-by: Jiri Denemark +(cherry picked from commit e088895a6246ac3b7f160e1895f2940c4b13b0cc) +https://issues.redhat.com/browse/RHEL-97758 +--- + src/conf/domain_conf.h | 7 +++++++ + src/qemu/qemu_process.c | 5 ++++- + 2 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h +index 961b7b056c..20be6f7c05 100644 +--- a/src/conf/domain_conf.h ++++ b/src/conf/domain_conf.h +@@ -2361,6 +2361,13 @@ struct _virDomainLoaderDef { + virStorageSource *nvram; + bool newStyleNVRAM; + char *nvramTemplate; /* user override of path to master nvram */ ++ /* Historically it was assumed that the format of the template and the ++ * actual nvram image are identical, which is no longer true. ++ * ++ * Note: if 'nvramTemplate' comes from the user and is not overriden by ++ * auto-detection nvramTemplateFormat may be VIR_STORAGE_FILE_NONE. Code ++ * shall assume that the template format matches if it isn't provided. ++ */ + virStorageFileFormat nvramTemplateFormat; + }; + +diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c +index 64683ecfe0..a78aa8569d 100644 +--- a/src/qemu/qemu_process.c ++++ b/src/qemu/qemu_process.c +@@ -4727,7 +4727,10 @@ qemuPrepareNVRAMFile(virQEMUDriver *driver, + return -1; + } + +- if (loader->nvram->format != loader->nvramTemplateFormat) { ++ /* If 'nvramTemplateFormat' is empty it means that it's a user-provided ++ * template which we couldn't verify. Assume the user knows what they're doing */ ++ if (loader->nvramTemplateFormat != VIR_STORAGE_FILE_NONE && ++ loader->nvram->format != loader->nvramTemplateFormat) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("conversion of the nvram template to another target format is not supported")); + return -1; +-- +2.49.0 diff --git a/libvirt.spec b/libvirt.spec index f3cd62c..7028761 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -289,7 +289,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 10.10.0 -Release: 12%{?dist}%{?extra_release} +Release: 13%{?dist}%{?extra_release} License: GPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OFL-1.1 URL: https://libvirt.org/ @@ -441,6 +441,7 @@ Patch141: libvirt-qemu_capabilities-filter-deprecated-features-if-requested.patc Patch142: libvirt-virsh-add-disable-deprecated-features-flag-to-domcapabilities.patch Patch143: libvirt-conf-add-deprecated_features-attribute.patch Patch144: libvirt-redhat-Restore-hunks-in-tests-qemucapabilitiesdata-caps_10.0.0_s390x.patch +Patch145: libvirt-qemuPrepareNVRAMFile-Fix-NVRAM-image-conversion-check.patch Requires: libvirt-daemon = %{version}-%{release} @@ -2766,6 +2767,9 @@ exit 0 %endif %changelog +* Wed Jun 18 2025 Jiri Denemark - 10.10.0-13 +- qemuPrepareNVRAMFile: Fix NVRAM image conversion check (RHEL-97758) + * Wed Jun 4 2025 Jiri Denemark - 10.10.0-12 - qemuMonitorJSONGetCPUModelExpansion: refactor parsing functions (RHEL-89415) - qemu: parse deprecated-props from query-cpu-model-expansion response (RHEL-89415)