qemu-nbd: Convert invocation documentation to rST
PATCH 1/1 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.)
---
Another step forward for https://wiki.qemu.org/Features/Documentation
(this is part of step 3 in the 'transition plan').
[A
--- Makefile | 12 +- MAINTAINERS | 1 + docs/interop/conf.py | 4 +- docs/interop/index.rst | 1 + docs/interop/qemu-nbd.rst | 263 +++++++++++++++++++++++++ docs/interop/qemu-option-trace.rst.inc | 30 +++ qemu-doc.texi | 6 - qemu-nbd.texi | 214 -------------------- qemu-option-trace.texi | 4 + 9 files changed, 309 insertions(+), 226 deletions(-) create mode 100644 docs/interop/qemu-nbd.rst create mode 100644 docs/interop/qemu-option-trace.rst.inc delete mode 100644 qemu-nbd.texi
Makefile +7 -5
@@ -338,7 +338,7 @@ MANUAL_BUILDDIR := docs endif ifdef BUILD_DOCS -DOCS=qemu-doc.html qemu-doc.txt qemu.1 qemu-img.1 qemu-nbd.8 $(MANUAL_BUILDDIR)/interop/qemu-ga.8 +DOCS=qemu-doc.html qemu-doc.txt qemu.1 qemu-img.1 $(MANUAL_BUILDDIR)/interop/qemu-nbd.8 $(MANUAL_BUILDDIR)/interop/qemu-ga.8 DOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7 DOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7 DOCS+=docs/qemu-block-drivers.7
@@ -827,7 +827,7 @@ ifdef CONFIG_POSIX ifeq ($(CONFIG_TOOLS),y) $(INSTALL_DATA) qemu-img.1 "$(DESTDIR)$(mandir)/man1" $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8" - $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8" + $(INSTALL_DATA) $(MANUAL_BUILDDIR)/interop/qemu-nbd.8 "$(DESTDIR)$(mandir)/man8" endif ifdef CONFIG_TRACE_SYSTEMTAP $(INSTALL_DATA) scripts/qemu-trace-stap.1 "$(DESTDIR)$(mandir)/man1"
@@ -1005,7 +1005,7 @@ sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html $(MANUAL_BUILDDIR)/interop/index # a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946 build-manual = $(call quiet-command,CONFDIR="$(qemu_confdir)" sphinx-build $(if $(V),,-q) -W -b $2 -D version=$(VERSION) -D release="$(FULL_VERSION)" -d .doctrees/$1-$2 $(SRC_PATH)/docs/$1 $(MANUAL_BUILDDIR)/$1 ,"SPHINX","$(MANUAL_BUILDDIR)/$1") # We assume all RST files in the manual's directory are used in it -manual-deps = $(wildcard $(SRC_PATH)/docs/$1/*.rst) $(SRC_PATH)/docs/$1/conf.py $(SRC_PATH)/docs/conf.py +manual-deps = $(wildcard $(SRC_PATH)/docs/$1/*.rst) $(wildcard $(SRC_PATH)/docs/$1/*.rst.inc) $(SRC_PATH)/docs/$1/conf.py $(SRC_PATH)/docs/conf.py $(MANUAL_BUILDDIR)/devel/index.html: $(call manual-deps,devel) $(call build-manual,devel,html)
@@ -1019,6 +1019,9 @@ $(MANUAL_BUILDDIR)/specs/index.html: $(call manual-deps,specs) $(MANUAL_BUILDDIR)/interop/qemu-ga.8: $(call manual-deps,interop) $(call build-manual,interop,man) +$(MANUAL_BUILDDIR)/interop/qemu-nbd.8: $(call manual-deps,interop) + $(call build-manual,interop,man) + $(MANUAL_BUILDDIR)/index.html: $(SRC_PATH)/docs/index.html.in qemu-version.h $(call quiet-command, sed "s|@@VERSION@@|${VERSION}|g" $< >$@, \ "GEN","$@")
@@ -1045,7 +1048,6 @@ qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi qemu.1: qemu-option-trace.texi qemu-img.1: qemu-img.texi qemu-option-trace.texi qemu-img-cmds.texi fsdev/virtfs-proxy-helper.1: fsdev/virtfs-proxy-helper.texi -qemu-nbd.8: qemu-nbd.texi qemu-option-trace.texi docs/qemu-block-drivers.7: docs/qemu-block-drivers.texi docs/qemu-cpu-models.7: docs/qemu-cpu-models.texi scripts/qemu-trace-stap.1: scripts/qemu-trace-stap.texi
@@ -1056,7 +1058,7 @@ pdf: qemu-doc.pdf docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf txt: qemu-doc.txt docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt qemu-doc.html qemu-doc.info qemu-doc.pdf qemu-doc.txt: \ - qemu-img.texi qemu-nbd.texi qemu-options.texi \ + qemu-img.texi qemu-options.texi \ qemu-tech.texi qemu-option-trace.texi \ qemu-deprecated.texi qemu-monitor.texi qemu-img-cmds.texi \ qemu-monitor-info.texi docs/qemu-block-drivers.texi \
MAINTAINERS +1 -0
@@ -2503,6 +2503,7 @@ F: include/block/nbd* F: qemu-nbd.* F: blockdev-nbd.c F: docs/interop/nbd.txt +F: docs/interop/qemu-nbd.rst T: git https://repo.or.cz/qemu/ericb.git nbd NFS
docs/interop/conf.py +3 -1
@@ -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 <[email protected]>'], 8) + ['Michael Roth <[email protected]>'], 8), + ('qemu-nbd', 'qemu-nbd', u'QEMU Disk Network Block Device Server', + ['Anthony Liguori <[email protected]>'], 8) ]
docs/interop/index.rst +1 -0
@@ -18,5 +18,6 @@ Contents: live-block-operations pr-helper qemu-ga + qemu-nbd vhost-user vhost-user-gpu
docs/interop/qemu-nbd.rst new file +263 -0
263 lines not on this page · raw message
docs/interop/qemu-option-trace.rst.inc new file +30 -0
@@ -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.
qemu-doc.texi +0 -6
@@ -633,7 +633,6 @@ encrypted disk images. * disk_images_snapshot_mode:: Snapshot mode * vm_snapshots:: VM snapshots * qemu_img_invocation:: qemu-img Invocation -* qemu_nbd_invocation:: qemu-nbd Invocation * disk_images_formats:: Disk image file formats * host_drives:: Using host drives * disk_images_fat_images:: Virtual FAT disk images
@@ -724,11 +723,6 @@ state is not saved or restored properly (in particular USB). @include qemu-img.texi -@node qemu_nbd_invocation -@subsection @code{qemu-nbd} Invocation - -@include qemu-nbd.texi - @include docs/qemu-block-drivers.texi @node pcsys_network
qemu-nbd.texi deleted +0 -214
214 lines not on this page · raw message
qemu-option-trace.texi +4 -0
@@ -1,3 +1,7 @@ +@c The contents of this file must be kept in sync with qemu-option-trace.rst.inc +@c until all the users of the texi file have been converted to rst and +@c the texi file can be removed. + Specify tracing options. @table @option
Signature · 1 line
2.20.1
Quoted 5 lines · Peter Maydell
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
Quoted 7 lines
Convert the documentation to rST format, and present it to the user as:
* a qemu-nbd manpage
* part of the interop/ Sphinx manualThis follows the same pattern as commit
27a296fce982did for the qemu-ga manpage.
I'm not an rST expert, but trust that you compared the resulting renderings. Is there a quick recipe for doing the build locally so I can easily inspect local artifacts myself?
Quoted 7 lines
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.
Reasonable.
Quoted 11 lines
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.)
All fine by me. If the resulting docs are more consistent between tools as a result of normalizations like this, it is a win.
Quoted 7 lines
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.)
Yes, that's fair for the short-term.
Quoted 10 lines
Signed-off-by Peter Maydell <[email protected]>---
Another step forward for https://wiki.qemu.org/Features/Documentation
(this is part of step 3 in the 'transition plan').
[A
---+++ b/Makefile
Makefile MANUAL_BUILDDIR := docs · line 341
Quoted 5 lines
Makefile +1
-1@@ -338,7 +338,7 @@ MANUAL_BUILDDIR := docs endif ifdef BUILD_DOCS -DOCS=qemu-doc.html qemu-doc.txt qemu.1 qemu-img.1 qemu-nbd.8 $(MANUAL_BUILDDIR)/interop/qemu-ga.8 +DOCS=qemu-doc.html qemu-doc.txt qemu.1 qemu-img.1 $(MANUAL_BUILDDIR)/interop/qemu-nbd.8 $(MANUAL_BUILDDIR)/interop/qemu-ga.8
Worth splitting this long line, either with \-newline, or
Makefile MANUAL_BUILDDIR := docs · line 343
Quoted 2 lines
Makefile +0
-0DOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7 DOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7
with additional DOCS+= lines?
Makefile sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html $(MANUAL_BUILDDIR)/interop/index · line 1008
Quoted 6 lines
Makefile +1
-1@@ -1005,7 +1005,7 @@ sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html $(MANUAL_BUILDDIR)/interop/index # a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946 build-manual = $(call quiet-command,CONFDIR="$(qemu_confdir)" sphinx-build $(if $(V),,-q) -W -b $2 -D version=$(VERSION) -D release="$(FULL_VERSION)" -d .doctrees/$1-$2 $(SRC_PATH)/docs/$1 $(MANUAL_BUILDDIR)/$1 ,"SPHINX","$(MANUAL_BUILDDIR)/$1") # We assume all RST files in the manual's directory are used in it -manual-deps = $(wildcard $(SRC_PATH)/docs/$1/*.rst) $(SRC_PATH)/docs/$1/conf.py $(SRC_PATH)/docs/conf.py +manual-deps = $(wildcard $(SRC_PATH)/docs/$1/*.rst) $(wildcard $(SRC_PATH)/docs/$1/*.rst.inc) $(SRC_PATH)/docs/$1/conf.py $(SRC_PATH)/docs/conf.py
Another long line.
MAINTAINERS F: include/block/nbd* · line 2507
Quoted 7 lines
MAINTAINERS +2
-0+++ b/MAINTAINERS@@ -2503,6 +2503,7 @@ F: include/block/nbd* F: qemu-nbd.* F: blockdev-nbd.c F: docs/interop/nbd.txt +F: docs/interop/qemu-nbd.rst T: git https://repo.or.cz/qemu/ericb.git nbd
Would I be taking this patch through my NBD tree, or would you be bundling it with other doc patches?
docs/interop/qemu-nbd.rst line 92
Quoted 8 lines
docs/interop/qemu-nbd.rst new file +6
-0+++ b/docs/interop/qemu-nbd.rst@@ -0,0 +1,263 @@ +.. option:: -s, --snapshot + + Use *filename* as an external snapshot, create a temporary + file with ``backing_file=``\ *filename*, redirect the write to + the temporary one.
Pre-existing poor grammar. Better might be:
Use *filename* as an external snapshot, by creating a temporary file with ``backing_file=``\ *filename*, and redirecting writes to the temporary file.
But that could also be done as a separate patch, to keep this one as mechanical as possible on the conversion.
docs/interop/qemu-nbd.rst line 97
Quoted 5 lines
docs/interop/qemu-nbd.rst new file +5
-0+ +.. option:: -l, --load-snapshot=SNAPSHOT_PARAM + + Load an internal snapshot inside *filename* and export it + as an read-only device, SNAPSHOT_PARAM format is
Similarly, s/an/a/
docs/interop/qemu-nbd.rst line 234
Quoted 9 lines
docs/interop/qemu-nbd.rst new file +9
-0+ +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
Hmm - this example uses the deprecated --partition. And it was deprecated in 4.0.0. So 5.0 is a reasonable time to just nuke that code, and therefore this example - but as a separate patch (rather than touching up this example to use the spelling suggested in qemu-deprecated.texi).
docs/interop/qemu-nbd.rst line 239
Quoted 5 lines
docs/interop/qemu-nbd.rst new file +5
-0+ +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
s/an/a/
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Quoted 11 lines · Eric Blake
Quoted 9 lines · Peter Maydell
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 documentationConvert the documentation to rST format, and present it to the user as:
* a qemu-nbd manpage
* part of the interop/ Sphinx manual
Quoted 7 lines
Quoted 3 lines
This follows the same pattern as commit
27a296fce982did for the qemu-ga manpage.I'm not an rST expert, but trust that you compared the resulting renderings. Is there a quick recipe for doing the build locally so I can easily inspect local artifacts myself?
Yep -- assuming you have the prerequisites installed to build the docs (should be just makeinfo, pod2man, sphinx), apply the patch and then 'make' will build the docs -- the new qemu-nbd.8 should be in docs/interop in the build tree, assuming you do builds not in the source tree. If you do builds in the source tree then the built artefacts are created under docs/built. The html that forms part of the interop manpage set is in docs/interop/qemu-nbd.html, also in the build tree.
Quoted 10 lines
Makefile MANUAL_BUILDDIR := docs · line 341
Quoted 7 lines
+++ b/Makefile
Makefile +1
-1@@ -338,7 +338,7 @@ MANUAL_BUILDDIR := docs endif ifdef BUILD_DOCS -DOCS=qemu-doc.html qemu-doc.txt qemu.1 qemu-img.1 qemu-nbd.8 $(MANUAL_BUILDDIR)/interop/qemu-ga.8 +DOCS=qemu-doc.html qemu-doc.txt qemu.1 qemu-img.1 $(MANUAL_BUILDDIR)/interop/qemu-nbd.8 $(MANUAL_BUILDDIR)/interop/qemu-ga.8Worth splitting this long line, either with \-newline, or
Quoted 4 lines
Makefile MANUAL_BUILDDIR := docs · line 343
Quoted 2 lines
Makefile +0
-0DOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7 DOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7with additional DOCS+= lines?
I think I prefer the latter.
Quoted 10 lines
MAINTAINERS F: include/block/nbd* · line 2507
Quoted 7 lines
MAINTAINERS +2
-0+++ b/MAINTAINERS@@ -2503,6 +2503,7 @@ F: include/block/nbd* F: qemu-nbd.* F: blockdev-nbd.c F: docs/interop/nbd.txt +F: docs/interop/qemu-nbd.rst T: git https://repo.or.cz/qemu/ericb.git nbdWould I be taking this patch through my NBD tree, or would you be bundling it with other doc patches?
Either way would work for me, depends a bit whether I get round to trying to do another doc conversion and whether you had any other pending updates to the old texinfo doc.
Quoted 9 lines
docs/interop/qemu-nbd.rst line 92
Quoted 8 lines
docs/interop/qemu-nbd.rst new file +6
-0+++ b/docs/interop/qemu-nbd.rst@@ -0,0 +1,263 @@ +.. option:: -s, --snapshot + + Use *filename* as an external snapshot, create a temporary + file with ``backing_file=``\ *filename*, redirect the write to + the temporary one.
Quoted 8 lines
Pre-existing poor grammar. Better might be:
Use *filename* as an external snapshot, by creating a temporary file with ``backing_file=``\ *filename*, and redirecting writes to the temporary file.
But that could also be done as a separate patch, to keep this one as mechanical as possible on the conversion.
Yes. I noticed a few things I would consider docs nits which I deliberately didn't fix up in this conversion patch; I'd prefer those to be done separately afterwards.
thanks
-- PMM