[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 04/19] dump-guest-memory: add "detach" flag for QMP/H
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 04/19] dump-guest-memory: add "detach" flag for QMP/HMP interfaces. |
Date: |
Wed, 24 Feb 2016 14:27:26 +0100 |
From: Peter Xu <address@hidden>
This patch only adds the interfaces, but does not implement them.
"detach" parameter is made optional, to make sure that all the old
dump-guest-memory requests will still be able to work.
Signed-off-by: Peter Xu <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
dump.c | 5 +++--
hmp-commands.hx | 5 +++--
hmp.c | 9 +++++++--
qapi-schema.json | 8 ++++++--
qmp-commands.hx | 6 ++++--
5 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/dump.c b/dump.c
index 769c5f9..c4a62d9 100644
--- a/dump.c
+++ b/dump.c
@@ -1609,8 +1609,9 @@ cleanup:
dump_cleanup(s);
}
-void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,
- int64_t begin, bool has_length,
+void qmp_dump_guest_memory(bool paging, const char *file,
+ bool has_detach, bool detach,
+ bool has_begin, int64_t begin, bool has_length,
int64_t length, bool has_format,
DumpGuestMemoryFormat format, Error **errp)
{
diff --git a/hmp-commands.hx b/hmp-commands.hx
index bb52e4d..664d794 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1056,10 +1056,11 @@ ETEXI
{
.name = "dump-guest-memory",
- .args_type =
"paging:-p,zlib:-z,lzo:-l,snappy:-s,filename:F,begin:i?,length:i?",
- .params = "[-p] [-z|-l|-s] filename [begin length]",
+ .args_type =
"paging:-p,detach:-d,zlib:-z,lzo:-l,snappy:-s,filename:F,begin:i?,length:i?",
+ .params = "[-p] [-d] [-z|-l|-s] filename [begin length]",
.help = "dump guest memory into file 'filename'.\n\t\t\t"
"-p: do paging to get guest's memory mapping.\n\t\t\t"
+ "-d: return immediately (do not wait for
completion).\n\t\t\t"
"-z: dump in kdump-compressed format, with zlib
compression.\n\t\t\t"
"-l: dump in kdump-compressed format, with lzo
compression.\n\t\t\t"
"-s: dump in kdump-compressed format, with snappy
compression.\n\t\t\t"
diff --git a/hmp.c b/hmp.c
index 996cb91..7f65b32 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1587,8 +1587,10 @@ void hmp_dump_guest_memory(Monitor *mon, const QDict
*qdict)
const char *file = qdict_get_str(qdict, "filename");
bool has_begin = qdict_haskey(qdict, "begin");
bool has_length = qdict_haskey(qdict, "length");
+ bool has_detach = qdict_haskey(qdict, "detach");
int64_t begin = 0;
int64_t length = 0;
+ bool detach = false;
enum DumpGuestMemoryFormat dump_format = DUMP_GUEST_MEMORY_FORMAT_ELF;
char *prot;
@@ -1616,11 +1618,14 @@ void hmp_dump_guest_memory(Monitor *mon, const QDict
*qdict)
if (has_length) {
length = qdict_get_int(qdict, "length");
}
+ if (has_detach) {
+ detach = qdict_get_bool(qdict, "detach");
+ }
prot = g_strconcat("file:", file, NULL);
- qmp_dump_guest_memory(paging, prot, has_begin, begin, has_length, length,
- true, dump_format, &err);
+ qmp_dump_guest_memory(paging, prot, true, detach, has_begin, begin,
+ has_length, length, true, dump_format, &err);
hmp_handle_error(mon, &err);
g_free(prot);
}
diff --git a/qapi-schema.json b/qapi-schema.json
index 8d04897..caff580 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -2195,6 +2195,9 @@
# 2. fd: the protocol starts with "fd:", and the following string
# is the fd's name.
#
+# @detach: #optional if true, QMP will return immediately rather than
+# waiting for the dump to finish. (since 2.6).
+#
# @begin: #optional if specified, the starting physical address.
#
# @length: #optional if specified, the memory size, in bytes. If you don't
@@ -2211,8 +2214,9 @@
# Since: 1.2
##
{ 'command': 'dump-guest-memory',
- 'data': { 'paging': 'bool', 'protocol': 'str', '*begin': 'int',
- '*length': 'int', '*format': 'DumpGuestMemoryFormat' } }
+ 'data': { 'paging': 'bool', 'protocol': 'str', '*detach': 'bool',
+ '*begin': 'int', '*length': 'int',
+ '*format': 'DumpGuestMemoryFormat'} }
##
# @DumpGuestMemoryCapability:
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 9fb0d78..d30b1eb 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -838,8 +838,8 @@ EQMP
{
.name = "dump-guest-memory",
- .args_type = "paging:b,protocol:s,begin:i?,end:i?,format:s?",
- .params = "-p protocol [begin] [length] [format]",
+ .args_type =
"paging:b,protocol:s,detach:b?,begin:i?,end:i?,format:s?",
+ .params = "-p protocol [-d] [begin] [length] [format]",
.help = "dump guest memory to file",
.mhandler.cmd_new = qmp_marshal_dump_guest_memory,
},
@@ -855,6 +855,8 @@ Arguments:
- "paging": do paging to get guest's memory mapping (json-bool)
- "protocol": destination file(started with "file:") or destination file
descriptor (started with "fd:") (json-string)
+- "detach": if specified, command will return immediately, without waiting
+ for the dump to finish (json-bool)
- "begin": the starting physical address. It's optional, and should be
specified
with length together (json-int)
- "length": the memory size, in bytes. It's optional, and should be specified
--
2.5.0
- [Qemu-devel] [PULL 00/19] Misc changes for 2016-02-24, Paolo Bonzini, 2016/02/24
- [Qemu-devel] [PULL 01/19] qemu-options.hx: Improve documentation of chardev multiplexing mode, Paolo Bonzini, 2016/02/24
- [Qemu-devel] [PULL 02/19] scripts/kvm/kvm_stat: Fix missing right parantheses and ".format(...)", Paolo Bonzini, 2016/02/24
- [Qemu-devel] [PULL 04/19] dump-guest-memory: add "detach" flag for QMP/HMP interfaces.,
Paolo Bonzini <=
- [Qemu-devel] [PULL 05/19] dump-guest-memory: using static DumpState, add DumpStatus, Paolo Bonzini, 2016/02/24
- [Qemu-devel] [PULL 03/19] dump-guest-memory: cleanup: removing dump_{error|cleanup}()., Paolo Bonzini, 2016/02/24
- [Qemu-devel] [PULL 08/19] dump-guest-memory: disable dump when in INMIGRATE state, Paolo Bonzini, 2016/02/24
- [Qemu-devel] [PULL 09/19] dump-guest-memory: add "detach" support, Paolo Bonzini, 2016/02/24
- [Qemu-devel] [PULL 07/19] dump-guest-memory: introduce dump_process() helper function., Paolo Bonzini, 2016/02/24
- [Qemu-devel] [PULL 06/19] dump-guest-memory: add dump_in_progress() helper function, Paolo Bonzini, 2016/02/24
- [Qemu-devel] [PULL 10/19] DumpState: adding total_size and written_size fields, Paolo Bonzini, 2016/02/24
- [Qemu-devel] [PULL 12/19] Dump: add hmp command "info dump", Paolo Bonzini, 2016/02/24
- [Qemu-devel] [PULL 11/19] Dump: add qmp command "query-dump", Paolo Bonzini, 2016/02/24
- [Qemu-devel] [PULL 14/19] log: Redirect stderr to logfile if deamonized, Paolo Bonzini, 2016/02/24