Skip to contentSkip to conversation

QMP: Introduce RESUME event

PATCH Applied Luiz Capitulino 2 participants 2 messages Apr 28, 2010 – May 3, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 QMP: Introduce RESUME event

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.

---
 QMP/qmp-events.txt |   12 ++++++++++++
 monitor.c          |    3 +++
 monitor.h          |    1 +
 vl.c               |    1 +
 4 files changed, 17 insertions(+), 0 deletions(-)
QMP/qmp-events.txt +12 -0
index c084a47..01ec85f 100644
@@ -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
 ----------
 
monitor.c +3 -0
index 754bcc5..bb87479 100644
@@ -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;
monitor.h +1 -0
index 5bdeed1..ea15469 100644
@@ -21,6 +21,7 @@ typedef enum MonitorEvent {
     QEVENT_RESET,
     QEVENT_POWERDOWN,
     QEVENT_STOP,
+    QEVENT_RESUME,
     QEVENT_VNC_CONNECTED,
     QEVENT_VNC_INITIALIZED,
     QEVENT_VNC_DISCONNECTED,
vl.c +1 -0
index a485c58..6dfbf07 100644
@@ -1679,6 +1679,7 @@ void vm_start(void)
         vm_running = 1;
         vm_state_notify(1, 0);
         resume_all_vcpus();
+        monitor_protocol_event(QEVENT_RESUME, NULL);
     }
 }
 
Signature · 1 line
1.7.1.rc1.12.ga6018
#1 lore raw
Quoted 10 lines · Luiz Capitulino

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.

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 69 lines
---
  QMP/qmp-events.txt |   12 ++++++++++++
  monitor.c          |    3 +++
  monitor.h          |    1 +
  vl.c               |    1 +
  4 files changed, 17 insertions(+), 0 deletions(-)
QMP/qmp-events.txt +12 -0
index c084a47..01ec85f 100644
@@ -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
  ----------
 
monitor.c +3 -0
index 754bcc5..bb87479 100644
@@ -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;
monitor.h +1 -0
index 5bdeed1..ea15469 100644
@@ -21,6 +21,7 @@ typedef enum MonitorEvent {
      QEVENT_RESET,
      QEVENT_POWERDOWN,
      QEVENT_STOP,
+    QEVENT_RESUME,
      QEVENT_VNC_CONNECTED,
      QEVENT_VNC_INITIALIZED,
      QEVENT_VNC_DISCONNECTED,
vl.c +1 -0
index a485c58..6dfbf07 100644
@@ -1679,6 +1679,7 @@ void vm_start(void)
          vm_running = 1;
          vm_state_notify(1, 0);
          resume_all_vcpus();
+        monitor_protocol_event(QEVENT_RESUME, NULL);
      }
  }