From patchwork Thu Jan 17 07:40:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wayne Xia X-Patchwork-Id: 213174 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 2692A2C007B for ; Thu, 17 Jan 2013 19:34:26 +1100 (EST) Received: from localhost ([::1]:38390 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tvk8K-0007MS-Ru for incoming@patchwork.ozlabs.org; Thu, 17 Jan 2013 02:43:32 -0500 Received: from eggs.gnu.org ([208.118.235.92]:58113) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tvk7n-0006Wv-2z for qemu-devel@nongnu.org; Thu, 17 Jan 2013 02:42:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tvk7l-00021v-U7 for qemu-devel@nongnu.org; Thu, 17 Jan 2013 02:42:59 -0500 Received: from e23smtp01.au.ibm.com ([202.81.31.143]:47574) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tvk7l-00021d-6T for qemu-devel@nongnu.org; Thu, 17 Jan 2013 02:42:57 -0500 Received: from /spool/local by e23smtp01.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 17 Jan 2013 17:38:10 +1000 Received: from d23dlp01.au.ibm.com (202.81.31.203) by e23smtp01.au.ibm.com (202.81.31.207) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 17 Jan 2013 17:38:07 +1000 Received: from d23relay05.au.ibm.com (d23relay05.au.ibm.com [9.190.235.152]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id 23C9E2CE804D for ; Thu, 17 Jan 2013 18:42:52 +1100 (EST) Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r0H7V3hM50987046 for ; Thu, 17 Jan 2013 18:31:03 +1100 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r0H7gp7k012769 for ; Thu, 17 Jan 2013 18:42:51 +1100 Received: from RH63Wenchao (wenchaox.cn.ibm.com [9.115.122.253]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r0H7e023007864; Thu, 17 Jan 2013 18:42:49 +1100 From: Wenchao Xia To: qemu-devel@nongnu.org Date: Thu, 17 Jan 2013 15:40:10 +0800 Message-Id: <1358408410-22187-14-git-send-email-xiawenc@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1358408410-22187-1-git-send-email-xiawenc@linux.vnet.ibm.com> References: <1358408410-22187-1-git-send-email-xiawenc@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13011707-1618-0000-0000-00000334396B X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 202.81.31.143 Cc: 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 V4 13/13] 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. Note: This patch need previous hmp extention patch which enable info sub command take qdict * as paramter. 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 1e8f9eb..4a6c3ee 100644 --- a/hmp.c +++ b/hmp.c @@ -655,8 +655,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; @@ -667,6 +669,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 4bb80c0..a2aa10c 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, }, {