[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 26/30] qemu-img: Use user_creatable_process_cmdline() for
From: |
Eric Blake |
Subject: |
Re: [PATCH v3 26/30] qemu-img: Use user_creatable_process_cmdline() for --object |
Date: |
Mon, 8 Mar 2021 13:32:22 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 |
On 3/8/21 10:54 AM, Kevin Wolf wrote:
> This switches qemu-img from a QemuOpts-based parser for --object to
> user_creatable_process_cmdline() which uses a keyval parser and enforces
> the QAPI schema.
>
> Apart from being a cleanup, this makes non-scalar properties accessible.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> Acked-by: Peter Krempa <pkrempa@redhat.com>
> ---
> qemu-img.c | 251 ++++++++++-------------------------------------------
> 1 file changed, 45 insertions(+), 206 deletions(-)
>
> @@ -1353,7 +1303,7 @@ static int check_empty_sectors(BlockBackend *blk,
> int64_t offset,
> /*
> * Compares two images. Exit codes:
> *
> - * 0 - Images are identical
> + * 0 - Images are identical or the requested help was printed
Nice, but does the user-facing documentation need updating to match?
> * 1 - Images differ
> * >1 - Error occurred
> */
> @@ -1423,15 +1373,21 @@ static int img_compare(int argc, char **argv)
> case 'U':
> force_share = true;
> break;
> - case OPTION_OBJECT: {
> - QemuOpts *opts;
> - opts = qemu_opts_parse_noisily(&qemu_object_opts,
> - optarg, true);
> - if (!opts) {
> - ret = 2;
> - goto out4;
> + case OPTION_OBJECT:
> + {
> + Error *local_err = NULL;
> +
> + if (!user_creatable_add_from_str(optarg, &local_err)) {
> + if (local_err) {
> + error_report_err(local_err);
> + exit(2);
> + } else {
> + /* Help was printed */
> + exit(EXIT_SUCCESS);
> + }
The commit message needs to be updated to call out that this bug fix was
intentional, preferably mentioning the commit where we broke it
(334c43e2c3).
The code is fine, though, so with an improved commit message (and maybe
some matching doc tweaks),
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
- Re: [PATCH v3 27/30] hmp: QAPIfy object_add, (continued)
[PATCH v3 29/30] vl: QAPIfy -object, Kevin Wolf, 2021/03/08
[PATCH v3 16/30] qapi/qom: Add ObjectOptions for input-*, Kevin Wolf, 2021/03/08
[PATCH v3 22/30] qom: Factor out user_creatable_process_cmdline(), Kevin Wolf, 2021/03/08
[PATCH v3 26/30] qemu-img: Use user_creatable_process_cmdline() for --object, Kevin Wolf, 2021/03/08
- Re: [PATCH v3 26/30] qemu-img: Use user_creatable_process_cmdline() for --object,
Eric Blake <=
- Re: [PATCH v3 26/30] qemu-img: Use user_creatable_process_cmdline() for --object, Markus Armbruster, 2021/03/13
- Re: [PATCH v3 26/30] qemu-img: Use user_creatable_process_cmdline() for --object, Paolo Bonzini, 2021/03/13
- Re: [PATCH v3 26/30] qemu-img: Use user_creatable_process_cmdline() for --object, Markus Armbruster, 2021/03/13
- Re: [PATCH v3 26/30] qemu-img: Use user_creatable_process_cmdline() for --object, Kevin Wolf, 2021/03/15
- Re: [PATCH v3 26/30] qemu-img: Use user_creatable_process_cmdline() for --object, Markus Armbruster, 2021/03/15
- Re: [PATCH v3 26/30] qemu-img: Use user_creatable_process_cmdline() for --object, Kevin Wolf, 2021/03/15
[PATCH v3 30/30] qom: Drop QemuOpts based interfaces, Kevin Wolf, 2021/03/08
[PATCH v3 15/30] qapi/qom: Add ObjectOptions for confidential-guest-support, Kevin Wolf, 2021/03/08
Re: [PATCH v3 00/30] qapi/qom: QAPIfy --object and object-add, Peter Krempa, 2021/03/10