diff mbox

[V6,14/14] hmp: show snapshots on single block device

Message ID 1361196578-19016-15-git-send-email-xiawenc@linux.vnet.ibm.com
State New
Headers show

Commit Message

Wayne Xia Feb. 18, 2013, 2:09 p.m. UTC
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 <xiawenc@linux.vnet.ibm.com>
---
 hmp.c     |    7 ++++++-
 monitor.c |    6 +++---
 2 files changed, 9 insertions(+), 4 deletions(-)

Comments

Eric Blake Feb. 19, 2013, 8:51 p.m. UTC | #1
On 02/18/2013 07:09 AM, Wenchao Xia wrote:
>   This patch added the support of showing internal snapshots on a
> single block device in hmp layer, by simply change parameter in

s/change/changing a/

> calling of qmp funtion.

s/funtion/function/

> 
> Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
> ---
>  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;

The prevailing style appears to be:

bool has_device = !!device;
Wayne Xia Feb. 26, 2013, 7:36 a.m. UTC | #2
于 2013-2-20 4:51, Eric Blake 写道:
> On 02/18/2013 07:09 AM, Wenchao Xia wrote:
>>    This patch added the support of showing internal snapshots on a
>> single block device in hmp layer, by simply change parameter in
>
> s/change/changing a/
>
>> calling of qmp funtion.
>
> s/funtion/function/
>
   OK.

>>
>> Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
>> ---
>>   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;
>
> The prevailing style appears to be:
>
> bool has_device = !!device;
>
   oops, thanks for tipping it.
diff mbox

Patch

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,
     },
     {