mirror of
https://github.com/mii443/qemu.git
synced 2025-12-17 01:28:52 +00: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:
10
qemu-char.c
10
qemu-char.c
@@ -3379,8 +3379,11 @@ QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)
|
||||
qemu_opt_set(opts, "host", host, &error_abort);
|
||||
qemu_opt_set(opts, "port", port, &error_abort);
|
||||
if (p[pos] == ',') {
|
||||
if (qemu_opts_do_parse(opts, p+pos+1, NULL) != 0)
|
||||
qemu_opts_do_parse(opts, p+pos+1, NULL, &local_err);
|
||||
if (local_err) {
|
||||
error_report_err(local_err);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
if (strstart(filename, "telnet:", &p))
|
||||
qemu_opt_set(opts, "telnet", "on", &error_abort);
|
||||
@@ -3411,8 +3414,11 @@ QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)
|
||||
}
|
||||
if (strstart(filename, "unix:", &p)) {
|
||||
qemu_opt_set(opts, "backend", "socket", &error_abort);
|
||||
if (qemu_opts_do_parse(opts, p, "path") != 0)
|
||||
qemu_opts_do_parse(opts, p, "path", &local_err);
|
||||
if (local_err) {
|
||||
error_report_err(local_err);
|
||||
goto fail;
|
||||
}
|
||||
return opts;
|
||||
}
|
||||
if (strstart(filename, "/dev/parport", NULL) ||
|
||||
|
||||
Reference in New Issue
Block a user