|
|
9ae3a8 |
From 1b2628fe2375d602a6f123a0aa4a5cd190e72d3e Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
Date: Fri, 7 Nov 2014 17:18:05 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 18/41] dump: add 'query-dump-guest-memory-capability' command
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Message-id: <1415380693-16593-19-git-send-email-lersek@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 62204
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.1 qemu-kvm PATCH 18/26] dump: add 'query-dump-guest-memory-capability' command
|
|
|
9ae3a8 |
Bugzilla: 1157798
|
|
|
9ae3a8 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: dgibson <dgibson@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: qiaonuohan <qiaonuohan@cn.fujitsu.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
'query-dump-guest-memory-capability' is used to query the available formats for
|
|
|
9ae3a8 |
'dump-guest-memory'. The output of the command will be like:
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-> { "execute": "query-dump-guest-memory-capability" }
|
|
|
9ae3a8 |
<- { "return": { "formats":
|
|
|
9ae3a8 |
["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] }
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
|
|
|
9ae3a8 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 7d6dc7f30c4781857ce230333da6ddd21fe0dcde)
|
|
|
9ae3a8 |
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
dump.c | 33 +++++++++++++++++++++++++++++++++
|
|
|
9ae3a8 |
qapi-schema.json | 24 ++++++++++++++++++++++++
|
|
|
9ae3a8 |
qmp-commands.hx | 20 ++++++++++++++++++++
|
|
|
9ae3a8 |
3 files changed, 77 insertions(+)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/dump.c b/dump.c
|
|
|
9ae3a8 |
index 507a250..25bf8e6 100644
|
|
|
9ae3a8 |
--- a/dump.c
|
|
|
9ae3a8 |
+++ b/dump.c
|
|
|
9ae3a8 |
@@ -1797,3 +1797,36 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
g_free(s);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+DumpGuestMemoryCapability *qmp_query_dump_guest_memory_capability(Error **errp)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ DumpGuestMemoryFormatList *item;
|
|
|
9ae3a8 |
+ DumpGuestMemoryCapability *cap =
|
|
|
9ae3a8 |
+ g_malloc0(sizeof(DumpGuestMemoryCapability));
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ /* elf is always available */
|
|
|
9ae3a8 |
+ item = g_malloc0(sizeof(DumpGuestMemoryFormatList));
|
|
|
9ae3a8 |
+ cap->formats = item;
|
|
|
9ae3a8 |
+ item->value = DUMP_GUEST_MEMORY_FORMAT_ELF;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ /* kdump-zlib is always available */
|
|
|
9ae3a8 |
+ item->next = g_malloc0(sizeof(DumpGuestMemoryFormatList));
|
|
|
9ae3a8 |
+ item = item->next;
|
|
|
9ae3a8 |
+ item->value = DUMP_GUEST_MEMORY_FORMAT_KDUMP_ZLIB;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ /* add new item if kdump-lzo is available */
|
|
|
9ae3a8 |
+#ifdef CONFIG_LZO
|
|
|
9ae3a8 |
+ item->next = g_malloc0(sizeof(DumpGuestMemoryFormatList));
|
|
|
9ae3a8 |
+ item = item->next;
|
|
|
9ae3a8 |
+ item->value = DUMP_GUEST_MEMORY_FORMAT_KDUMP_LZO;
|
|
|
9ae3a8 |
+#endif
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ /* add new item if kdump-snappy is available */
|
|
|
9ae3a8 |
+#ifdef CONFIG_SNAPPY
|
|
|
9ae3a8 |
+ item->next = g_malloc0(sizeof(DumpGuestMemoryFormatList));
|
|
|
9ae3a8 |
+ item = item->next;
|
|
|
9ae3a8 |
+ item->value = DUMP_GUEST_MEMORY_FORMAT_KDUMP_SNAPPY;
|
|
|
9ae3a8 |
+#endif
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ return cap;
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
diff --git a/qapi-schema.json b/qapi-schema.json
|
|
|
9ae3a8 |
index 8f81c76..31ac5c5 100644
|
|
|
9ae3a8 |
--- a/qapi-schema.json
|
|
|
9ae3a8 |
+++ b/qapi-schema.json
|
|
|
9ae3a8 |
@@ -2645,6 +2645,30 @@
|
|
|
9ae3a8 |
'*length': 'int', '*format': 'DumpGuestMemoryFormat' } }
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
##
|
|
|
9ae3a8 |
+# @DumpGuestMemoryCapability:
|
|
|
9ae3a8 |
+#
|
|
|
9ae3a8 |
+# A list of the available formats for dump-guest-memory
|
|
|
9ae3a8 |
+#
|
|
|
9ae3a8 |
+# Since: 2.0
|
|
|
9ae3a8 |
+##
|
|
|
9ae3a8 |
+{ 'type': 'DumpGuestMemoryCapability',
|
|
|
9ae3a8 |
+ 'data': {
|
|
|
9ae3a8 |
+ 'formats': ['DumpGuestMemoryFormat'] } }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+##
|
|
|
9ae3a8 |
+# @query-dump-guest-memory-capability:
|
|
|
9ae3a8 |
+#
|
|
|
9ae3a8 |
+# Returns the available formats for dump-guest-memory
|
|
|
9ae3a8 |
+#
|
|
|
9ae3a8 |
+# Returns: A @DumpGuestMemoryCapability object listing available formats for
|
|
|
9ae3a8 |
+# dump-guest-memory
|
|
|
9ae3a8 |
+#
|
|
|
9ae3a8 |
+# Since: 2.0
|
|
|
9ae3a8 |
+##
|
|
|
9ae3a8 |
+{ 'command': 'query-dump-guest-memory-capability',
|
|
|
9ae3a8 |
+ 'returns': 'DumpGuestMemoryCapability' }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+##
|
|
|
9ae3a8 |
# @netdev_add:
|
|
|
9ae3a8 |
#
|
|
|
9ae3a8 |
# Add a network backend.
|
|
|
9ae3a8 |
diff --git a/qmp-commands.hx b/qmp-commands.hx
|
|
|
9ae3a8 |
index 61aa3bf..9c11213 100644
|
|
|
9ae3a8 |
--- a/qmp-commands.hx
|
|
|
9ae3a8 |
+++ b/qmp-commands.hx
|
|
|
9ae3a8 |
@@ -923,6 +923,26 @@ Notes:
|
|
|
9ae3a8 |
EQMP
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
+ .name = "query-dump-guest-memory-capability",
|
|
|
9ae3a8 |
+ .args_type = "",
|
|
|
9ae3a8 |
+ .mhandler.cmd_new = qmp_marshal_input_query_dump_guest_memory_capability,
|
|
|
9ae3a8 |
+ },
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+SQMP
|
|
|
9ae3a8 |
+query-dump-guest-memory-capability
|
|
|
9ae3a8 |
+----------
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+Show available formats for 'dump-guest-memory'
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+Example:
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+-> { "execute": "query-dump-guest-memory-capability" }
|
|
|
9ae3a8 |
+<- { "return": { "formats":
|
|
|
9ae3a8 |
+ ["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+EQMP
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ {
|
|
|
9ae3a8 |
.name = "netdev_add",
|
|
|
9ae3a8 |
.args_type = "netdev:O",
|
|
|
9ae3a8 |
.mhandler.cmd_new = qmp_netdev_add,
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|