From: Laszlo Ersek <lersek@redhat.com>
To: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Cc: stefanha@gmail.com, qemu-devel@nongnu.org,
lcapitulino@redhat.com, kumagai-atsushi@mxc.nes.nec.co.jp,
anderson@redhat.com, akong@redhat.com, afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH v6 11/11] Add 'query-dump-guest-memory-capability' command
Date: Thu, 09 Jan 2014 17:34:53 +0100 [thread overview]
Message-ID: <52CECFAD.2030902@redhat.com> (raw)
In-Reply-To: <1388906864-1083-12-git-send-email-qiaonuohan@cn.fujitsu.com>
comments below
On 01/05/14 08:27, Qiao Nuohan wrote:
> 'query-dump-guest-memory-capability' is used to query whether option 'format'
> is available for 'dump-guest-memory' and the available format. The output
> of the command will be like:
>
> -> { "execute": "query-dump-guest-memory-capability" }
> <- { "return": {
> "format-option": "optional",
> "capabilities": [
> {"available": true, "format": "elf"},
> {"available": true, "format": "kdump-zlib"},
> {"available": true, "format": "kdump-lzo"},
> {"available": true, "format": "kdump-snappy"}
> ]
> }
The order of "available" and "format" in the commit message is reverse
in relation to the json. Not too important.
>
> Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
> ---
> dump.c | 38 ++++++++++++++++++++++++++++++++++++++
> qapi-schema.json | 13 +++++++++++++
> qmp-commands.hx | 7 +++++++
> 3 files changed, 58 insertions(+), 0 deletions(-)
>
> diff --git a/dump.c b/dump.c
> index b4e79ff..51fe23a 100644
> --- a/dump.c
> +++ b/dump.c
> @@ -1757,3 +1757,41 @@ 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)
> +{
> + int i;
> + DumpGuestMemoryCapabilityStatusList *item;
> + DumpGuestMemoryCapability *cap =
> + g_malloc0(sizeof(DumpGuestMemoryCapability));
> +
> + cap->format_option = g_strdup_printf("optional");
> +
> + for (i = 0; i < DUMP_GUEST_MEMORY_FORMAT_MAX; i++) {
> + if (cap->capabilities == NULL) {
> + item = g_malloc0(sizeof(DumpGuestMemoryCapabilityStatusList));
> + cap->capabilities = item;
> + } else {
> + item->next = g_malloc0(sizeof(DumpGuestMemoryCapabilityStatusList));
> + item = item->next;
> + }
> +
> + item->value = g_malloc0(sizeof(struct DumpGuestMemoryCapabilityStatus));
> + item->value->format = i;
> + item->value->available = true;
> +
> + if (i == DUMP_GUEST_MEMORY_FORMAT_KDUMP_LZO) {
> +#ifndef CONFIG_LZO
> + item->value->available = false;
> +#endif
> + }
> +
> + if (i == DUMP_GUEST_MEMORY_FORMAT_KDUMP_SNAPPY) {
> +#ifndef CONFIG_SNAPPY
> + item->value->available = false;
> +#endif
> + }
> + }
You could move the preprocessor directives outside.
Also, since the "available" field is false by nature of g_malloc0(),
maybe the code could be reorganized
- from "false to true to maybe false"
- to "false to maybe true".
Not overly important.
> +
> + return cap;
> +}
> diff --git a/qapi-schema.json b/qapi-schema.json
> index 19b2b23..e545e0f 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -2740,6 +2740,19 @@
> '*length': 'int', '*format': 'DumpGuestMemoryFormat' } }
>
> ##
> +# Since: 1.8
2.0
> +##
> +{ 'type': 'DumpGuestMemoryCapabilityStatus',
> + 'data': { 'format': 'DumpGuestMemoryFormat', 'available': 'bool' } }
> +
> +{ 'type': 'DumpGuestMemoryCapability',
> + 'data': {
> + 'format-option': 'str',
> + 'capabilities': ['DumpGuestMemoryCapabilityStatus'] } }
> +
> +{ '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 3de9e7d..3379c75 100644
> --- a/qmp-commands.hx
> +++ b/qmp-commands.hx
> @@ -828,6 +828,13 @@ Notes:
> EQMP
>
> {
> + .name = "query-dump-guest-memory-capability",
> + .args_type = "",
> + .mhandler.cmd_new = qmp_marshal_input_query_dump_guest_memory_capability,
> + },
> +
> +
> + {
> .name = "netdev_add",
> .args_type = "netdev:O",
> .mhandler.cmd_new = qmp_netdev_add,
>
I think some more documentation is usual in the qmp-commands.hx file for
new commands; an SQMP/EQMP section should be likely added. However I'm
not giving my R-b only because of the 1.8 vs. 2.0 comment.
I'll let Eric decide if this query command serves libvirt sufficiently.
Thanks!
Laszlo
next prev parent reply other threads:[~2014-01-09 16:35 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-05 7:27 [Qemu-devel] [PATCH v6 00/11] Make 'dump-guest-memory' dump in kdump-compressed format Qiao Nuohan
2014-01-05 7:27 ` [Qemu-devel] [PATCH v6 01/11] dump: Add argument to write_elfxx_notes Qiao Nuohan
2014-01-06 17:03 ` Laszlo Ersek
2014-01-07 6:00 ` Qiao Nuohan
2014-01-05 7:27 ` [Qemu-devel] [PATCH v6 02/11] dump: Add API to write header of flatten format Qiao Nuohan
2014-01-06 17:15 ` Laszlo Ersek
2014-01-05 7:27 ` [Qemu-devel] [PATCH v6 03/11] dump: Add API to write vmcore Qiao Nuohan
2014-01-06 18:12 ` Laszlo Ersek
2014-01-07 6:15 ` Qiao Nuohan
2014-01-05 7:27 ` [Qemu-devel] [PATCH v6 04/11] dump: Add API to write elf notes to buffer Qiao Nuohan
2014-01-06 18:46 ` Laszlo Ersek
2014-01-07 6:17 ` Qiao Nuohan
2014-01-05 7:27 ` [Qemu-devel] [PATCH v6 05/11] dump: add support for lzo/snappy Qiao Nuohan
2014-01-06 19:25 ` Laszlo Ersek
2014-01-07 6:25 ` Qiao Nuohan
2014-01-07 7:24 ` Laszlo Ersek
2014-01-05 7:27 ` [Qemu-devel] [PATCH v6 06/11] dump: add API to write dump header Qiao Nuohan
2014-01-07 11:38 ` Laszlo Ersek
2014-01-07 11:49 ` Andreas Färber
2014-01-13 10:03 ` Qiao Nuohan
2014-01-13 10:39 ` Laszlo Ersek
2014-01-14 2:07 ` Qiao Nuohan
2014-01-14 2:29 ` Laszlo Ersek
2014-01-14 2:42 ` Qiao Nuohan
2014-01-05 7:27 ` [Qemu-devel] [PATCH v6 07/11] dump: Add API to write dump_bitmap Qiao Nuohan
2014-01-07 14:49 ` Laszlo Ersek
2014-01-07 21:41 ` Laszlo Ersek
2014-01-05 7:27 ` [Qemu-devel] [PATCH v6 08/11] dump: Add APIs to operate DataCache Qiao Nuohan
2014-01-07 15:22 ` Laszlo Ersek
2014-01-05 7:27 ` [Qemu-devel] [PATCH v6 09/11] dump: Add API to write dump pages Qiao Nuohan
2014-01-07 22:37 ` Laszlo Ersek
2014-01-07 23:12 ` Eric Blake
2014-01-05 7:27 ` [Qemu-devel] [PATCH v6 10/11] dump: Make kdump-compressed format available for 'dump-guest-memory' Qiao Nuohan
2014-01-09 15:46 ` Laszlo Ersek
2014-01-05 7:27 ` [Qemu-devel] [PATCH v6 11/11] Add 'query-dump-guest-memory-capability' command Qiao Nuohan
2014-01-09 16:34 ` Laszlo Ersek [this message]
2014-01-07 6:32 ` [Qemu-devel] [PATCH v6 00/11] Make 'dump-guest-memory' dump in kdump-compressed format Qiao Nuohan
2014-01-07 7:27 ` Laszlo Ersek
2014-01-07 7:30 ` Qiao Nuohan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52CECFAD.2030902@redhat.com \
--to=lersek@redhat.com \
--cc=afaerber@suse.de \
--cc=akong@redhat.com \
--cc=anderson@redhat.com \
--cc=kumagai-atsushi@mxc.nes.nec.co.jp \
--cc=lcapitulino@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qiaonuohan@cn.fujitsu.com \
--cc=stefanha@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.