[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 09/13] qemu-img: Suppress unhelpful extra errors
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH 09/13] qemu-img: Suppress unhelpful extra errors in convert, amend |
Date: |
Tue, 17 Feb 2015 09:25:09 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Eric Blake <address@hidden> writes:
> On 02/16/2015 07:44 AM, Markus Armbruster wrote:
>> img_convert() and img_amend() use qemu_opts_do_parse(), which reports
>> errors with qerror_report_err(). Its error messages aren't helpful
>> here, the caller reports one that actually makes sense. Reproducer:
>>
>> $ qemu-img convert -o backing_format=raw in.img out.img
>> qemu-img: Invalid parameter 'backing_format'
>> qemu-img: Invalid options for file format 'raw'
>>
>> To fix, propagate errors through qemu_opts_do_parse(). This lifts the
>> error reporting into callers. Drop it from img_convert() and
>> img_amend(), keep it in qemu_chr_parse_compat(), bdrv_img_create().
>>
>> Since I'm touching qemu_opts_do_parse() anyway, write a function
>> comment for it.
>>
>> Signed-off-by: Markus Armbruster <address@hidden>
>> ---
>> block.c | 5 ++++-
>> include/qemu/option.h | 3 ++-
>> qemu-char.c | 10 ++++++++--
>> qemu-img.c | 25 +++++++++++++++++--------
>> util/qemu-option.c | 19 +++++++++----------
>> 5 files changed, 40 insertions(+), 22 deletions(-)
>>
>
>> -int qemu_opts_do_parse(QemuOpts *opts, const char *params, const char
>> *firstname)
>> +/**
>> + * Store into @opts options parsed from @params.
>
> Reads a bit awkwardly; maybe:
>
> Store options parsed from @params into @opts.
Mentioning parameters in order. Old habits die hard...
>> + * If @firstname is non-null, the first key=value in @params may omit
>> + * key=, and is treated as if key was @firstname.
>> + * On error, store an error object through @errp if non-null.
>> + */
>> +void qemu_opts_do_parse(QemuOpts *opts, const char *params,
>> + const char *firstname, Error **errp)
>> {
>
> Up to you if you want to improve that; either way, it's in a comment, so
> it doesn't affect correctness, so:
>
> Reviewed-by: Eric Blake <address@hidden>
Thanks!
- [Qemu-devel] [PATCH 10/13] block: Simplify setting numeric options, (continued)
- [Qemu-devel] [PATCH 10/13] block: Simplify setting numeric options, Markus Armbruster, 2015/02/16
- [Qemu-devel] [PATCH 04/13] qemu-img: Suppress unhelpful extra errors in convert, resize, Markus Armbruster, 2015/02/16
- [Qemu-devel] [PATCH 13/13] qtest: Use qemu_opt_set() instead of qemu_opts_parse(), Markus Armbruster, 2015/02/16
- [Qemu-devel] [PATCH 09/13] qemu-img: Suppress unhelpful extra errors in convert, amend, Markus Armbruster, 2015/02/16
- [Qemu-devel] [PATCH 01/13] QemuOpts: Convert qemu_opt_set_bool() to Error, fix its use, Markus Armbruster, 2015/02/16
- [Qemu-devel] [PATCH 11/13] qemu-sockets: Simplify setting numeric and boolean options, Markus Armbruster, 2015/02/16
- [Qemu-devel] [PATCH 02/13] QemuOpts: Convert qemu_opt_set_number() to Error, fix its use, Markus Armbruster, 2015/02/16
- [Qemu-devel] [PATCH 08/13] QemuOpts: Propagate errors through opts_parse(), Markus Armbruster, 2015/02/16
- [Qemu-devel] [PATCH 12/13] pc: Use qemu_opt_set() instead of qemu_opts_parse(), Markus Armbruster, 2015/02/16