|
From: | Wenchao Xia |
Subject: | Re: [Qemu-devel] [PATCH V7 14/14] hmp: show snapshots on single block device |
Date: | Wed, 27 Feb 2013 16:35:56 +0800 |
User-agent: | Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 |
于 2013-2-27 10:29, Wenchao Xia 写道:
于 2013-2-27 0:13, Eric Blake 写道:On 02/26/2013 03:40 AM, Wenchao Xia wrote:This patch added the support of showing internal snapshots on an image in the backing chain of a block device in hmp layer, by calling a qmp function. Signed-off-by: Wenchao Xia <address@hidden> --- hmp.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- monitor.c | 6 ++-- 2 files changed, 83 insertions(+), 4 deletions(-) diff --git a/hmp.c b/hmp.c index 5e68b2f..ffa92ff 100644+static ImageInfo *find_image_info(const DeviceImageInfoList *device_image_list, + const char *image_name) +{ + ImageInfo *image_info; ++ + /* search the chain */ + while (device_image_list) { + if (device_image_list->value->has_image) { + image_info = device_image_list->value->image; + if (!strcmp(image_info->filename, image_name)) { + return image_info; + } + }Is this loop smart enough, or should it be borrowing from some of the additional complexity in bdrv_find_backing_image for properly chasing down relative names?OK, it will be enhanced.
To make things more straight, I guess a new hmp API is better: info image <device> -b which may show all image info on a device, including internal snapshot. In this case, hmp/qmp command are connected more closely and saves the trouble of find correct one in hmp level. If you agree I'll discard info snapshots <device> in next version.
+ if (image_info) { + if (image_info->has_snapshots) { + list = image_info->snapshots; + monitor_printf(mon, "Device '%s', Image name '%s':\n", + device_name, image_info->filename); + monitor_dump_snapshotinfolist(mon, list); + } else { + monitor_printf(mon, "Device '%s' have no valid "s/have/has/OK.+ "internal snapshot.\n", + device_name); + } + } else { + monitor_printf(mon, "Device '%s' have no correspond image now.\n",s/have no correspond image now/has no corresponding image/OK.
-- Best Regards Wenchao Xia
[Prev in Thread] | Current Thread | [Next in Thread] |