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 <pkrempa(a)redhat.com>
---
src/qemu/qemu_firmware.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
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. */
--
2.35.3