[PATCH 01/13] qemuPrepareNVRAM: Don't attempt to create NVRAM on block device

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

 



'virFileRewrite()' which is used to setup the NVRAM image if it doesn't
exist or when it is requested by the user forcibly replaces the
destination file by the file it creates. For block devices this
overwrites the device node file or the symlink pointing to the device
node by a regular file instead of formatting it.

As this not only makes the VM fail to start but also breaks user's /dev/
filesystem forbid it for now.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_process.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 0815bffe3c..7a40e09d47 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4609,6 +4609,14 @@ qemuPrepareNVRAM(virQEMUDriver *driver,
     if (virFileExists(loader->nvram->path) && !reset_nvram)
         return 0;

+    /* virFileRewrite() would overwrite the device node-file/symlink rather than
+     * just write the data to it, thus block-device nvram is not yet supported */
+    if (virStorageSourceIsBlockLocal(loader->nvram)) {
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                       _("creation or formatting of nvram type='block' is not supported"));
+        return -1;
+    }
+
     if (!loader->nvramTemplate) {
         virReportError(VIR_ERR_OPERATION_FAILED,
                        _("unable to find any master var store for loader: %1$s"),
-- 
2.47.0




[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