[libvirt PATCH 14/33] qemu: Only fill nvramTemplate for local sources

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It doesn't make sense for non-local sources, since we can't
create or reset the corresponding NVRAM file.

Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 src/qemu/qemu_firmware.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c
index 13bac9490a..175a4db21d 100644
--- a/src/qemu/qemu_firmware.c
+++ b/src/qemu/qemu_firmware.c
@@ -1194,15 +1194,20 @@ qemuFirmwareEnableFeatures(virQEMUDriver *driver,
                 return -1;
             }
 
-            VIR_FREE(loader->nvramTemplate);
-            loader->nvramTemplate = g_strdup(flash->nvram_template.filename);
-
             if (!loader->nvram) {
                 loader->nvram = virStorageSourceNew();
                 loader->nvram->type = VIR_STORAGE_TYPE_FILE;
                 loader->nvram->format = VIR_STORAGE_FILE_RAW;
                 qemuDomainNVRAMPathFormat(cfg, def, &loader->nvram->path);
             }
+
+            /* If the NVRAM is not a local path then we can't create or
+             * reset it, so in that case filling in the nvramTemplate
+             * field would be misleading */
+            VIR_FREE(loader->nvramTemplate);
+            if (loader->nvram && virStorageSourceIsLocalStorage(loader->nvram)) {
+                loader->nvramTemplate = g_strdup(flash->nvram_template.filename);
+            }
         }
 
         VIR_DEBUG("decided on firmware '%s' template '%s' NVRAM '%s'",
-- 
2.39.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux