mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 14:53:54 -06:00
qemu-img: Suppress unhelpful extra errors in convert, amend
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 <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
4f81273dd9
commit
dc523cd348
5 changed files with 40 additions and 22 deletions
|
@ -799,17 +799,16 @@ static void opts_do_parse(QemuOpts *opts, const char *params,
|
|||
}
|
||||
}
|
||||
|
||||
int qemu_opts_do_parse(QemuOpts *opts, const char *params, const char *firstname)
|
||||
/**
|
||||
* Store options parsed from @params into @opts.
|
||||
* 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)
|
||||
{
|
||||
Error *err = NULL;
|
||||
|
||||
opts_do_parse(opts, params, firstname, false, &err);
|
||||
if (err) {
|
||||
qerror_report_err(err);
|
||||
error_free(err);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
opts_do_parse(opts, params, firstname, false, errp);
|
||||
}
|
||||
|
||||
static QemuOpts *opts_parse(QemuOptsList *list, const char *params,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue