diff mbox

[05/13] block: Suppress unhelpful extra errors in bdrv_img_create()

Message ID 1424097865-3973-6-git-send-email-armbru@redhat.com
State New
Headers show

Commit Message

Markus Armbruster Feb. 16, 2015, 2:44 p.m. UTC
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>
---
 block.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Eric Blake Feb. 16, 2015, 10:26 p.m. UTC | #1
On 02/16/2015 07:44 AM, Markus Armbruster wrote:
> 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>
> ---
>  block.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>
diff mbox

Patch

diff --git a/block.c b/block.c
index be28845..09352cb 100644
--- a/block.c
+++ b/block.c
@@ -5657,7 +5657,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;
@@ -5665,7 +5667,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;