qmp: generalize watchdog-set-action to -no-reboot/-no-shutdown
[qemu/ar7.git] / softmmu / runstate-action.c
blob44de01adaff1e9b7456abf9b7b8c012b7875a7d8
1 /*
2 * Copyright (c) 2020 Oracle and/or its affiliates.
4 * This work is licensed under the terms of the GNU GPL, version 2.
5 * See the COPYING file in the top-level directory.
7 */
9 #include "qemu/osdep.h"
10 #include "sysemu/runstate-action.h"
11 #include "sysemu/watchdog.h"
12 #include "qemu/config-file.h"
13 #include "qapi/error.h"
14 #include "qemu/option_int.h"
16 RebootAction reboot_action = REBOOT_ACTION_NONE;
17 ShutdownAction shutdown_action = SHUTDOWN_ACTION_POWEROFF;
20 * Receives actions to be applied for specific guest events
21 * and sets the internal state as requested.
23 void qmp_set_action(bool has_reboot, RebootAction reboot,
24 bool has_shutdown, ShutdownAction shutdown,
25 bool has_panic, PanicAction panic,
26 bool has_watchdog, WatchdogAction watchdog,
27 Error **errp)
29 if (has_reboot) {
30 reboot_action = reboot;
33 if (has_watchdog) {
34 qmp_watchdog_set_action(watchdog, errp);
37 /* Process shutdown last, in case the panic action needs to be altered */
38 if (has_shutdown) {
39 shutdown_action = shutdown;