Skip to content

Commit

Permalink
dump: add 'query-dump-guest-memory-capability' command
Browse files Browse the repository at this point in the history
'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 <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Luiz Capitulino <[email protected]>
  • Loading branch information
qiaonuohan authored and Luiz Capitulino committed Feb 28, 2014
1 parent 4ab23a9 commit 7d6dc7f
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
33 changes: 33 additions & 0 deletions dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -1791,3 +1791,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;
}
24 changes: 24 additions & 0 deletions qapi-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2861,6 +2861,30 @@
'data': { 'paging': 'bool', 'protocol': 'str', '*begin': 'int',
'*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:
#
Expand Down
20 changes: 20 additions & 0 deletions qmp-commands.hx
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,26 @@ Notes:

(1) All boolean arguments default to false

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

{
Expand Down

0 comments on commit 7d6dc7f

Please sign in to comment.