From 0c9b70d5900a5108e899edfdd6f3790f8cb6bdc2 Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Tue, 27 Oct 2020 20:05:42 +0100 Subject: fuse: Allow exporting BDSs via FUSE block-export-add type=fuse allows mounting block graph nodes via FUSE on some existing regular file. That file should then appears like a raw disk image, and accesses to it result in accesses to the exported BDS. Right now, we only implement the necessary block export functions to set it up and shut it down. We do not implement any access functions, so accessing the mount point only results in errors. This will be addressed by a followup patch. We keep a hash table of exported mount points, because we want to be able to detect when users try to use a mount point twice. This is because we invoke stat() to check whether the given mount point is a regular file, but if that file is served by ourselves (because it is already used as a mount point), then this stat() would have to be served by ourselves, too, which is impossible to do while we (as the caller) are waiting for it to settle. Therefore, keep track of mount point paths to at least catch the most obvious instances of that problem. Signed-off-by: Max Reitz Message-Id: <20201027190600.192171-3-mreitz@redhat.com> Signed-off-by: Kevin Wolf --- qapi/block-export.json | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'qapi') diff --git a/qapi/block-export.json b/qapi/block-export.json index 4eeac7842d..430bc69f35 100644 --- a/qapi/block-export.json +++ b/qapi/block-export.json @@ -120,6 +120,21 @@ '*logical-block-size': 'size', '*num-queues': 'uint16'} } +## +# @BlockExportOptionsFuse: +# +# Options for exporting a block graph node on some (file) mountpoint +# as a raw image. +# +# @mountpoint: Path on which to export the block device via FUSE. +# This must point to an existing regular file. +# +# Since: 6.0 +## +{ 'struct': 'BlockExportOptionsFuse', + 'data': { 'mountpoint': 'str' }, + 'if': 'defined(CONFIG_FUSE)' } + ## # @NbdServerAddOptions: # @@ -222,11 +237,13 @@ # # @nbd: NBD export # @vhost-user-blk: vhost-user-blk export (since 5.2) +# @fuse: FUSE export (since: 6.0) # # Since: 4.2 ## { 'enum': 'BlockExportType', - 'data': [ 'nbd', 'vhost-user-blk' ] } + 'data': [ 'nbd', 'vhost-user-blk', + { 'name': 'fuse', 'if': 'defined(CONFIG_FUSE)' } ] } ## # @BlockExportOptions: @@ -267,7 +284,9 @@ 'discriminator': 'type', 'data': { 'nbd': 'BlockExportOptionsNbd', - 'vhost-user-blk': 'BlockExportOptionsVhostUserBlk' + 'vhost-user-blk': 'BlockExportOptionsVhostUserBlk', + 'fuse': { 'type': 'BlockExportOptionsFuse', + 'if': 'defined(CONFIG_FUSE)' } } } ## -- cgit v1.2.3-55-g7522