qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Programmingkid <programmingkidx@gmail.com>
Cc: Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>,
	Qemu-block <qemu-block@nongnu.org>,
	Qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qemu-img.c: increase spacing between commands in documentation
Date: Fri, 17 Aug 2018 15:59:40 -0500	[thread overview]
Message-ID: <a924155b-0302-8e3f-395c-3504b8d6f729@redhat.com> (raw)
In-Reply-To: <D1319041-4F97-49CD-A53C-BFFA6D39BC16@gmail.com>

On 08/17/2018 02:28 PM, Programmingkid wrote:

>>>   -o             Used with a comma separated list of format specific options in a
>>>                  name=value format. Use "-o ?" for an overview of the options
>>
>> Please spell that "-o help", not "-o ?".   Otherwise, the user has to quote the ? to avoid it globbing into any single-byte file lying around in the current directory.
> 
> "-o ?" and "-o help" does not appear to work for this command. Maybe it should be removed.
> This is what I tried:
> 	qemu-img amend -o help
> 	qemu-img amend -o ?

The set of options depends on the file format being amended.  So, you 
have to try:

qemu-img amend -o help -f qcow2

or supply an image name, as in:

qemu-img amend -o help myimage.qcow2

(of course, the latter relies on image probing, which I just said is 
potentially unsafe if you didn't use -f).  But the point is the option 
-o does work, just not in isolation.


>>>   -t             Specifies the cache mode that should be used with the
>>>                  destination file.
>>
>> And what are those modes?  If you're going to be wordy, then give the user enough information to be useful.  Otherwise, being terse in --help is fine (and let the man page be wordy instead).
> 
> I don't know what the modes are. Anyone care to fill us in?

The source code is your friend. qemu-img.c has:

        case 'T':
             cache = optarg;
...
     ret = bdrv_parse_cache_mode(cache, &flags, &writethrough);

then you search for bdrv_parse_cache_mode(), in block.c:

     if (!strcmp(mode, "off") || !strcmp(mode, "none")) {
         *writethrough = false;
         *flags |= BDRV_O_NOCACHE;
     } else if (!strcmp(mode, "directsync")) {
         *writethrough = true;
         *flags |= BDRV_O_NOCACHE;
     } else if (!strcmp(mode, "writeback")) {
         *writethrough = false;
     } else if (!strcmp(mode, "unsafe")) {
         *writethrough = false;
         *flags |= BDRV_O_NO_FLUSH;
     } else if (!strcmp(mode, "writethrough")) {
         *writethrough = true;

So six different aliases, for five different modes.  We can either 
improve --help output to document these directly, or add a '-t help' 
option (the way we have '-o help') to dynamically print the list.

> 
> 
>>> Example:
>>>      qemu-img amend -o compat=0.10 -f qcow2 image.qcow2
>>
>> Where's an example with --image-opts and --object secret?
> 
> I prefer examples that I think a user would actually use. The --image-opts and -object options are not necessary to use this command.

Umm, they ARE necessary if you want to amend a LUKS-encrypted image, and 
that IS something I would actually use.  What's more, it's the complex 
examples (like a LUKS-encrypted image) where seeing something spelled 
out will save a LOT of hair-pulling from someone reading the docs (but, 
alongside it should ALSO be a short-and-simple example).

> 
>> We're trying to move away from compat=0.10 (also spelled compat=v2), and instead start encouraging compat=v3.
> 
> So you want this: qemu-img amend -o compat=v3 -f qcow2 image.qcow2

Yes, that's one reasonable example, but should not be the only example.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

  reply	other threads:[~2018-08-17 21:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180730212249.16418-1-programmingkidx@gmail.com>
2018-07-31  0:55 ` [Qemu-devel] [PATCH] qemu-img.c: increase spacing between commands in documentation Programmingkid
2018-08-13 16:56 ` Max Reitz
2018-08-13 18:19   ` Eric Blake
2018-08-14  8:40     ` Kevin Wolf
2018-08-14 12:55       ` Eric Blake
2018-08-14 17:59         ` Programmingkid
2018-08-17  1:27       ` Programmingkid
2018-08-17 13:44         ` Eric Blake
2018-08-17 19:28           ` Programmingkid
2018-08-17 20:59             ` Eric Blake [this message]
2018-08-18 16:48               ` Programmingkid

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a924155b-0302-8e3f-395c-3504b8d6f729@redhat.com \
    --to=eblake@redhat.com \
    --cc=Qemu-devel@nongnu.org \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=programmingkidx@gmail.com \
    --cc=qemu-block@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).