qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] qemu-img: Unify [-b [-F]] documentation
@ 2022-01-31 13:59 Hanna Reitz
  2022-02-01 12:44 ` Kevin Wolf
  2022-02-01 13:49 ` Vladimir Sementsov-Ogievskiy
  0 siblings, 2 replies; 3+ messages in thread
From: Hanna Reitz @ 2022-01-31 13:59 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, Hanna Reitz, Eric Blake, qemu-devel

qemu-img convert documents the backing file and backing format options
as follows:
    [-B backing_file [-F backing_fmt]]
whereas qemu-img create has this:
    [-b backing_file] [-F backing_fmt]

That is, for convert, we document that -F cannot be given without -B,
while for create, way say that they are independent.

Indeed, it is technically possible to give -F without -b, because it is
left to the block driver to decide whether this is an error or not, so
sometimes it is:

$ qemu-img create -f qed -F qed test.qed 64M
Formatting 'test.qed', fmt=qed size=67108864 backing_fmt=qed [...]

And sometimes it is not:

$ qemu-img create -f qcow2 -F qcow2 test.qcow2 64M
Formatting 'test.qcow2', fmt=qcow2 cluster_size=65536 [...]
qemu-img: test.qcow2: Backing format cannot be used without backing file

Generally, it does not make much sense, though, and users should only
give -F with -b, so document it that way, as we have already done for
qemu-img convert (commit 1899bf47375ad40555dcdff12ba49b4b8b82df38).

Reported-by: Tingting Mao <timao@redhat.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
---
 docs/tools/qemu-img.rst | 2 +-
 qemu-img-cmds.hx        | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/docs/tools/qemu-img.rst b/docs/tools/qemu-img.rst
index d663dd92bd..8885ea11cf 100644
--- a/docs/tools/qemu-img.rst
+++ b/docs/tools/qemu-img.rst
@@ -463,7 +463,7 @@ Command description:
   ``--skip-broken-bitmaps`` is also specified to copy only the
   consistent bitmaps.
 
-.. option:: create [--object OBJECTDEF] [-q] [-f FMT] [-b BACKING_FILE] [-F BACKING_FMT] [-u] [-o OPTIONS] FILENAME [SIZE]
+.. option:: create [--object OBJECTDEF] [-q] [-f FMT] [-b BACKING_FILE [-F BACKING_FMT]] [-u] [-o OPTIONS] FILENAME [SIZE]
 
   Create the new disk image *FILENAME* of size *SIZE* and format
   *FMT*. Depending on the file format, you can add one or more *OPTIONS*
diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx
index 72bcdcfbfa..1b1dab5b17 100644
--- a/qemu-img-cmds.hx
+++ b/qemu-img-cmds.hx
@@ -52,9 +52,9 @@ SRST
 ERST
 
 DEF("create", img_create,
-    "create [--object objectdef] [-q] [-f fmt] [-b backing_file] [-F backing_fmt] [-u] [-o options] filename [size]")
+    "create [--object objectdef] [-q] [-f fmt] [-b backing_file [-F backing_fmt]] [-u] [-o options] filename [size]")
 SRST
-.. option:: create [--object OBJECTDEF] [-q] [-f FMT] [-b BACKING_FILE] [-F BACKING_FMT] [-u] [-o OPTIONS] FILENAME [SIZE]
+.. option:: create [--object OBJECTDEF] [-q] [-f FMT] [-b BACKING_FILE [-F BACKING_FMT]] [-u] [-o OPTIONS] FILENAME [SIZE]
 ERST
 
 DEF("dd", img_dd,
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] qemu-img: Unify [-b [-F]] documentation
  2022-01-31 13:59 [PATCH] qemu-img: Unify [-b [-F]] documentation Hanna Reitz
@ 2022-02-01 12:44 ` Kevin Wolf
  2022-02-01 13:49 ` Vladimir Sementsov-Ogievskiy
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2022-02-01 12:44 UTC (permalink / raw)
  To: Hanna Reitz; +Cc: Eric Blake, qemu-devel, qemu-block

Am 31.01.2022 um 14:59 hat Hanna Reitz geschrieben:
> qemu-img convert documents the backing file and backing format options
> as follows:
>     [-B backing_file [-F backing_fmt]]
> whereas qemu-img create has this:
>     [-b backing_file] [-F backing_fmt]
> 
> That is, for convert, we document that -F cannot be given without -B,
> while for create, way say that they are independent.
> 
> Indeed, it is technically possible to give -F without -b, because it is
> left to the block driver to decide whether this is an error or not, so
> sometimes it is:
> 
> $ qemu-img create -f qed -F qed test.qed 64M
> Formatting 'test.qed', fmt=qed size=67108864 backing_fmt=qed [...]
> 
> And sometimes it is not:
> 
> $ qemu-img create -f qcow2 -F qcow2 test.qcow2 64M
> Formatting 'test.qcow2', fmt=qcow2 cluster_size=65536 [...]
> qemu-img: test.qcow2: Backing format cannot be used without backing file
> 
> Generally, it does not make much sense, though, and users should only
> give -F with -b, so document it that way, as we have already done for
> qemu-img convert (commit 1899bf47375ad40555dcdff12ba49b4b8b82df38).
> 
> Reported-by: Tingting Mao <timao@redhat.com>
> Signed-off-by: Hanna Reitz <hreitz@redhat.com>

Thanks, applied to the block branch.

Kevin



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] qemu-img: Unify [-b [-F]] documentation
  2022-01-31 13:59 [PATCH] qemu-img: Unify [-b [-F]] documentation Hanna Reitz
  2022-02-01 12:44 ` Kevin Wolf
@ 2022-02-01 13:49 ` Vladimir Sementsov-Ogievskiy
  1 sibling, 0 replies; 3+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2022-02-01 13:49 UTC (permalink / raw)
  To: Hanna Reitz, qemu-block; +Cc: Kevin Wolf, Eric Blake, qemu-devel

31.01.2022 16:59, Hanna Reitz wrote:
> qemu-img convert documents the backing file and backing format options
> as follows:
>      [-B backing_file [-F backing_fmt]]
> whereas qemu-img create has this:
>      [-b backing_file] [-F backing_fmt]
> 
> That is, for convert, we document that -F cannot be given without -B,
> while for create, way say that they are independent.
> 
> Indeed, it is technically possible to give -F without -b, because it is
> left to the block driver to decide whether this is an error or not, so
> sometimes it is:
> 
> $ qemu-img create -f qed -F qed test.qed 64M
> Formatting 'test.qed', fmt=qed size=67108864 backing_fmt=qed [...]
> 
> And sometimes it is not:
> 
> $ qemu-img create -f qcow2 -F qcow2 test.qcow2 64M
> Formatting 'test.qcow2', fmt=qcow2 cluster_size=65536 [...]
> qemu-img: test.qcow2: Backing format cannot be used without backing file
> 
> Generally, it does not make much sense, though, and users should only
> give -F with -b, so document it that way, as we have already done for
> qemu-img convert (commit 1899bf47375ad40555dcdff12ba49b4b8b82df38).
> 
> Reported-by: Tingting Mao<timao@redhat.com>
> Signed-off-by: Hanna Reitz<hreitz@redhat.com>

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

-- 
Best regards,
Vladimir


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-01 15:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-31 13:59 [PATCH] qemu-img: Unify [-b [-F]] documentation Hanna Reitz
2022-02-01 12:44 ` Kevin Wolf
2022-02-01 13:49 ` Vladimir Sementsov-Ogievskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).