[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH V12 08/18] block: add image info query function
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH V12 08/18] block: add image info query function bdrv_query_image_info() |
Date: |
Wed, 17 Apr 2013 16:56:47 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130402 Thunderbird/17.0.5 |
On 04/13/2013 02:56 AM, Wenchao Xia wrote:
> This patch adds function bdrv_query_image_info(), which will
> retrieve image info in qmp object format. The implementation is
> based on the code moved from qemu-img.c, but uses block layer
> function to get snapshot info.
>
> Signed-off-by: Wenchao Xia <address@hidden>
> ---
> block/qapi.c | 37 +++++++++++++++++++++++++++++++------
> include/block/qapi.h | 6 +++---
> qemu-img.c | 7 ++-----
> 3 files changed, 36 insertions(+), 14 deletions(-)
>
> +/* return 0 on success, and @p_info will be set only on success. */
> +int bdrv_query_image_info(BlockDriverState *bs,
> + ImageInfo **p_info,
> + Error **errp)
Is it necessary to return a value? If all callers pass in an errp, then
this function can be void, and you can use the error parameter as the
lone indication of problems.
> +++ b/qemu-img.c
> @@ -1733,11 +1733,8 @@ static ImageInfoList *collect_image_info_list(const
> char *filename,
> goto err;
> }
>
> - info = g_new0(ImageInfo, 1);
> - bdrv_collect_image_info(bs, info, filename);
> - bdrv_query_snapshot_info_list(bs, &info->snapshots, false, NULL);
> - if (info->snapshots) {
> - info->has_snapshots = true;
> + if (bdrv_query_image_info(bs, &info, NULL)) {
> + goto err;
But then this caller would need to pass in a local error parameter,
where Pavel's idea of qemu_img_handle_error would make it easier.
https://lists.gnu.org/archive/html/qemu-devel/2013-04/msg03288.html
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH V12 00/18] qmp/hmp interfaces for internal snapshot info, Wenchao Xia, 2013/04/13
- [Qemu-devel] [PATCH V12 03/18] qemu-img: remove unused parameter in collect_image_info(), Wenchao Xia, 2013/04/13
- [Qemu-devel] [PATCH V12 04/18] block: move collect_snapshots() and collect_image_info() to block/qapi.c, Wenchao Xia, 2013/04/13
- [Qemu-devel] [PATCH V12 05/18] block: add snapshot info query function bdrv_query_snapshot_info_list(), Wenchao Xia, 2013/04/13
- [Qemu-devel] [PATCH V12 08/18] block: add image info query function bdrv_query_image_info(), Wenchao Xia, 2013/04/13
- Re: [Qemu-devel] [PATCH V12 08/18] block: add image info query function bdrv_query_image_info(),
Eric Blake <=
- [Qemu-devel] [PATCH V12 07/18] block: change VM snapshot checking logic, Wenchao Xia, 2013/04/13
- [Qemu-devel] [PATCH V12 09/18] block: move qmp_query_block() and bdrv_query_info() to block/qapi.c, Wenchao Xia, 2013/04/13
- [Qemu-devel] [PATCH V12 02/18] block: distinguish id and name in bdrv_find_snapshot(), Wenchao Xia, 2013/04/13
- [Qemu-devel] [PATCH V12 01/18] block: move bdrv_snapshot_find() to block/snapshot.c, Wenchao Xia, 2013/04/13
- [Qemu-devel] [PATCH V12 10/18] qmp: add interface query-snapshots, Wenchao Xia, 2013/04/13
- [Qemu-devel] [PATCH V12 11/18] qmp: add recursive member in ImageInfo, Wenchao Xia, 2013/04/13