dump-guest-memory: add dump_in_progress() helper function
For now, it has no effect. It will be used in dump detach support. Signed-off-by: Peter Xu <peterx@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Message-Id: <1455772616-8668-5-git-send-email-peterx@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
baf28f57e2
commit
65d64f3623
13
dump.c
13
dump.c
@ -1450,6 +1450,12 @@ static void dump_state_prepare(DumpState *s)
|
|||||||
*s = (DumpState) { .status = DUMP_STATUS_ACTIVE };
|
*s = (DumpState) { .status = DUMP_STATUS_ACTIVE };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool dump_in_progress(void)
|
||||||
|
{
|
||||||
|
DumpState *state = &dump_state_global;
|
||||||
|
return (state->status == DUMP_STATUS_ACTIVE);
|
||||||
|
}
|
||||||
|
|
||||||
static void dump_init(DumpState *s, int fd, bool has_format,
|
static void dump_init(DumpState *s, int fd, bool has_format,
|
||||||
DumpGuestMemoryFormat format, bool paging, bool has_filter,
|
DumpGuestMemoryFormat format, bool paging, bool has_filter,
|
||||||
int64_t begin, int64_t length, Error **errp)
|
int64_t begin, int64_t length, Error **errp)
|
||||||
@ -1628,6 +1634,13 @@ void qmp_dump_guest_memory(bool paging, const char *file,
|
|||||||
DumpState *s;
|
DumpState *s;
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
|
|
||||||
|
/* if there is a dump in background, we should wait until the dump
|
||||||
|
* finished */
|
||||||
|
if (dump_in_progress()) {
|
||||||
|
error_setg(errp, "There is a dump in process, please wait.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* kdump-compressed format need the whole memory dumped, so paging or
|
* kdump-compressed format need the whole memory dumped, so paging or
|
||||||
* filter is not supported here.
|
* filter is not supported here.
|
||||||
|
@ -494,4 +494,8 @@ int parse_debug_env(const char *name, int max, int initial);
|
|||||||
const char *qemu_ether_ntoa(const MACAddr *mac);
|
const char *qemu_ether_ntoa(const MACAddr *mac);
|
||||||
void page_size_init(void);
|
void page_size_init(void);
|
||||||
|
|
||||||
|
/* returns non-zero if dump is in progress, otherwise zero is
|
||||||
|
* returned. */
|
||||||
|
bool dump_in_progress(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
14
qmp.c
14
qmp.c
@ -103,6 +103,13 @@ void qmp_quit(Error **errp)
|
|||||||
|
|
||||||
void qmp_stop(Error **errp)
|
void qmp_stop(Error **errp)
|
||||||
{
|
{
|
||||||
|
/* if there is a dump in background, we should wait until the dump
|
||||||
|
* finished */
|
||||||
|
if (dump_in_progress()) {
|
||||||
|
error_setg(errp, "There is a dump in process, please wait.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (runstate_check(RUN_STATE_INMIGRATE)) {
|
if (runstate_check(RUN_STATE_INMIGRATE)) {
|
||||||
autostart = 0;
|
autostart = 0;
|
||||||
} else {
|
} else {
|
||||||
@ -175,6 +182,13 @@ void qmp_cont(Error **errp)
|
|||||||
BlockBackend *blk;
|
BlockBackend *blk;
|
||||||
BlockDriverState *bs;
|
BlockDriverState *bs;
|
||||||
|
|
||||||
|
/* if there is a dump in background, we should wait until the dump
|
||||||
|
* finished */
|
||||||
|
if (dump_in_progress()) {
|
||||||
|
error_setg(errp, "There is a dump in process, please wait.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (runstate_needs_reset()) {
|
if (runstate_needs_reset()) {
|
||||||
error_setg(errp, "Resetting the Virtual Machine is required");
|
error_setg(errp, "Resetting the Virtual Machine is required");
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user