From: Peter Krempa Date: Fri, 3 Jun 2022 11:22:42 +0000 (+0200) Subject: qemuFirmwareFillDomain: Don't fill in firmware for network backed nvram X-Git-Tag: v8.5.0-rc1~77 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9d8abe04804c417746228467b4fcb79b34c7982c;p=thirdparty%2Flibvirt.git qemuFirmwareFillDomain: Don't fill in firmware for network backed nvram Prepare for network backed nvram by refusing the reset of nvram on boot and don't check whether it exists. We will not support filling it from a template. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko Tested-by: Rohit Kumar --- diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c index dd4273f73a..a219978962 100644 --- a/src/qemu/qemu_firmware.c +++ b/src/qemu/qemu_firmware.c @@ -1371,10 +1371,22 @@ qemuFirmwareFillDomain(virQEMUDriver *driver, def->os.loader->nvramTemplate) return 0; - if (!reset_nvram && def->os.loader->nvram && - virStorageSourceIsLocalStorage(def->os.loader->nvram) && - virFileExists(def->os.loader->nvram->path)) - return 0; + if (def->os.loader->nvram) { + if (!virStorageSourceIsLocalStorage(def->os.loader->nvram)) { + if (reset_nvram) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("resetting of nvram is not supported with network backed nvram")); + return -1; + } + + /* we don't scrutinize whether NVRAM image accessed via network + * is present */ + return 0; + } + + if (!reset_nvram && virFileExists(def->os.loader->nvram->path)) + return 0; + } /* ... then we want to consult JSON FW descriptors first, * but we don't want to fail if we haven't found a match. */