This function will simply call qmp interface qmp_query_snapshots()
added in last commit and then dump information in monitor console.
To get snapshot info, Now qemu and qemu-img both call block layer
function bdrv_query_snapshot_info_list() in their calling path, and
then they just translate the qmp object got to strings in stdout or
monitor console.
Signed-off-by: Wenchao Xia <address@hidden>
---
hmp.c | 42 ++++++++++++++++++++++++++++++++++++++++++
hmp.h | 1 +
2 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/hmp.c b/hmp.c
index b0a861c..c475d65 100644
--- a/hmp.c
+++ b/hmp.c
@@ -651,6 +651,48 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict)
qapi_free_TPMInfoList(info_list);
}
+/* assume list is valid */
+static void monitor_dump_snapshotinfolist(Monitor *mon, SnapshotInfoList *list)
+{
+ SnapshotInfoList *elem;
+ char buf[256];
+
+ monitor_printf(mon, "%s\n", bdrv_snapshot_dump(buf, sizeof(buf), NULL));