aboutsummaryrefslogtreecommitdiff
path: root/docs/interop
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-01-23 15:22:39 +0000
committerPeter Maydell <peter.maydell@linaro.org>2020-01-23 15:22:39 +0000
commit87c0868f467db84df930fe687241d9cc2bfd1dd2 (patch)
tree9b20729cbcd67bf31f87a0dd99a462b26eac3991 /docs/interop
parent53eccc70343727a13b010d1d5b172c8f3dd21bb7 (diff)
qemu-nbd: Convert invocation documentation to rST
The qemu-nbd documentation is currently in qemu-nbd.texi in Texinfo format, which we present to the user as: * a qemu-nbd manpage * a section of the main qemu-doc HTML documentation Convert the documentation to rST format, and present it to the user as: * a qemu-nbd manpage * part of the interop/ Sphinx manual This follows the same pattern as commit 27a296fce982 did for the qemu-ga manpage. All the content of the old manpage is retained, except that I have dropped the "This is free software; see the source for copying conditions. There is NO warranty..." text that was in the old AUTHOR section; Sphinx's manpage builder doesn't expect that much text in the AUTHOR section, and since none of our other manpages have it it seems easiest to delete it rather than try to figure out where else in the manpage to put it. The only other textual change is that I have had to give the --nocache option its own description ("Equivalent to --cache=none") because Sphinx doesn't have an equivalent of using item/itemx to share a description between two options. Some minor aspects of the formatting have changed, to suit what is easiest for Sphinx to output. (The most notable is that Sphinx option section option syntax doesn't support '--option foo=bar' with bar underlined rather than bold, so we have to switch to '--option foo=BAR' instead.) The contents of qemu-option-trace.texi are now duplicated in docs/interop/qemu-option-trace.rst.inc, until such time as we complete the conversion of the other files which use it; since it has had only 3 changes in 3 years, this shouldn't be too awkward a burden. (We use .rst.inc because if this file fragment has a .rst extension then Sphinx complains about not seeing it in a toctree.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Eric Blake <eblake@redhat.com> Tested-by: Alex Bennée <alex.bennee@linaro.org> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20200116141511.16849-2-peter.maydell@linaro.org
Diffstat (limited to 'docs/interop')
-rw-r--r--docs/interop/conf.py4
-rw-r--r--docs/interop/index.rst1
-rw-r--r--docs/interop/qemu-nbd.rst263
-rw-r--r--docs/interop/qemu-option-trace.rst.inc30
4 files changed, 297 insertions, 1 deletions
diff --git a/docs/interop/conf.py b/docs/interop/conf.py
index e87b8c22be..40b1ad811d 100644
--- a/docs/interop/conf.py
+++ b/docs/interop/conf.py
@@ -18,5 +18,7 @@ html_theme_options['description'] = u'System Emulation Management and Interopera
# (source start file, name, description, authors, manual section).
man_pages = [
('qemu-ga', 'qemu-ga', u'QEMU Guest Agent',
- ['Michael Roth <mdroth@linux.vnet.ibm.com>'], 8)
+ ['Michael Roth <mdroth@linux.vnet.ibm.com>'], 8),
+ ('qemu-nbd', 'qemu-nbd', u'QEMU Disk Network Block Device Server',
+ ['Anthony Liguori <anthony@codemonkey.ws>'], 8)
]
diff --git a/docs/interop/index.rst b/docs/interop/index.rst
index 049387ac6d..c28f7785a5 100644
--- a/docs/interop/index.rst
+++ b/docs/interop/index.rst
@@ -18,5 +18,6 @@ Contents:
live-block-operations
pr-helper
qemu-ga
+ qemu-nbd
vhost-user
vhost-user-gpu
diff --git a/docs/interop/qemu-nbd.rst b/docs/interop/qemu-nbd.rst
new file mode 100644
index 0000000000..873bb9e17d
--- /dev/null
+++ b/docs/interop/qemu-nbd.rst
@@ -0,0 +1,263 @@
+QEMU Disk Network Block Device Server
+=====================================
+
+Synopsis
+--------
+
+**qemu-nbd** [*OPTION*]... *filename*
+
+**qemu-nbd** -L [*OPTION*]...
+
+**qemu-nbd** -d *dev*
+
+Description
+-----------
+
+Export a QEMU disk image using the NBD protocol.
+
+Other uses:
+
+- Bind a /dev/nbdX block device to a QEMU server (on Linux).
+- As a client to query exports of a remote NBD server.
+
+Options
+-------
+
+.. program:: qemu-nbd
+
+*filename* is a disk image filename, or a set of block
+driver options if ``--image-opts`` is specified.
+
+*dev* is an NBD device.
+
+.. option:: --object type,id=ID,...props...
+
+ Define a new instance of the *type* object class identified by *ID*.
+ See the :manpage:`qemu(1)` manual page for full details of the properties
+ supported. The common object types that it makes sense to define are the
+ ``secret`` object, which is used to supply passwords and/or encryption
+ keys, and the ``tls-creds`` object, which is used to supply TLS
+ credentials for the qemu-nbd server or client.
+
+.. option:: -p, --port=PORT
+
+ TCP port to listen on as a server, or connect to as a client
+ (default ``10809``).
+
+.. option:: -o, --offset=OFFSET
+
+ The offset into the image.
+
+.. option:: -b, --bind=IFACE
+
+ The interface to bind to as a server, or connect to as a client
+ (default ``0.0.0.0``).
+
+.. option:: -k, --socket=PATH
+
+ Use a unix socket with path *PATH*.
+
+.. option:: --image-opts
+
+ Treat *filename* as a set of image options, instead of a plain
+ filename. If this flag is specified, the ``-f`` flag should
+ not be used, instead the :option:`format=` option should be set.
+
+.. option:: -f, --format=FMT
+
+ Force the use of the block driver for format *FMT* instead of
+ auto-detecting.
+
+.. option:: -r, --read-only
+
+ Export the disk as read-only.
+
+.. option:: -P, --partition=NUM
+
+ Deprecated: Only expose MBR partition *NUM*. Understands physical
+ partitions 1-4 and logical partition 5. New code should instead use
+ :option:`--image-opts` with the raw driver wrapping a subset of the
+ original image.
+
+.. option:: -B, --bitmap=NAME
+
+ If *filename* has a qcow2 persistent bitmap *NAME*, expose
+ that bitmap via the ``qemu:dirty-bitmap:NAME`` context
+ accessible through NBD_OPT_SET_META_CONTEXT.
+
+.. option:: -s, --snapshot
+
+ Use *filename* as an external snapshot, create a temporary
+ file with ``backing_file=``\ *filename*, redirect the write to
+ the temporary one.
+
+.. option:: -l, --load-snapshot=SNAPSHOT_PARAM
+
+ Load an internal snapshot inside *filename* and export it
+ as an read-only device, SNAPSHOT_PARAM format is
+ ``snapshot.id=[ID],snapshot.name=[NAME]`` or ``[ID_OR_NAME]``
+
+.. option:: --cache=CACHE
+
+ The cache mode to be used with the file. See the documentation of
+ the emulator's ``-drive cache=...`` option for allowed values.
+
+.. option:: -n, --nocache
+
+ Equivalent to :option:`--cache=none`.
+
+.. option:: --aio=AIO
+
+ Set the asynchronous I/O mode between ``threads`` (the default)
+ and ``native`` (Linux only).
+
+.. option:: --discard=DISCARD
+
+ Control whether ``discard`` (also known as ``trim`` or ``unmap``)
+ requests are ignored or passed to the filesystem. *DISCARD* is one of
+ ``ignore`` (or ``off``), ``unmap`` (or ``on``). The default is
+ ``ignore``.
+
+.. option:: --detect-zeroes=DETECT_ZEROES
+
+ Control the automatic conversion of plain zero writes by the OS to
+ driver-specific optimized zero write commands. *DETECT_ZEROES* is one of
+ ``off``, ``on``, or ``unmap``. ``unmap``
+ converts a zero write to an unmap operation and can only be used if
+ *DISCARD* is set to ``unmap``. The default is ``off``.
+
+.. option:: -c, --connect=DEV
+
+ Connect *filename* to NBD device *DEV* (Linux only).
+
+.. option:: -d, --disconnect
+
+ Disconnect the device *DEV* (Linux only).
+
+.. option:: -e, --shared=NUM
+
+ Allow up to *NUM* clients to share the device (default
+ ``1``). Safe for readers, but for now, consistency is not
+ guaranteed between multiple writers.
+
+.. option:: -t, --persistent
+
+ Don't exit on the last connection.
+
+.. option:: -x, --export-name=NAME
+
+ Set the NBD volume export name (default of a zero-length string).
+
+.. option:: -D, --description=DESCRIPTION
+
+ Set the NBD volume export description, as a human-readable
+ string.
+
+.. option:: -L, --list
+
+ Connect as a client and list all details about the exports exposed by
+ a remote NBD server. This enables list mode, and is incompatible
+ with options that change behavior related to a specific export (such as
+ :option:`--export-name`, :option:`--offset`, ...).
+
+.. option:: --tls-creds=ID
+
+ Enable mandatory TLS encryption for the server by setting the ID
+ of the TLS credentials object previously created with the --object
+ option; or provide the credentials needed for connecting as a client
+ in list mode.
+
+.. option:: --fork
+
+ Fork off the server process and exit the parent once the server is running.
+
+.. option:: --pid-file=PATH
+
+ Store the server's process ID in the given file.
+
+.. option:: --tls-authz=ID
+
+ Specify the ID of a qauthz object previously created with the
+ :option:`--object` option. This will be used to authorize connecting users
+ against their x509 distinguished name.
+
+.. option:: -v, --verbose
+
+ Display extra debugging information.
+
+.. option:: -h, --help
+
+ Display this help and exit.
+
+.. option:: -V, --version
+
+ Display version information and exit.
+
+.. option:: -T, --trace [[enable=]PATTERN][,events=FILE][,file=FILE]
+
+ .. include:: qemu-option-trace.rst.inc
+
+Examples
+--------
+
+Start a server listening on port 10809 that exposes only the
+guest-visible contents of a qcow2 file, with no TLS encryption, and
+with the default export name (an empty string). The command is
+one-shot, and will block until the first successful client
+disconnects:
+
+::
+
+ qemu-nbd -f qcow2 file.qcow2
+
+Start a long-running server listening with encryption on port 10810,
+and whitelist clients with a specific X.509 certificate to connect to
+a 1 megabyte subset of a raw file, using the export name 'subset':
+
+::
+
+ qemu-nbd \
+ --object tls-creds-x509,id=tls0,endpoint=server,dir=/path/to/qemutls \
+ --object 'authz-simple,id=auth0,identity=CN=laptop.example.com,,\
+ O=Example Org,,L=London,,ST=London,,C=GB' \
+ --tls-creds tls0 --tls-authz auth0 \
+ -t -x subset -p 10810 \
+ --image-opts driver=raw,offset=1M,size=1M,file.driver=file,file.filename=file.raw
+
+Serve a read-only copy of just the first MBR partition of a guest
+image over a Unix socket with as many as 5 simultaneous readers, with
+a persistent process forked as a daemon:
+
+::
+
+ qemu-nbd --fork --persistent --shared=5 --socket=/path/to/sock \
+ --partition=1 --read-only --format=qcow2 file.qcow2
+
+Expose the guest-visible contents of a qcow2 file via a block device
+/dev/nbd0 (and possibly creating /dev/nbd0p1 and friends for
+partitions found within), then disconnect the device when done.
+Access to bind qemu-nbd to an /dev/nbd device generally requires root
+privileges, and may also require the execution of ``modprobe nbd``
+to enable the kernel NBD client module. *CAUTION*: Do not use
+this method to mount filesystems from an untrusted guest image - a
+malicious guest may have prepared the image to attempt to trigger
+kernel bugs in partition probing or file system mounting.
+
+::
+
+ qemu-nbd -c /dev/nbd0 -f qcow2 file.qcow2
+ qemu-nbd -d /dev/nbd0
+
+Query a remote server to see details about what export(s) it is
+serving on port 10809, and authenticating via PSK:
+
+::
+
+ qemu-nbd \
+ --object tls-creds-psk,id=tls0,dir=/tmp/keys,username=eblake,endpoint=client \
+ --tls-creds tls0 -L -b remote.example.com
+
+See also
+--------
+
+:manpage:`qemu(1)`, :manpage:`qemu-img(1)`
diff --git a/docs/interop/qemu-option-trace.rst.inc b/docs/interop/qemu-option-trace.rst.inc
new file mode 100644
index 0000000000..23cfcb4853
--- /dev/null
+++ b/docs/interop/qemu-option-trace.rst.inc
@@ -0,0 +1,30 @@
+..
+ The contents of this file must be kept in sync with qemu-option-trace.texi
+ until all the users of the texi file have been converted to rst and
+ the texi file can be removed.
+
+Specify tracing options.
+
+.. option:: [enable=]PATTERN
+
+ Immediately enable events matching *PATTERN*
+ (either event name or a globbing pattern). This option is only
+ available if QEMU has been compiled with the ``simple``, ``log``
+ or ``ftrace`` tracing backend. To specify multiple events or patterns,
+ specify the :option:`-trace` option multiple times.
+
+ Use :option:`-trace help` to print a list of names of trace points.
+
+.. option:: events=FILE
+
+ Immediately enable events listed in *FILE*.
+ The file must contain one event name (as listed in the ``trace-events-all``
+ file) per line; globbing patterns are accepted too. This option is only
+ available if QEMU has been compiled with the ``simple``, ``log`` or
+ ``ftrace`` tracing backend.
+
+.. option:: file=FILE
+
+ Log output traces to *FILE*.
+ This option is only available if QEMU has been compiled with
+ the ``simple`` tracing backend.