suspend: add qmp events
Send qmp events on suspend and wakeup so libvirt has a chance to track the vm state. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
6595abc044
commit
53370b78ec
@ -488,6 +488,12 @@ void monitor_protocol_event(MonitorEvent event, QObject *data)
|
|||||||
case QEVENT_DEVICE_TRAY_MOVED:
|
case QEVENT_DEVICE_TRAY_MOVED:
|
||||||
event_name = "DEVICE_TRAY_MOVED";
|
event_name = "DEVICE_TRAY_MOVED";
|
||||||
break;
|
break;
|
||||||
|
case QEVENT_SUSPEND:
|
||||||
|
event_name = "SUSPEND";
|
||||||
|
break;
|
||||||
|
case QEVENT_WAKEUP:
|
||||||
|
event_name = "WAKEUP";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
abort();
|
abort();
|
||||||
break;
|
break;
|
||||||
|
@ -39,6 +39,8 @@ typedef enum MonitorEvent {
|
|||||||
QEVENT_BLOCK_JOB_COMPLETED,
|
QEVENT_BLOCK_JOB_COMPLETED,
|
||||||
QEVENT_BLOCK_JOB_CANCELLED,
|
QEVENT_BLOCK_JOB_CANCELLED,
|
||||||
QEVENT_DEVICE_TRAY_MOVED,
|
QEVENT_DEVICE_TRAY_MOVED,
|
||||||
|
QEVENT_SUSPEND,
|
||||||
|
QEVENT_WAKEUP,
|
||||||
QEVENT_MAX,
|
QEVENT_MAX,
|
||||||
} MonitorEvent;
|
} MonitorEvent;
|
||||||
|
|
||||||
|
2
vl.c
2
vl.c
@ -1416,6 +1416,7 @@ static void qemu_system_suspend(void)
|
|||||||
{
|
{
|
||||||
pause_all_vcpus();
|
pause_all_vcpus();
|
||||||
notifier_list_notify(&suspend_notifiers, NULL);
|
notifier_list_notify(&suspend_notifiers, NULL);
|
||||||
|
monitor_protocol_event(QEVENT_SUSPEND, NULL);
|
||||||
is_suspended = true;
|
is_suspended = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1442,6 +1443,7 @@ void qemu_system_wakeup_request(WakeupReason reason)
|
|||||||
if (!(wakeup_reason_mask & (1 << reason))) {
|
if (!(wakeup_reason_mask & (1 << reason))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
monitor_protocol_event(QEVENT_WAKEUP, NULL);
|
||||||
notifier_list_notify(&wakeup_notifiers, &reason);
|
notifier_list_notify(&wakeup_notifiers, &reason);
|
||||||
reset_requested = 1;
|
reset_requested = 1;
|
||||||
qemu_notify_event();
|
qemu_notify_event();
|
||||||
|
Loading…
Reference in New Issue
Block a user