diff mbox

[v10,13/13] dump: add 'query-dump-guest-memory-capability' command

Message ID 52FC2471.2010309@cn.fujitsu.com
State New
Headers show

Commit Message

Qiao Nuohan Feb. 13, 2014, 1:48 a.m. UTC
On 02/12/2014 10:49 PM, Luiz Capitulino wrote:
> On Wed, 12 Feb 2014 14:34:19 +0800
> Qiao Nuohan<qiaonuohan@cn.fujitsu.com>  wrote:
>
>> 'query-dump-guest-memory-capability' is used to query the available formats for
>> 'dump-guest-memory'. The output of the command will be like:
>>
>> ->  { "execute": "query-dump-guest-memory-capability" }
>> <- { "return": { "formats":
>>                       ["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] }
>>
>> Signed-off-by: Qiao Nuohan<qiaonuohan@cn.fujitsu.com>
>
> The new command looks good to me, but the patch itself is broken. It doesn't
> apply and I could identify at least one breakage below...

I think it is because of the 80 character limit.If I am wrong, please correct
me. And I have attach the new patch with this mail, please check.

>
>> ---
>>    dump.c           |   33 +++++++++++++++++++++++++++++++++
>>    qapi-schema.json |   23 +++++++++++++++++++++++
>>    qmp-commands.hx  |   20 ++++++++++++++++++++
>>    3 files changed, 76 insertions(+), 0 deletions(-)
>>
>> diff --git a/dump.c b/dump.c
>> index 2ebbb23..3a8d55e 100644
>> --- a/dump.c
>> +++ b/dump.c
>> @@ -1788,3 +1788,36 @@ void qmp_dump_guest_memory(bool paging, const char *file,
>> bool has_begin,
>>
>>        g_free(s);
>>    }
>> +
>> +DumpGuestMemoryCapability *qmp_query_dump_guest_memory_capability(Error **errp)
>> +{
>> +    DumpGuestMemoryFormatList *item;
>> +    DumpGuestMemoryCapability *cap =
>> +                                  g_malloc0(sizeof(DumpGuestMemoryCapability));
>> +
>> +    /* elf is always available */
>> +    item = g_malloc0(sizeof(DumpGuestMemoryFormatList));
>> +    cap->formats = item;
>> +    item->value = DUMP_GUEST_MEMORY_FORMAT_ELF;
>> +
>> +    /* kdump-zlib is always available */
>> +    item->next = g_malloc0(sizeof(DumpGuestMemoryFormatList));
>> +    item = item->next;
>> +    item->value = DUMP_GUEST_MEMORY_FORMAT_KDUMP_ZLIB;
>> +
>> +    /* add new item if kdump-lzo is available */
>> +#ifdef CONFIG_LZO
>> +    item->next = g_malloc0(sizeof(DumpGuestMemoryFormatList));
>> +    item = item->next;
>> +    item->value = DUMP_GUEST_MEMORY_FORMAT_KDUMP_LZO;
>> +#endif
>> +
>> +    /* add new item if kdump-snappy is available */
>> +#ifdef CONFIG_SNAPPY
>> +    item->next = g_malloc0(sizeof(DumpGuestMemoryFormatList));
>> +    item = item->next;
>> +    item->value = DUMP_GUEST_MEMORY_FORMAT_KDUMP_SNAPPY;
>> +#endif
>> +
>> +    return cap;
>> +}
>> diff --git a/qapi-schema.json b/qapi-schema.json
>> index 7f62007..a097e6c 100644
>> --- a/qapi-schema.json
>> +++ b/qapi-schema.json
>> @@ -2783,6 +2783,29 @@
>>                '*length': 'int', '*format': 'DumpGuestMemoryFormat' } }
>>
>>    ##
>> +# @DumpGuestMemoryCapability:
>> +#
>> +# A list of the available formats for dump-guest-memory
>> +#
>> +# Since: 2.0
>> +##
>> +{ 'type': 'DumpGuestMemoryCapability',
>> +  'data': {
>> +      'formats': ['DumpGuestMemoryFormat'] } }
>> +
>> +##
>> +# @query-dump-guest-memory-capability:
>> +#
>> +# Returns the available formats for dump-guest-memory
>> +#
>> +# Returns:  A @DumpGuestMemoryCapability object listing available formats for
>> +#           dump-guest-memory
>> +#
>> +# Since: 2.0
>> +##
>> +{ 'command': 'query-dump-guest-memory-capability', 'returns':
>> 'DumpGuestMemoryCapability' }
>
> Here.
>
>> +
>> +##
>>    # @netdev_add:
>>    #
>>    # Add a network backend.
>> diff --git a/qmp-commands.hx b/qmp-commands.hx
>> index 019dde6..029cb3d 100644
>> --- a/qmp-commands.hx
>> +++ b/qmp-commands.hx
>> @@ -829,6 +829,26 @@ Notes:
>>    EQMP
>>
>>        {
>> +        .name       = "query-dump-guest-memory-capability",
>> +        .args_type  = "",
>> +        .mhandler.cmd_new = qmp_marshal_input_query_dump_guest_memory_capability,
>> +    },
>> +
>> +SQMP
>> +query-dump-guest-memory-capability
>> +----------
>> +
>> +Show available formats for 'dump-guest-memory'
>> +
>> +Example:
>> +
>> +->  { "execute": "query-dump-guest-memory-capability" }
>> +<- { "return": { "formats":
>> +                    ["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] }
>> +
>> +EQMP
>> +
>> +    {
>>            .name       = "netdev_add",
>>            .args_type  = "netdev:O",
>>            .mhandler.cmd_new = qmp_netdev_add,
>
>

Comments

Luiz Capitulino Feb. 13, 2014, 2:57 a.m. UTC | #1
On Thu, 13 Feb 2014 09:48:33 +0800
Qiao Nuohan <qiaonuohan@cn.fujitsu.com> wrote:

> On 02/12/2014 10:49 PM, Luiz Capitulino wrote:
> > On Wed, 12 Feb 2014 14:34:19 +0800
> > Qiao Nuohan<qiaonuohan@cn.fujitsu.com>  wrote:
> >
> >> 'query-dump-guest-memory-capability' is used to query the available formats for
> >> 'dump-guest-memory'. The output of the command will be like:
> >>
> >> ->  { "execute": "query-dump-guest-memory-capability" }
> >> <- { "return": { "formats":
> >>                       ["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] }
> >>
> >> Signed-off-by: Qiao Nuohan<qiaonuohan@cn.fujitsu.com>
> >
> > The new command looks good to me, but the patch itself is broken. It doesn't
> > apply and I could identify at least one breakage below...
> 
> I think it is because of the 80 character limit.If I am wrong, please correct
> me. And I have attach the new patch with this mail, please check.

Yes, works now. Paolo, Eric, any acks here?

> 
> >
> >> ---
> >>    dump.c           |   33 +++++++++++++++++++++++++++++++++
> >>    qapi-schema.json |   23 +++++++++++++++++++++++
> >>    qmp-commands.hx  |   20 ++++++++++++++++++++
> >>    3 files changed, 76 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/dump.c b/dump.c
> >> index 2ebbb23..3a8d55e 100644
> >> --- a/dump.c
> >> +++ b/dump.c
> >> @@ -1788,3 +1788,36 @@ void qmp_dump_guest_memory(bool paging, const char *file,
> >> bool has_begin,
> >>
> >>        g_free(s);
> >>    }
> >> +
> >> +DumpGuestMemoryCapability *qmp_query_dump_guest_memory_capability(Error **errp)
> >> +{
> >> +    DumpGuestMemoryFormatList *item;
> >> +    DumpGuestMemoryCapability *cap =
> >> +                                  g_malloc0(sizeof(DumpGuestMemoryCapability));
> >> +
> >> +    /* elf is always available */
> >> +    item = g_malloc0(sizeof(DumpGuestMemoryFormatList));
> >> +    cap->formats = item;
> >> +    item->value = DUMP_GUEST_MEMORY_FORMAT_ELF;
> >> +
> >> +    /* kdump-zlib is always available */
> >> +    item->next = g_malloc0(sizeof(DumpGuestMemoryFormatList));
> >> +    item = item->next;
> >> +    item->value = DUMP_GUEST_MEMORY_FORMAT_KDUMP_ZLIB;
> >> +
> >> +    /* add new item if kdump-lzo is available */
> >> +#ifdef CONFIG_LZO
> >> +    item->next = g_malloc0(sizeof(DumpGuestMemoryFormatList));
> >> +    item = item->next;
> >> +    item->value = DUMP_GUEST_MEMORY_FORMAT_KDUMP_LZO;
> >> +#endif
> >> +
> >> +    /* add new item if kdump-snappy is available */
> >> +#ifdef CONFIG_SNAPPY
> >> +    item->next = g_malloc0(sizeof(DumpGuestMemoryFormatList));
> >> +    item = item->next;
> >> +    item->value = DUMP_GUEST_MEMORY_FORMAT_KDUMP_SNAPPY;
> >> +#endif
> >> +
> >> +    return cap;
> >> +}
> >> diff --git a/qapi-schema.json b/qapi-schema.json
> >> index 7f62007..a097e6c 100644
> >> --- a/qapi-schema.json
> >> +++ b/qapi-schema.json
> >> @@ -2783,6 +2783,29 @@
> >>                '*length': 'int', '*format': 'DumpGuestMemoryFormat' } }
> >>
> >>    ##
> >> +# @DumpGuestMemoryCapability:
> >> +#
> >> +# A list of the available formats for dump-guest-memory
> >> +#
> >> +# Since: 2.0
> >> +##
> >> +{ 'type': 'DumpGuestMemoryCapability',
> >> +  'data': {
> >> +      'formats': ['DumpGuestMemoryFormat'] } }
> >> +
> >> +##
> >> +# @query-dump-guest-memory-capability:
> >> +#
> >> +# Returns the available formats for dump-guest-memory
> >> +#
> >> +# Returns:  A @DumpGuestMemoryCapability object listing available formats for
> >> +#           dump-guest-memory
> >> +#
> >> +# Since: 2.0
> >> +##
> >> +{ 'command': 'query-dump-guest-memory-capability', 'returns':
> >> 'DumpGuestMemoryCapability' }
> >
> > Here.
> >
> >> +
> >> +##
> >>    # @netdev_add:
> >>    #
> >>    # Add a network backend.
> >> diff --git a/qmp-commands.hx b/qmp-commands.hx
> >> index 019dde6..029cb3d 100644
> >> --- a/qmp-commands.hx
> >> +++ b/qmp-commands.hx
> >> @@ -829,6 +829,26 @@ Notes:
> >>    EQMP
> >>
> >>        {
> >> +        .name       = "query-dump-guest-memory-capability",
> >> +        .args_type  = "",
> >> +        .mhandler.cmd_new = qmp_marshal_input_query_dump_guest_memory_capability,
> >> +    },
> >> +
> >> +SQMP
> >> +query-dump-guest-memory-capability
> >> +----------
> >> +
> >> +Show available formats for 'dump-guest-memory'
> >> +
> >> +Example:
> >> +
> >> +->  { "execute": "query-dump-guest-memory-capability" }
> >> +<- { "return": { "formats":
> >> +                    ["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] }
> >> +
> >> +EQMP
> >> +
> >> +    {
> >>            .name       = "netdev_add",
> >>            .args_type  = "netdev:O",
> >>            .mhandler.cmd_new = qmp_netdev_add,
> >
> >
> 
>
Eric Blake Feb. 13, 2014, 1:13 p.m. UTC | #2
On 02/12/2014 06:48 PM, Qiao Nuohan wrote:

>>From c729625031c88b0bf32bae50c39f81585303cc52 Mon Sep 17 00:00:00 2001
> From: qiaonuohan <qiaonuohan@cn.fujitsu.com>
> Date: Thu, 13 Feb 2014 09:39:26 +0800
> Subject: [PATCH v11 13/13] dump: add 'query-dump-guest-memory-capability' command
> 
> 'query-dump-guest-memory-capability' is used to query the available formats for
> 'dump-guest-memory'. The output of the command will be like:
> 
> -> { "execute": "query-dump-guest-memory-capability" }
> <- { "return": { "formats":
>                     ["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] }
> 
> Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
> ---
>  dump.c           |   33 +++++++++++++++++++++++++++++++++
>  qapi-schema.json |   24 ++++++++++++++++++++++++
>  qmp-commands.hx  |   20 ++++++++++++++++++++
>  3 files changed, 77 insertions(+), 0 deletions(-)

Reviewed-by: Eric Blake <eblake@redhat.com>
Luiz Capitulino Feb. 13, 2014, 1:45 p.m. UTC | #3
On Thu, 13 Feb 2014 09:48:33 +0800
Qiao Nuohan <qiaonuohan@cn.fujitsu.com> wrote:

> On 02/12/2014 10:49 PM, Luiz Capitulino wrote:
> > On Wed, 12 Feb 2014 14:34:19 +0800
> > Qiao Nuohan<qiaonuohan@cn.fujitsu.com>  wrote:
> >
> >> 'query-dump-guest-memory-capability' is used to query the available formats for
> >> 'dump-guest-memory'. The output of the command will be like:
> >>
> >> ->  { "execute": "query-dump-guest-memory-capability" }
> >> <- { "return": { "formats":
> >>                       ["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] }
> >>
> >> Signed-off-by: Qiao Nuohan<qiaonuohan@cn.fujitsu.com>
> >
> > The new command looks good to me, but the patch itself is broken. It doesn't
> > apply and I could identify at least one breakage below...
> 
> I think it is because of the 80 character limit.If I am wrong, please correct
> me. And I have attach the new patch with this mail, please check.

Applied to the qmp branch, thanks.

> 
> >
> >> ---
> >>    dump.c           |   33 +++++++++++++++++++++++++++++++++
> >>    qapi-schema.json |   23 +++++++++++++++++++++++
> >>    qmp-commands.hx  |   20 ++++++++++++++++++++
> >>    3 files changed, 76 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/dump.c b/dump.c
> >> index 2ebbb23..3a8d55e 100644
> >> --- a/dump.c
> >> +++ b/dump.c
> >> @@ -1788,3 +1788,36 @@ void qmp_dump_guest_memory(bool paging, const char *file,
> >> bool has_begin,
> >>
> >>        g_free(s);
> >>    }
> >> +
> >> +DumpGuestMemoryCapability *qmp_query_dump_guest_memory_capability(Error **errp)
> >> +{
> >> +    DumpGuestMemoryFormatList *item;
> >> +    DumpGuestMemoryCapability *cap =
> >> +                                  g_malloc0(sizeof(DumpGuestMemoryCapability));
> >> +
> >> +    /* elf is always available */
> >> +    item = g_malloc0(sizeof(DumpGuestMemoryFormatList));
> >> +    cap->formats = item;
> >> +    item->value = DUMP_GUEST_MEMORY_FORMAT_ELF;
> >> +
> >> +    /* kdump-zlib is always available */
> >> +    item->next = g_malloc0(sizeof(DumpGuestMemoryFormatList));
> >> +    item = item->next;
> >> +    item->value = DUMP_GUEST_MEMORY_FORMAT_KDUMP_ZLIB;
> >> +
> >> +    /* add new item if kdump-lzo is available */
> >> +#ifdef CONFIG_LZO
> >> +    item->next = g_malloc0(sizeof(DumpGuestMemoryFormatList));
> >> +    item = item->next;
> >> +    item->value = DUMP_GUEST_MEMORY_FORMAT_KDUMP_LZO;
> >> +#endif
> >> +
> >> +    /* add new item if kdump-snappy is available */
> >> +#ifdef CONFIG_SNAPPY
> >> +    item->next = g_malloc0(sizeof(DumpGuestMemoryFormatList));
> >> +    item = item->next;
> >> +    item->value = DUMP_GUEST_MEMORY_FORMAT_KDUMP_SNAPPY;
> >> +#endif
> >> +
> >> +    return cap;
> >> +}
> >> diff --git a/qapi-schema.json b/qapi-schema.json
> >> index 7f62007..a097e6c 100644
> >> --- a/qapi-schema.json
> >> +++ b/qapi-schema.json
> >> @@ -2783,6 +2783,29 @@
> >>                '*length': 'int', '*format': 'DumpGuestMemoryFormat' } }
> >>
> >>    ##
> >> +# @DumpGuestMemoryCapability:
> >> +#
> >> +# A list of the available formats for dump-guest-memory
> >> +#
> >> +# Since: 2.0
> >> +##
> >> +{ 'type': 'DumpGuestMemoryCapability',
> >> +  'data': {
> >> +      'formats': ['DumpGuestMemoryFormat'] } }
> >> +
> >> +##
> >> +# @query-dump-guest-memory-capability:
> >> +#
> >> +# Returns the available formats for dump-guest-memory
> >> +#
> >> +# Returns:  A @DumpGuestMemoryCapability object listing available formats for
> >> +#           dump-guest-memory
> >> +#
> >> +# Since: 2.0
> >> +##
> >> +{ 'command': 'query-dump-guest-memory-capability', 'returns':
> >> 'DumpGuestMemoryCapability' }
> >
> > Here.
> >
> >> +
> >> +##
> >>    # @netdev_add:
> >>    #
> >>    # Add a network backend.
> >> diff --git a/qmp-commands.hx b/qmp-commands.hx
> >> index 019dde6..029cb3d 100644
> >> --- a/qmp-commands.hx
> >> +++ b/qmp-commands.hx
> >> @@ -829,6 +829,26 @@ Notes:
> >>    EQMP
> >>
> >>        {
> >> +        .name       = "query-dump-guest-memory-capability",
> >> +        .args_type  = "",
> >> +        .mhandler.cmd_new = qmp_marshal_input_query_dump_guest_memory_capability,
> >> +    },
> >> +
> >> +SQMP
> >> +query-dump-guest-memory-capability
> >> +----------
> >> +
> >> +Show available formats for 'dump-guest-memory'
> >> +
> >> +Example:
> >> +
> >> +->  { "execute": "query-dump-guest-memory-capability" }
> >> +<- { "return": { "formats":
> >> +                    ["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] }
> >> +
> >> +EQMP
> >> +
> >> +    {
> >>            .name       = "netdev_add",
> >>            .args_type  = "netdev:O",
> >>            .mhandler.cmd_new = qmp_netdev_add,
> >
> >
> 
>
diff mbox

Patch

diff --git a/dump.c b/dump.c
index 2ebbb23..3a8d55e 100644
--- a/dump.c
+++ b/dump.c
@@ -1788,3 +1788,36 @@  void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,
 
     g_free(s);
 }
+
+DumpGuestMemoryCapability *qmp_query_dump_guest_memory_capability(Error **errp)
+{
+    DumpGuestMemoryFormatList *item;
+    DumpGuestMemoryCapability *cap =
+                                  g_malloc0(sizeof(DumpGuestMemoryCapability));
+
+    /* elf is always available */
+    item = g_malloc0(sizeof(DumpGuestMemoryFormatList));
+    cap->formats = item;
+    item->value = DUMP_GUEST_MEMORY_FORMAT_ELF;
+
+    /* kdump-zlib is always available */
+    item->next = g_malloc0(sizeof(DumpGuestMemoryFormatList));
+    item = item->next;
+    item->value = DUMP_GUEST_MEMORY_FORMAT_KDUMP_ZLIB;
+
+    /* add new item if kdump-lzo is available */
+#ifdef CONFIG_LZO
+    item->next = g_malloc0(sizeof(DumpGuestMemoryFormatList));
+    item = item->next;
+    item->value = DUMP_GUEST_MEMORY_FORMAT_KDUMP_LZO;
+#endif
+
+    /* add new item if kdump-snappy is available */
+#ifdef CONFIG_SNAPPY
+    item->next = g_malloc0(sizeof(DumpGuestMemoryFormatList));
+    item = item->next;
+    item->value = DUMP_GUEST_MEMORY_FORMAT_KDUMP_SNAPPY;
+#endif
+
+    return cap;
+}
diff --git a/qapi-schema.json b/qapi-schema.json
index 905a8af..3eeb261 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -2783,6 +2783,30 @@ 
             '*length': 'int', '*format': 'DumpGuestMemoryFormat' } }
 
 ##
+# @DumpGuestMemoryCapability:
+#
+# A list of the available formats for dump-guest-memory
+#
+# Since: 2.0
+##
+{ 'type': 'DumpGuestMemoryCapability',
+  'data': {
+      'formats': ['DumpGuestMemoryFormat'] } }
+
+##
+# @query-dump-guest-memory-capability:
+#
+# Returns the available formats for dump-guest-memory
+#
+# Returns:  A @DumpGuestMemoryCapability object listing available formats for
+#           dump-guest-memory
+#
+# Since: 2.0
+##
+{ 'command': 'query-dump-guest-memory-capability',
+  'returns': 'DumpGuestMemoryCapability' }
+
+##
 # @netdev_add:
 #
 # Add a network backend.
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 019dde6..029cb3d 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -829,6 +829,26 @@  Notes:
 EQMP
 
     {
+        .name       = "query-dump-guest-memory-capability",
+        .args_type  = "",
+        .mhandler.cmd_new = qmp_marshal_input_query_dump_guest_memory_capability,
+    },
+
+SQMP
+query-dump-guest-memory-capability
+----------
+
+Show available formats for 'dump-guest-memory'
+
+Example:
+
+-> { "execute": "query-dump-guest-memory-capability" }
+<- { "return": { "formats":
+                    ["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] }
+
+EQMP
+
+    {
         .name       = "netdev_add",
         .args_type  = "netdev:O",
         .mhandler.cmd_new = qmp_netdev_add,