diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index bc03af89b1..9098399cf2 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: