aboutsummaryrefslogtreecommitdiff
path: root/qemu-img.c
diff options
context:
space:
mode:
authorWenchao Xia <xiawenc@linux.vnet.ibm.com>2013-06-06 12:27:58 +0800
committerStefan Hajnoczi <stefanha@redhat.com>2013-06-07 13:37:45 +0200
commit43526ec8d1395fe4efbed15e9764b64641b95bcc (patch)
treeccad569dfd421aadc160f34d67cc527a7cbacb1f /qemu-img.c
parentfb0ed4539c6f02fa9e5a3cf9df2549713451eeca (diff)
block: add image info query function bdrv_query_image_info()
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 <xiawenc@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'qemu-img.c')
-rw-r--r--qemu-img.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/qemu-img.c b/qemu-img.c
index e3d8fe3c77..809b4f1c00 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1644,6 +1644,7 @@ static ImageInfoList *collect_image_info_list(const char *filename,
ImageInfoList *head = NULL;
ImageInfoList **last = &head;
GHashTable *filenames;
+ Error *err = NULL;
filenames = g_hash_table_new_full(g_str_hash, str_equal_func, NULL, NULL);
@@ -1665,11 +1666,11 @@ 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, NULL);
- if (info->snapshots) {
- info->has_snapshots = true;
+ bdrv_query_image_info(bs, &info, &err);
+ if (error_is_set(&err)) {
+ error_report("%s", error_get_pretty(err));
+ error_free(err);
+ goto err;
}
elem = g_new0(ImageInfoList, 1);