Skip to contentSkip to conversation

qsd: Document FUSE exports

PATCH In review Max Reitz 2 participants 4 messages Feb 17, 2021 – Mar 29, 2021

lore
Share & tools
lore

Max Reitz

author
#0 lore raw

PATCH 1/1 qsd: Document FUSE exports

Implementing FUSE exports required no changes to the storage daemon, so we forgot to document them there. Considering that both NBD and vhost-user-blk exports are documented in its man page (and NBD exports in its --help text), we should probably do the same for FUSE.

---
 docs/tools/qemu-storage-daemon.rst   | 19 +++++++++++++++++++
 storage-daemon/qemu-storage-daemon.c |  4 ++++
 2 files changed, 23 insertions(+)
docs/tools/qemu-storage-daemon.rst +19 -0
index f63627eaf6..f5a906f6fc 100644
@@ -74,6 +74,7 @@ Standard options:
 .. option:: --export [type=]nbd,id=<id>,node-name=<node-name>[,name=<export-name>][,writable=on|off][,bitmap=<name>]
   --export [type=]vhost-user-blk,id=<id>,node-name=<node-name>,addr.type=unix,addr.path=<socket-path>[,writable=on|off][,logical-block-size=<block-size>][,num-queues=<num-queues>]
   --export [type=]vhost-user-blk,id=<id>,node-name=<node-name>,addr.type=fd,addr.str=<fd>[,writable=on|off][,logical-block-size=<block-size>][,num-queues=<num-queues>]
+  --export [type=]fuse,id=<id>,node-name=<node-name>,mountpoint=<file>[,growable=on|off][,writable=on|off]
 
   is a block export definition. ``node-name`` is the block node that should be
   exported. ``writable`` determines whether or not the export allows write
@@ -91,6 +92,16 @@ Standard options:
   ``logical-block-size`` sets the logical block size in bytes (the default is
   512). ``num-queues`` sets the number of virtqueues (the default is 1).
 
+  The ``fuse`` export type takes a mount point, which must be a regular file,
+  on which to export the given block node. That file will not be changed, it
+  will just appear to have the block node's content while the export is active
+  (very much like mounting a filesystem on a directory does not change what the
+  directory contains, it only shows a different content while the filesystem is
+  mounted). Consequently, applications that have opened the given file before
+  the export became active will continue to see its original content. If
+  ``growable`` is set, writes after the end of the exported file will grow the
+  block node to fit.
+
 .. option:: --monitor MONITORDEF
 
   is a QMP monitor definition. See the :manpage:`qemu(1)` manual page for
@@ -142,6 +153,14 @@ domain socket ``vhost-user-blk.sock``::
       --blockdev driver=qcow2,node-name=qcow2,file=file \
       --export type=vhost-user-blk,id=export,addr.type=unix,addr.path=vhost-user-blk.sock,node-name=qcow2
 
+Export a qcow2 image file ``disk.qcow2`` via FUSE on itself, so the disk image
+file will then appear as a raw image::
+
+  $ qemu-storage-daemon \
+      --blockdev driver=file,node-name=file,filename=disk.qcow2 \
+      --blockdev driver=qcow2,node-name=qcow2,file=file \
+      --export type=fuse,id=export,node-name=qcow2,mountpoint=disk.qcow2,writable=on
+
 See also
 --------
 
storage-daemon/qemu-storage-daemon.c +4 -0
index 9021a46b3a..bdf8877995 100644
@@ -97,6 +97,10 @@ static void help(void)
 "                         export the specified block node over NBD\n"
 "                         (requires --nbd-server)\n"
 "\n"
+"  --export [type=]fuse,id=<id>,node-name=<node-name>,mountpoint=<file>\n"
+"           [,growable=on|off][,writable=on|off]\n"
+"                         export the specified block node over FUSE\n"
+"\n"
 "  --monitor [chardev=]name[,mode=control][,pretty[=on|off]]\n"
 "                         configure a QMP monitor\n"
 "\n"
Signature · 1 line
2.29.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Max Reitz

