All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Fam Zheng <famz@redhat.com>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH] block: Print its file name if backing file opening failed
Date: Thu, 07 Nov 2013 06:17:24 -0700	[thread overview]
Message-ID: <527B92E4.4080601@redhat.com> (raw)
In-Reply-To: <1383809692-11158-1-git-send-email-famz@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1545 bytes --]

On 11/07/2013 12:34 AM, Fam Zheng wrote:
> If backing file doesn't exist, the error message is confusing and
> misleading:
> 

> 
> This is not intuitive. It's better to have the missing file's name in
> the error message. With this patch:
> 
>     $ qemu-io -c 'read 0 512' /tmp/a.qcow2
>     qemu-io: can't open device /tmp/a.qcow2: Could not open backing
>     file: Could not open '/stor/vm/arch.raw': No such file or directory
>     no file open, try 'help open'
> 
> Which is a little bit better.

Indeed.  Are you trying to get this into 1.7?

> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  block.c                    | 3 ++-
>  block/raw-posix.c          | 1 -
>  block/raw-win32.c          | 1 -
>  tests/qemu-iotests/051.out | 2 +-
>  tests/qemu-iotests/069.out | 2 +-
>  5 files changed, 4 insertions(+), 5 deletions(-)

> 
> diff --git a/block.c b/block.c
> index f706634..a8dbcfc 100644
> --- a/block.c
> +++ b/block.c
> @@ -1009,7 +1009,8 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp)
>          bdrv_unref(bs->backing_hd);
>          bs->backing_hd = NULL;
>          bs->open_flags |= BDRV_O_NO_BACKING;
> -        error_propagate(errp, local_err);
> +        error_setg(errp, "Could not open backing file: %s",
> +                   error_get_pretty(local_err));
>          return ret;

Needs a v2, that doesn't leak local_err.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]

      parent reply	other threads:[~2013-11-07 13:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-07  7:34 [Qemu-devel] [PATCH] block: Print its file name if backing file opening failed Fam Zheng
2013-11-07 12:12 ` Benoît Canet
2013-11-07 13:17 ` Eric Blake [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=527B92E4.4080601@redhat.com \
    --to=eblake@redhat.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.