summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2009-11-26 22:59:04 -0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-12-03 09:41:24 -0600
commitb1a15e7eaafba8f26e2263b1a9b6e6d40e585e72 (patch)
treefea507ef8ad2dfe16ade7f1d6fa9a0fb0c76b225
parent0d1ea871b09fc74b4a2085150980b43bd1973744 (diff)
downloadqemu-b1a15e7eaafba8f26e2263b1a9b6e6d40e585e72.tar.gz
QMP: Introduce basic asynchronous events
Debug, shutdown, reset, powerdown and stop are all basic events, as they are very simple they can be added in the same commit. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--monitor.c15
-rw-r--r--monitor.h5
-rw-r--r--vl.c11
3 files changed, 29 insertions, 2 deletions
diff --git a/monitor.c b/monitor.c
index 68b63cacc3..cd2f19c19a 100644
--- a/monitor.c
+++ b/monitor.c
@@ -342,6 +342,21 @@ void monitor_protocol_event(MonitorEvent event, QObject *data)
return;
switch (event) {
+ case EVENT_DEBUG:
+ event_name = "DEBUG";
+ break;
+ case EVENT_SHUTDOWN:
+ event_name = "SHUTDOWN";
+ break;
+ case EVENT_RESET:
+ event_name = "RESET";
+ break;
+ case EVENT_POWERDOWN:
+ event_name = "POWERDOWN";
+ break;
+ case EVENT_STOP:
+ event_name = "STOP";
+ break;
default:
abort();
break;
diff --git a/monitor.h b/monitor.h
index a1d8b7a5f0..851fd33666 100644
--- a/monitor.h
+++ b/monitor.h
@@ -15,6 +15,11 @@ extern Monitor *cur_mon;
/* QMP events */
typedef enum MonitorEvent {
+ EVENT_DEBUG,
+ EVENT_SHUTDOWN,
+ EVENT_RESET,
+ EVENT_POWERDOWN,
+ EVENT_STOP,
EVENT_MAX,
} MonitorEvent;
diff --git a/vl.c b/vl.c
index 2e0fb3966e..e6fcccf203 100644
--- a/vl.c
+++ b/vl.c
@@ -4060,9 +4060,12 @@ static void main_loop(void)
#endif
} while (vm_can_run());
- if (qemu_debug_requested())
+ if (qemu_debug_requested()) {
+ monitor_protocol_event(EVENT_DEBUG, NULL);
vm_stop(EXCP_DEBUG);
+ }
if (qemu_shutdown_requested()) {
+ monitor_protocol_event(EVENT_SHUTDOWN, NULL);
if (no_shutdown) {
vm_stop(0);
no_shutdown = 0;
@@ -4070,15 +4073,19 @@ static void main_loop(void)
break;
}
if (qemu_reset_requested()) {
+ monitor_protocol_event(EVENT_RESET, NULL);
pause_all_vcpus();
qemu_system_reset();
resume_all_vcpus();
}
if (qemu_powerdown_requested()) {
+ monitor_protocol_event(EVENT_POWERDOWN, NULL);
qemu_irq_raise(qemu_system_powerdown);
}
- if ((r = qemu_vmstop_requested()))
+ if ((r = qemu_vmstop_requested())) {
+ monitor_protocol_event(EVENT_STOP, NULL);
vm_stop(r);
+ }
}
pause_all_vcpus();
}