From patchwork Mon Feb 18 14:09:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wayne Xia X-Patchwork-Id: 221390 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8B6B52C0040 for ; Tue, 19 Feb 2013 01:14:47 +1100 (EST) Received: from localhost ([::1]:43494 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7RUT-0001Sc-Mw for incoming@patchwork.ozlabs.org; Mon, 18 Feb 2013 09:14:45 -0500 Received: from eggs.gnu.org ([208.118.235.92]:60811) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7RTR-0007oc-HB for qemu-devel@nongnu.org; Mon, 18 Feb 2013 09:13:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U7RTK-0002Tt-FJ for qemu-devel@nongnu.org; Mon, 18 Feb 2013 09:13:41 -0500 Received: from e28smtp08.in.ibm.com ([122.248.162.8]:57873) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7RTJ-0002TL-U7 for qemu-devel@nongnu.org; Mon, 18 Feb 2013 09:13:34 -0500 Received: from /spool/local by e28smtp08.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 18 Feb 2013 19:40:13 +0530 Received: from d28dlp03.in.ibm.com (9.184.220.128) by e28smtp08.in.ibm.com (192.168.1.138) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 18 Feb 2013 19:40:12 +0530 Received: from d28relay05.in.ibm.com (d28relay05.in.ibm.com [9.184.220.62]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id DE0061258055 for ; Mon, 18 Feb 2013 19:44:15 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay05.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r1IEDSLR30408882 for ; Mon, 18 Feb 2013 19:43:28 +0530 Received: from d28av02.in.ibm.com (loopback [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r1IEDSgA011319 for ; Tue, 19 Feb 2013 01:13:30 +1100 Received: from RH63Wenchao ([9.77.177.33]) by d28av02.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r1IEA8w1030211; Tue, 19 Feb 2013 01:13:26 +1100 From: Wenchao Xia To: qemu-devel@nongnu.org Date: Mon, 18 Feb 2013 22:09:38 +0800 Message-Id: <1361196578-19016-15-git-send-email-xiawenc@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1361196578-19016-1-git-send-email-xiawenc@linux.vnet.ibm.com> References: <1361196578-19016-1-git-send-email-xiawenc@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13021814-2000-0000-0000-00000AFE2259 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 122.248.162.8 Cc: kwolf@redhat.com, aliguori@us.ibm.com, phrdina@redhat.com, stefanha@gmail.com, armbru@redhat.com, lcapitulino@redhat.com, pbonzini@redhat.com, Wenchao Xia Subject: [Qemu-devel] [PATCH V6 14/14] hmp: show snapshots on single block device X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch added the support of showing internal snapshots on a single block device in hmp layer, by simply change parameter in calling of qmp funtion. Signed-off-by: Wenchao Xia --- hmp.c | 7 ++++++- monitor.c | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/hmp.c b/hmp.c index d29787f..834ee42 100644 --- a/hmp.c +++ b/hmp.c @@ -633,8 +633,10 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict) { Error *err = NULL; SnapshotInfoList *list; + const char *device = qdict_get_try_str(qdict, "device"); + bool has_device = device ? true : false; - list = qmp_query_snapshots(false, NULL, &err); + list = qmp_query_snapshots(has_device, device, &err); if (error_is_set(&err)) { hmp_handle_error(mon, &err); return; @@ -645,6 +647,9 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict) return; } + if (has_device) { + monitor_printf(mon, "Device '%s':\n", device); + } monitor_dump_snapshotinfolist(mon, list); qapi_free_SnapshotInfoList(list); } diff --git a/monitor.c b/monitor.c index b828585..7a2bd9a 100644 --- a/monitor.c +++ b/monitor.c @@ -2591,9 +2591,9 @@ static mon_cmd_t info_cmds[] = { }, { .name = "snapshots", - .args_type = "", - .params = "", - .help = "show the currently saved VM snapshots", + .args_type = "device:B?", + .params = "[device]", + .help = "show snapshots of whole vm or a single device", .mhandler.cmd = hmp_info_snapshots, }, {