c753e8e725
The current default action of pausing a guest after a panic event is received leaves the responsibility to resume guest execution to the management layer. The reasons for this behavior are discussed here: https://lore.kernel.org/qemu-devel/52148F88.5000509@redhat.com/ However, in instances like the case of older guests (Linux and Windows) using a pvpanic device but missing support for the PVPANIC_CRASHLOADED event, and Windows guests using the hv-crash enlightenment, it is desirable to allow the guests to continue running after sending a PVPANIC_PANICKED event. This allows such guests to proceed to capture a crash dump and automatically reboot without intervention of a management layer. Add an option to avoid stopping a VM after a panic event is received, by passing: -action panic=none in the command line arguments, or during runtime by using an upcoming QMP command. Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com> Message-Id: <1607705564-26264-3-git-send-email-alejandro.j.jimenez@oracle.com> [Do not fix panic action in the variable, instead modify -no-shutdown. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
47 lines
1.2 KiB
C
47 lines
1.2 KiB
C
/*
|
|
* Copyright (c) 2020 Oracle and/or its affiliates.
|
|
*
|
|
* This work is licensed under the terms of the GNU GPL, version 2.
|
|
* See the COPYING file in the top-level directory.
|
|
*
|
|
*/
|
|
|
|
#include "qemu/osdep.h"
|
|
#include "sysemu/runstate-action.h"
|
|
#include "sysemu/watchdog.h"
|
|
#include "qemu/config-file.h"
|
|
#include "qapi/error.h"
|
|
#include "qemu/option_int.h"
|
|
|
|
RebootAction reboot_action = REBOOT_ACTION_NONE;
|
|
ShutdownAction shutdown_action = SHUTDOWN_ACTION_POWEROFF;
|
|
PanicAction panic_action = PANIC_ACTION_POWEROFF;
|
|
|
|
/*
|
|
* Receives actions to be applied for specific guest events
|
|
* and sets the internal state as requested.
|
|
*/
|
|
void qmp_set_action(bool has_reboot, RebootAction reboot,
|
|
bool has_shutdown, ShutdownAction shutdown,
|
|
bool has_panic, PanicAction panic,
|
|
bool has_watchdog, WatchdogAction watchdog,
|
|
Error **errp)
|
|
{
|
|
if (has_reboot) {
|
|
reboot_action = reboot;
|
|
}
|
|
|
|
if (has_panic) {
|
|
panic_action = panic;
|
|
}
|
|
|
|
if (has_watchdog) {
|
|
qmp_watchdog_set_action(watchdog, errp);
|
|
}
|
|
|
|
/* Process shutdown last, in case the panic action needs to be altered */
|
|
if (has_shutdown) {
|
|
shutdown_action = shutdown;
|
|
}
|
|
}
|