[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] block: Print its file name if backing file open
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH] block: Print its file name if backing file opening failed |
Date: |
Thu, 07 Nov 2013 06:17:24 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 |
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 <address@hidden>
> ---
> 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
signature.asc
Description: OpenPGP digital signature