From 39dff6e3fbc221ec248166a408b5a38beadd2fca Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Wed, 7 Mar 2012 08:00:23 +0100 Subject: [PATCH 09/12] suspend: add qmp events RH-Author: Gerd Hoffmann Message-id: <1331107226-21901-10-git-send-email-kraxel@redhat.com> Patchwork-id: 38353 O-Subject: [RHEL-6.3 qemu-kvm PATCH v3 09/12] suspend: add qmp events Bugzilla: 766303 RH-Acked-by: Paolo Bonzini RH-Acked-by: Gleb Natapov RH-Acked-by: Alex Williamson Send qmp events on suspend and wakeup so libvirt has a chance to track the vm state. Signed-off-by: Gerd Hoffmann upstream: 53370b78ecfe3fdff89a8dd7db73a0a95aefc14f --- monitor.c | 6 ++++++ monitor.h | 2 ++ vl.c | 2 ++ 3 files changed, 10 insertions(+), 0 deletions(-) Signed-off-by: Michal Novotny --- monitor.c | 6 ++++++ monitor.h | 2 ++ vl.c | 2 ++ 3 files changed, 10 insertions(+), 0 deletions(-) diff --git a/monitor.c b/monitor.c index 4961f17..0a5b772 100644 --- a/monitor.c +++ b/monitor.c @@ -477,6 +477,12 @@ void monitor_protocol_event(MonitorEvent event, QObject *data) case QEVENT_BLOCK_JOB_COMPLETED: event_name = "BLOCK_JOB_COMPLETED"; break; + case QEVENT_SUSPEND: + event_name = "SUSPEND"; + break; + case QEVENT_WAKEUP: + event_name = "WAKEUP"; + break; default: abort(); break; diff --git a/monitor.h b/monitor.h index 8598a4a..36846ba 100644 --- a/monitor.h +++ b/monitor.h @@ -38,6 +38,8 @@ typedef enum MonitorEvent { QEVENT_RH_SPICE_INITIALIZED, QEVENT_RH_SPICE_DISCONNECTED, QEVENT_BLOCK_JOB_COMPLETED, + QEVENT_SUSPEND, + QEVENT_WAKEUP, QEVENT_MAX, } MonitorEvent; diff --git a/vl.c b/vl.c index 51cff6e..e2fa13d 100644 --- a/vl.c +++ b/vl.c @@ -3418,6 +3418,7 @@ void qemu_system_suspend(void) { pause_all_vcpus(); notifier_list_notify(&suspend_notifiers, NULL); + monitor_protocol_event(QEVENT_SUSPEND, NULL); is_suspended = true; } @@ -3447,6 +3448,7 @@ void qemu_system_wakeup_request(WakeupReason reason) if (!(wakeup_reason_mask & (1 << reason))) { return; } + monitor_protocol_event(QEVENT_WAKEUP, NULL); notifier_list_notify(&wakeup_notifiers, &reason); reset_requested = 1; qemu_notify_event(); -- 1.7.7.6