diff mbox

[2/4] qmp: emit the WAKEUP event when the guest is put to run

Message ID 1344533300-6422-3-git-send-email-lcapitulino@redhat.com
State New
Headers show

Commit Message

Luiz Capitulino Aug. 9, 2012, 5:28 p.m. UTC
Today, the WAKEUP event is emitted when a wakeup _request_ is made.
This could be the system_wakeup command, for example.

A better semantic would be to emit the event when the guest is
already running, as that's what matters in the end. This commit does
that change.

In theory, this could break compatibility. In practice, it shouldn't
happen though, as clients shouldn't rely on timing characteristics of
the events. That is, a client relying that the guest is not running
when the event arrives may break if the event arrives after the guest
is already running.

This commit also adds the missing documentation for the WAKEUP event.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 QMP/qmp-events.txt | 13 +++++++++++++
 vl.c               |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

Comments

Eric Blake Aug. 9, 2012, 5:57 p.m. UTC | #1
On 08/09/2012 11:28 AM, Luiz Capitulino wrote:
> Today, the WAKEUP event is emitted when a wakeup _request_ is made.
> This could be the system_wakeup command, for example.
> 
> A better semantic would be to emit the event when the guest is
> already running, as that's what matters in the end. This commit does
> that change.
> 
> In theory, this could break compatibility. In practice, it shouldn't
> happen though, as clients shouldn't rely on timing characteristics of
> the events. That is, a client relying that the guest is not running
> when the event arrives may break if the event arrives after the guest
> is already running.

Yeah, no problem with that semantic change from libvirt.


> +WAKEUP
> +------
> +
> +Emitted when the guest has been waken up from S3 and is running.

grammar:

s/has been waken/has woken/

or maybe

s/has been waken up/has been awakened/
Luiz Capitulino Aug. 9, 2012, 8:40 p.m. UTC | #2
On Thu, 09 Aug 2012 11:57:38 -0600
Eric Blake <eblake@redhat.com> wrote:

> On 08/09/2012 11:28 AM, Luiz Capitulino wrote:
> > Today, the WAKEUP event is emitted when a wakeup _request_ is made.
> > This could be the system_wakeup command, for example.
> > 
> > A better semantic would be to emit the event when the guest is
> > already running, as that's what matters in the end. This commit does
> > that change.
> > 
> > In theory, this could break compatibility. In practice, it shouldn't
> > happen though, as clients shouldn't rely on timing characteristics of
> > the events. That is, a client relying that the guest is not running
> > when the event arrives may break if the event arrives after the guest
> > is already running.
> 
> Yeah, no problem with that semantic change from libvirt.
> 
> 
> > +WAKEUP
> > +------
> > +
> > +Emitted when the guest has been waken up from S3 and is running.
> 
> grammar:
> 
> s/has been waken/has woken/

Fixed in v2. If I don't respin I'll merge the fixed version in the
qmp branch (I won't respin just because of this).

> 
> or maybe
> 
> s/has been waken up/has been awakened/
>
diff mbox

Patch

diff --git a/QMP/qmp-events.txt b/QMP/qmp-events.txt
index 9ba7079..b8afedb 100644
--- a/QMP/qmp-events.txt
+++ b/QMP/qmp-events.txt
@@ -264,6 +264,19 @@  Example:
 }}
 
 
+WAKEUP
+------
+
+Emitted when the guest has been waken up from S3 and is running.
+
+Data: None.
+
+Example:
+
+{ "event": "WATCHDOG",
+     "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
+
+
 WATCHDOG
 --------
 
diff --git a/vl.c b/vl.c
index b642637..9d783b7 100644
--- a/vl.c
+++ b/vl.c
@@ -1460,7 +1460,6 @@  void qemu_system_wakeup_request(WakeupReason reason)
         return;
     }
     runstate_set(RUN_STATE_RUNNING);
-    monitor_protocol_event(QEVENT_WAKEUP, NULL);
     notifier_list_notify(&wakeup_notifiers, &reason);
     wakeup_requested = 1;
     qemu_notify_event();
@@ -1547,6 +1546,7 @@  static bool main_loop_should_exit(void)
         cpu_synchronize_all_states();
         qemu_system_reset(VMRESET_SILENT);
         resume_all_vcpus();
+        monitor_protocol_event(QEVENT_WAKEUP, NULL);
     }
     if (qemu_powerdown_requested()) {
         monitor_protocol_event(QEVENT_POWERDOWN, NULL);