summaryrefslogtreecommitdiffstats
path: root/monitor
diff options
context:
space:
mode:
authorPaolo Bonzini2021-10-27 15:03:04 +0200
committerPaolo Bonzini2021-11-02 15:57:27 +0100
commit22afb46e7c6ed61bd41c199072cb4769d6ab14b2 (patch)
treedcde55a5d193315ccc10a9207c7ad198a43bbde3 /monitor
parentvl: deprecate -watchdog (diff)
downloadqemu-22afb46e7c6ed61bd41c199072cb4769d6ab14b2.tar.gz
qemu-22afb46e7c6ed61bd41c199072cb4769d6ab14b2.tar.xz
qemu-22afb46e7c6ed61bd41c199072cb4769d6ab14b2.zip
watchdog: remove select_watchdog_action
Instead of invoking select_watchdog_action from both HMP and command line, go directly from HMP to QMP and use QemuOpts as the intermediary for the command line. This makes -watchdog-action explicitly a shortcut for "-action watchdog", so that "-watchdog-action" and "-action watchdog" override each other based on the position on the command line; previously, "-action watchdog" always won. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'monitor')
-rw-r--r--monitor/misc.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/monitor/misc.c b/monitor/misc.c
index c2d227a07c..1759d1e7f1 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -70,6 +70,7 @@
#include "qapi/qapi-commands-migration.h"
#include "qapi/qapi-commands-misc.h"
#include "qapi/qapi-commands-qom.h"
+#include "qapi/qapi-commands-run-state.h"
#include "qapi/qapi-commands-trace.h"
#include "qapi/qapi-init-commands.h"
#include "qapi/error.h"
@@ -471,10 +472,18 @@ static void hmp_gdbserver(Monitor *mon, const QDict *qdict)
static void hmp_watchdog_action(Monitor *mon, const QDict *qdict)
{
- const char *action = qdict_get_str(qdict, "action");
- if (select_watchdog_action(action) == -1) {
- monitor_printf(mon, "Unknown watchdog action '%s'\n", action);
+ Error *err = NULL;
+ WatchdogAction action;
+ char *qapi_value;
+
+ qapi_value = g_ascii_strdown(qdict_get_str(qdict, "action"), -1);
+ action = qapi_enum_parse(&WatchdogAction_lookup, qapi_value, -1, &err);
+ g_free(qapi_value);
+ if (err) {
+ hmp_handle_error(mon, err);
+ return;
}
+ qmp_watchdog_set_action(action, &error_abort);
}
static void monitor_printc(Monitor *mon, int c)