From: Eric Blake <eblake@redhat.com>
To: Max Reitz <mreitz@redhat.com>, qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 4/7] qemu-img: Add print_amend_option_help()
Date: Wed, 2 May 2018 13:13:08 -0500 [thread overview]
Message-ID: <b704895d-fbc9-5854-4d81-24436b4988ec@redhat.com> (raw)
In-Reply-To: <20180421165423.30759-5-mreitz@redhat.com>
On 04/21/2018 11:54 AM, Max Reitz wrote:
> The more generic print_block_option_help() function is not really
> suitable for qemu-img amend, for a couple of reasons:
> (1) We do not need to append the protocol-level options, as amendment
> happens only on one node and does not descend downwards to its
> children.
> (2) print_block_option_help() says those options are "supported". For
> option amendment, we do not really know that. So this new function
> explicitly says that those options are the creation options, and not
> all of them may be supported.
> (3) If the driver does not support option amendment, we should not print
> anything (except for an error message that amendment is not
> supported).
>
> Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1537956
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
> qemu-img.c | 30 ++++++++++++++++++++++++++++--
> tests/qemu-iotests/082.out | 44 +++++++++++++++++++++++++++-----------------
> 2 files changed, 55 insertions(+), 19 deletions(-)
>
> diff --git a/qemu-img.c b/qemu-img.c
> index 6dd8e95bb2..45e243cc80 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -3578,6 +3578,32 @@ static void amend_status_cb(BlockDriverState *bs,
> qemu_progress_print(100.f * offset / total_work_size, 0);
> }
>
> +static int print_amend_option_help(const char *format)
> +{
> + BlockDriver *drv;
> +
> + /* Find driver and parse its options */
> + drv = bdrv_find_format(format);
> + if (!drv) {
> + error_report("Unknown file format '%s'", format);
> + return 1;
> + }
Not your fault; I'd love it if this file consistently used EXIT_FAILURE
instead of 1 (since that's a bit more obvious why we are returning a
positive value instead of our more usual negative-on-error - we expect
the caller to feed our return value to exit()), but that's a separate
cleanup.
But the new output is definitely nicer.
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2018-05-02 18:13 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-21 16:54 [Qemu-devel] [PATCH 0/7] qemu-img: Improve option help for amend Max Reitz
2018-04-21 16:54 ` [Qemu-devel] [PATCH 1/7] qemu-img: Amendment support implies create_opts Max Reitz
2018-05-02 17:35 ` Eric Blake
2018-04-21 16:54 ` [Qemu-devel] [PATCH 2/7] block: Add Error parameter to bdrv_amend_options Max Reitz
2018-05-01 22:49 ` [Qemu-devel] [Qemu-block] " John Snow
2018-05-02 17:52 ` [Qemu-devel] " Eric Blake
2018-05-02 18:08 ` Max Reitz
2018-04-21 16:54 ` [Qemu-devel] [PATCH 3/7] qemu-option: Pull out "Supported options" print Max Reitz
2018-05-02 18:09 ` Eric Blake
2018-04-21 16:54 ` [Qemu-devel] [PATCH 4/7] qemu-img: Add print_amend_option_help() Max Reitz
2018-05-02 18:13 ` Eric Blake [this message]
2018-04-21 16:54 ` [Qemu-devel] [PATCH 5/7] qemu-img: Recognize no creation support in -o help Max Reitz
2018-05-02 17:40 ` [Qemu-devel] [Qemu-block] " John Snow
2018-05-02 18:15 ` [Qemu-devel] " Eric Blake
2018-04-21 16:54 ` [Qemu-devel] [PATCH 6/7] iotests: Test help option for unsupporting formats Max Reitz
2018-05-02 18:00 ` [Qemu-devel] [Qemu-block] " John Snow
2018-05-02 18:17 ` [Qemu-devel] " Eric Blake
2018-04-21 16:54 ` [Qemu-devel] [PATCH 7/7] iotests: Rework 113 Max Reitz
2018-05-02 18:03 ` [Qemu-devel] [Qemu-block] " John Snow
2018-05-02 18:13 ` Max Reitz
2018-05-02 18:18 ` John Snow
2018-05-02 18:48 ` Max Reitz
2018-05-02 18:24 ` [Qemu-devel] " Eric Blake
2018-05-02 18:35 ` Max Reitz
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=b704895d-fbc9-5854-4d81-24436b4988ec@redhat.com \
--to=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.