qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH 1/2] qapi: Tweak error message of bdrv_query_ima


From: Max Reitz
Subject: Re: [Qemu-block] [PATCH 1/2] qapi: Tweak error message of bdrv_query_image_info
Date: Sat, 21 Jan 2017 20:33:36 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0

On 19.01.2017 14:07, Fam Zheng wrote:
> @bs doesn't always have a device name, such as when it comes from
> "qemu-img info". Report file name instead.
> 
> Signed-off-by: Fam Zheng <address@hidden>
> ---
>  block/qapi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Yes, I had a discussion with Kevin whether we should add some function
like bdrv_error_setg() which automatically prepends some description™ of
a BDS (e.g. node name if user-set, or device name if meaningful, or
filename if not JSON). Spoiler: We probably should.

This is fine for now, though, because this function specifically deals
with images.

Max

> diff --git a/block/qapi.c b/block/qapi.c
> index a62e862..6329735 100644
> --- a/block/qapi.c
> +++ b/block/qapi.c
> @@ -237,8 +237,8 @@ void bdrv_query_image_info(BlockDriverState *bs,
>  
>      size = bdrv_getlength(bs);
>      if (size < 0) {
> -        error_setg_errno(errp, -size, "Can't get size of device '%s'",
> -                         bdrv_get_device_name(bs));
> +        error_setg_errno(errp, -size, "Can't get image size '%s'",
> +                         bs->exact_filename);
>          goto out;
>      }
>  
> 


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]