[RFC PATCH 09/30] qemu: block: Add support for accessing directories via the 'vvfat' driver

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

 



Handle VIR_STORAGE_TYPE_DIR in qemuBlockStorageSourceGetBackendProps so
that a 'vvfat' driver is used, which emulates a FAT filesystem
containing the folders.

qemu requires us to add it as a storage layer, since a 'raw' layer is
usually put on top of it.

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

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 6cf41cf544..516b006ce9 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -992,6 +992,25 @@ qemuBlockStorageSourceGetFileProps(virStorageSourcePtr src)
 }


+static virJSONValuePtr
+qemuBlockStorageSourceGetVvfatProps(virStorageSourcePtr src)
+{
+    virJSONValuePtr ret = NULL;
+
+    /* libvirt currently does not handle the following attributes:
+     * '*fat-type': 'int'
+     * '*label': 'str'
+     */
+    ignore_value(virJSONValueObjectCreate(&ret,
+                                          "s:driver", "vvfat",
+                                          "s:dir", src->path,
+                                          "b:floppy", src->floppyimg,
+                                          "b:rw", !src->readonly, NULL));
+
+    return ret;
+}
+
+
 /**
  * qemuBlockStorageSourceGetBackendProps:
  * @src: disk source
@@ -1008,11 +1027,17 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src)
     switch ((virStorageType) actualType) {
     case VIR_STORAGE_TYPE_BLOCK:
     case VIR_STORAGE_TYPE_FILE:
-    case VIR_STORAGE_TYPE_DIR:
         if (!(fileprops = qemuBlockStorageSourceGetFileProps(src)))
             return NULL;
         break;

+    case VIR_STORAGE_TYPE_DIR:
+        /* qemu handles directories by exposing them as a device with emulated
+         * FAT filesystem */
+        if (!(fileprops = qemuBlockStorageSourceGetVvfatProps(src)))
+            return NULL;
+        break;
+
     case VIR_STORAGE_TYPE_VOLUME:
     case VIR_STORAGE_TYPE_NONE:
     case VIR_STORAGE_TYPE_LAST:
-- 
2.14.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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