qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH V4 13/13] hmp: show snapshots on single block device


From: Wenchao Xia
Subject: [Qemu-devel] [PATCH V4 13/13] hmp: show snapshots on single block device
Date: Thu, 17 Jan 2013 15:40:10 +0800

  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 <address@hidden>
---
 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,
     },
     {
-- 
1.7.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]