aboutsummaryrefslogtreecommitdiff
path: root/hmp.c
diff options
context:
space:
mode:
authorEmilio G. Cota <cota@braap.org>2018-08-15 16:00:03 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2018-08-23 18:46:25 +0200
commitdd12e1bbf2a41b0f6ce450a5449e536df0909520 (patch)
tree70fabbab238a02b4848b5ea4d050b5f6fc01b9bc /hmp.c
parent12df189de139dd79b63d055b531e2d88195bfee6 (diff)
hmp-commands: add sync-profile
The command introduced here is just for developers. This means that: - the interface implemented here could change in the future - the command is only meant to be used from HMP, not from QMP Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hmp.c')
-rw-r--r--hmp.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/hmp.c b/hmp.c
index 2aafb50e8e..d94a47f7c7 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1062,6 +1062,30 @@ void hmp_stop(Monitor *mon, const QDict *qdict)
qmp_stop(NULL);
}
+void hmp_sync_profile(Monitor *mon, const QDict *qdict)
+{
+ const char *op = qdict_get_try_str(qdict, "op");
+
+ if (op == NULL) {
+ bool on = qsp_is_enabled();
+
+ monitor_printf(mon, "sync-profile is %s\n", on ? "on" : "off");
+ return;
+ }
+ if (!strcmp(op, "on")) {
+ qsp_enable();
+ } else if (!strcmp(op, "off")) {
+ qsp_disable();
+ } else if (!strcmp(op, "reset")) {
+ qsp_reset();
+ } else {
+ Error *err = NULL;
+
+ error_setg(&err, QERR_INVALID_PARAMETER, op);
+ hmp_handle_error(mon, &err);
+ }
+}
+
void hmp_system_reset(Monitor *mon, const QDict *qdict)
{
qmp_system_reset(NULL);