[PATCH v2 24/38] qemu_firmware: Use of NVRAM implies stateful firmware

Andrea Bolognani via Devel posted 38 patches 12 hours ago
[PATCH v2 24/38] qemu_firmware: Use of NVRAM implies stateful firmware
Posted by Andrea Bolognani via Devel 12 hours ago
Currently we only look at the value for the stateless attribute
itself when matching, but the <nvram> element being included in
the input XML is likewise a clear sign that a stateless firmware
build will not satisfy the user's requirements.

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

diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c
index 1d7b5b58b7..d308dba262 100644
--- a/src/qemu/qemu_firmware.c
+++ b/src/qemu/qemu_firmware.c
@@ -1289,13 +1289,19 @@ qemuFirmwareMatchDomain(const virDomainDef *def,
         /* Explicit requests for either a stateless or stateful
          * firmware should be fulfilled, but if no preference is
          * provided either one is fine as long as the other match
-         * criteria are satisfied */
+         * criteria are satisfied. NVRAM implies stateful */
         if (loader &&
             loader->stateless == VIR_TRISTATE_BOOL_NO &&
             flash->mode == QEMU_FIRMWARE_FLASH_MODE_STATELESS) {
             VIR_DEBUG("Discarding stateless loader");
             return false;
         }
+        if (loader &&
+            loader->nvram &&
+            flash->mode == QEMU_FIRMWARE_FLASH_MODE_STATELESS) {
+            VIR_DEBUG("Discarding stateless loader");
+            return false;
+        }
         if (loader &&
             loader->stateless == VIR_TRISTATE_BOOL_YES &&
             flash->mode != QEMU_FIRMWARE_FLASH_MODE_STATELESS) {
-- 
2.53.0