mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
qemu: block: Add support for accessing directories via the 'vvfat' driver
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@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
c9b27af32d
commit
2b26ea1441
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user