]> git.proxmox.com Git - mirror_qemu.git/commitdiff
block: Suppress unhelpful extra errors in bdrv_img_create()
authorMarkus Armbruster <armbru@redhat.com>
Thu, 12 Feb 2015 16:49:02 +0000 (17:49 +0100)
committerMarkus Armbruster <armbru@redhat.com>
Thu, 26 Feb 2015 13:48:31 +0000 (14:48 +0100)
bdrv_img_create() uses qemu_opt_set(), which reports errors with
qerror_report_err().  Its error messages aren't helpful here, the
caller reports one that actually makes sense.  I don't know how to
trigger the error conditions, though.

Switch to qemu_opt_set_err() to get rid of the unwanted messages.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
block.c

diff --git a/block.c b/block.c
index f59c4cf89893fb53ffd9ffe697a9bce51363e9b4..f5ae5cd26c99fa5fd60c7e706341ee0be2b02e82 100644 (file)
--- a/block.c
+++ b/block.c
@@ -5660,7 +5660,9 @@ void bdrv_img_create(const char *filename, const char *fmt,
     }
 
     if (base_filename) {
-        if (qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, base_filename)) {
+        qemu_opt_set_err(opts, BLOCK_OPT_BACKING_FILE, base_filename,
+                         &local_err);
+        if (local_err) {
             error_setg(errp, "Backing file not supported for file format '%s'",
                        fmt);
             goto out;
@@ -5668,7 +5670,8 @@ void bdrv_img_create(const char *filename, const char *fmt,
     }
 
     if (base_fmt) {
-        if (qemu_opt_set(opts, BLOCK_OPT_BACKING_FMT, base_fmt)) {
+        qemu_opt_set_err(opts, BLOCK_OPT_BACKING_FMT, base_fmt, &local_err);
+        if (local_err) {
             error_setg(errp, "Backing file format not supported for file "
                              "format '%s'", fmt);
             goto out;