提交 ca1fc8c9 编写于 作者: P Peter Xu 提交者: Paolo Bonzini

dump-guest-memory: introduce dump_process() helper function.

No functional change. Cleanup only.
Signed-off-by: NPeter Xu <peterx@redhat.com>
Reviewed-by: NFam Zheng <famz@redhat.com>
Message-Id: <1455772616-8668-6-git-send-email-peterx@redhat.com>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 65d64f36
......@@ -1465,6 +1465,9 @@ static void dump_init(DumpState *s, int fd, bool has_format,
Error *err = NULL;
int ret;
s->has_format = has_format;
s->format = format;
/* kdump-compressed is conflict with paging and filter */
if (has_format && format != DUMP_GUEST_MEMORY_FORMAT_ELF) {
assert(!paging && !has_filter);
......@@ -1623,6 +1626,23 @@ cleanup:
dump_cleanup(s);
}
/* this operation might be time consuming. */
static void dump_process(DumpState *s, Error **errp)
{
Error *local_err = NULL;
if (s->has_format && s->format != DUMP_GUEST_MEMORY_FORMAT_ELF) {
create_kdump_vmcore(s, &local_err);
} else {
create_vmcore(s, &local_err);
}
s->status = (local_err ? DUMP_STATUS_FAILED : DUMP_STATUS_COMPLETED);
error_propagate(errp, local_err);
dump_cleanup(s);
}
void qmp_dump_guest_memory(bool paging, const char *file,
bool has_detach, bool detach,
bool has_begin, int64_t begin, bool has_length,
......@@ -1708,16 +1728,7 @@ void qmp_dump_guest_memory(bool paging, const char *file,
return;
}
if (has_format && format != DUMP_GUEST_MEMORY_FORMAT_ELF) {
create_kdump_vmcore(s, &local_err);
} else {
create_vmcore(s, &local_err);
}
s->status = (local_err ? DUMP_STATUS_FAILED : DUMP_STATUS_COMPLETED);
error_propagate(errp, local_err);
dump_cleanup(s);
dump_process(s, errp);
}
DumpGuestMemoryCapability *qmp_query_dump_guest_memory_capability(Error **errp)
......
......@@ -178,6 +178,9 @@ typedef struct DumpState {
size_t num_dumpable; /* number of page that can be dumped */
uint32_t flag_compress; /* indicate the compression format */
DumpStatus status; /* current dump status */
bool has_format; /* whether format is provided */
DumpGuestMemoryFormat format; /* valid only if has_format == true */
} DumpState;
uint16_t cpu_to_dump16(DumpState *s, uint16_t val);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册