QMP: Introduce RESUME event
authorLuiz Capitulino <lcapitulino@redhat.com>
Tue, 27 Apr 2010 23:35:59 +0000 (20:35 -0300)
committerAnthony Liguori <aliguori@us.ibm.com>
Mon, 3 May 2010 17:39:12 +0000 (12:39 -0500)
It's emitted when the Virtual Machine resumes execution.

We currently have the STOP event but don't have the matching
RESUME one, this means that clients are notified when the VM
is stopped but don't get anything when it resumes.

Let's fix that as it's already causing some trouble to libvirt.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
QMP/qmp-events.txt
monitor.c
monitor.h
vl.c

index c084a47309de23ca8adf0ee18f1e44c6ec771915..01ec85fbb92349cf0efd1052d171eef8efef14c4 100644 (file)
@@ -38,6 +38,18 @@ Example:
 { "event": "RESET",
     "timestamp": { "seconds": 1267041653, "microseconds": 9518 } }
 
+RESUME
+------
+
+Emitted when the Virtual Machine resumes execution.
+
+Data: None.
+
+Example:
+
+{ "event": "RESUME",
+    "timestamp": { "seconds": 1271770767, "microseconds": 582542 } }
+
 RTC_CHANGE
 ----------
 
index 754bcc5cc095ead1eeaf304a7f2c7bcadd04565e..bb87479f58aea0062356fcd680278396af6b0624 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -423,6 +423,9 @@ void monitor_protocol_event(MonitorEvent event, QObject *data)
         case QEVENT_STOP:
             event_name = "STOP";
             break;
+        case QEVENT_RESUME:
+            event_name = "RESUME";
+            break;
         case QEVENT_VNC_CONNECTED:
             event_name = "VNC_CONNECTED";
             break;
index 5bdeed101ac874b5b30e513e6af2450bbb2ffe3f..ea15469f25c30c253d44a46d982d0d5b2272ab54 100644 (file)
--- a/monitor.h
+++ b/monitor.h
@@ -21,6 +21,7 @@ typedef enum MonitorEvent {
     QEVENT_RESET,
     QEVENT_POWERDOWN,
     QEVENT_STOP,
+    QEVENT_RESUME,
     QEVENT_VNC_CONNECTED,
     QEVENT_VNC_INITIALIZED,
     QEVENT_VNC_DISCONNECTED,
diff --git a/vl.c b/vl.c
index 9caf96d39917f2ab6e339c0da4d0c4ce14be1e6d..999aac8cc549e6a4252e389a93f556fd2cfba5c7 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -1689,6 +1689,7 @@ void vm_start(void)
         vm_running = 1;
         vm_state_notify(1, 0);
         resume_all_vcpus();
+        monitor_protocol_event(QEVENT_RESUME, NULL);
     }
 }