Implementing FUSE exports required no changes to the storage daemon, so we forgot to document them there. Considering that both NBD and vhost-user-blk exports are documented in its man page (and NBD exports in its --help text), we should probably do the same for FUSE.

---
 docs/tools/qemu-storage-daemon.rst   | 19 +++++++++++++++++++
 storage-daemon/qemu-storage-daemon.c |  4 ++++
 2 files changed, 23 insertions(+)
docs/tools/qemu-storage-daemon.rst +0 -0
@@ -142,6 +153,14 @@ domain socket ``vhost-user-blk.sock``::
       --blockdev driver=qcow2,node-name=qcow2,file=file \

docs/tools/qemu-storage-daemon.rst domain socket ``vhost-user-blk.sock``:: · line 163

Quoted 10 lines
docs/tools/qemu-storage-daemon.rst +8 -0
       --export type=vhost-user-blk,id=export,addr.type=unix,addr.path=vhost-user-blk.sock,node-name=qcow2
 
+Export a qcow2 image file ``disk.qcow2`` via FUSE on itself, so the disk image
+file will then appear as a raw image::
+
+  $ qemu-storage-daemon \
+      --blockdev driver=file,node-name=file,filename=disk.qcow2 \
+      --blockdev driver=qcow2,node-name=qcow2,file=file \
+      --export type=fuse,id=export,node-name=qcow2,mountpoint=disk.qcow2,writable=on
+

Should the example also mention how to unmount the file when you're done?

Otherwise looks good to me. Any documentation is better than none, even if we can add more, so

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
author
#2 lore raw
Quoted 16 lines · Eric Blake
Quoted 15 lines · Max Reitz

Implementing FUSE exports required no changes to the storage daemon, so we forgot to document them there. Considering that both NBD and vhost-user-blk exports are documented in its man page (and NBD exports in its --help text), we should probably do the same for FUSE.

---
  docs/tools/qemu-storage-daemon.rst   | 19 +++++++++++++++++++
  storage-daemon/qemu-storage-daemon.c |  4 ++++
  2 files changed, 23 insertions(+)
docs/tools/qemu-storage-daemon.rst +0 -0
@@ -142,6 +153,14 @@ domain socket ``vhost-user-blk.sock``::
        --blockdev driver=qcow2,node-name=qcow2,file=file \
        --export type=vhost-user-blk,id=export,addr.type=unix,addr.path=vhost-user-blk.sock,node-name=qcow2
 
Quoted 10 lines

docs/tools/qemu-storage-daemon.rst domain socket ``vhost-user-blk.sock``:: · line 163

Quoted 8 lines
docs/tools/qemu-storage-daemon.rst +8 -0
+Export a qcow2 image file ``disk.qcow2`` via FUSE on itself, so the disk image
+file will then appear as a raw image::
+
+  $ qemu-storage-daemon \
+      --blockdev driver=file,node-name=file,filename=disk.qcow2 \
+      --blockdev driver=qcow2,node-name=qcow2,file=file \
+      --export type=fuse,id=export,node-name=qcow2,mountpoint=disk.qcow2,writable=on
+

Should the example also mention how to unmount the file when you're done?

Just as with other exports, the export goes away when it is deleted, which happens e.g. when the QSD exits. I.e., fuse_export_delete() calls fuse_session_unmount().

Quoted 4 lines

Otherwise looks good to me. Any documentation is better than none, even if we can add more, so

Thanks!

Max

author
#3 lore raw
In reply to Max Reitz
Quoted 10 lines · Max Reitz

Implementing FUSE exports required no changes to the storage daemon, so we forgot to document them there. Considering that both NBD and vhost-user-blk exports are documented in its man page (and NBD exports in its --help text), we should probably do the same for FUSE.

---
  docs/tools/qemu-storage-daemon.rst   | 19 +++++++++++++++++++
  storage-daemon/qemu-storage-daemon.c |  4 ++++
  2 files changed, 23 insertions(+)

Thanks for the review, applied to my block branch:

https://git.xanclic.moe/XanClic/qemu/commits/branch/block

Max