From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MJ2tc-0001VR-IT for qemu-devel@nongnu.org; Tue, 23 Jun 2009 06:06:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MJ2tX-0001TH-H5 for qemu-devel@nongnu.org; Tue, 23 Jun 2009 06:06:31 -0400 Received: from [199.232.76.173] (port=51644 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MJ2tX-0001T7-8q for qemu-devel@nongnu.org; Tue, 23 Jun 2009 06:06:27 -0400 Received: from mx20.gnu.org ([199.232.41.8]:61315) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MJ2tW-0001TQ-OG for qemu-devel@nongnu.org; Tue, 23 Jun 2009 06:06:26 -0400 Received: from mx1.redhat.com ([66.187.233.31]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MJ2tV-0002G5-V9 for qemu-devel@nongnu.org; Tue, 23 Jun 2009 06:06:26 -0400 Date: Tue, 23 Jun 2009 11:06:22 +0100 From: "Daniel P. Berrange" Message-ID: <20090623100622.GE6881@redhat.com> References: <20090623012955.2d152759@doriath> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090623012955.2d152759@doriath> Subject: [Qemu-devel] Re: [PATCH 10/11] QMP: Introduce basic events Reply-To: "Daniel P. Berrange" List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: aliguori@us.ibm.com, ehabkost@redhat.com, jan.kiszka@siemens.com, dlaor@redhat.com, qemu-devel@nongnu.org, avi@redhat.com On Tue, Jun 23, 2009 at 01:29:55AM -0300, Luiz Capitulino wrote: > Reboot, shutdown and powerdown are very basic events and can be > added together. > > Signed-off-by: Luiz Capitulino > --- > monitor.c | 9 +++++++++ > monitor.h | 3 +++ > vl.c | 3 +++ > 3 files changed, 15 insertions(+), 0 deletions(-) > > diff --git a/monitor.c b/monitor.c > index 378a3ae..7ebf0ea 100644 > --- a/monitor.c > +++ b/monitor.c > @@ -276,6 +276,15 @@ void monitor_notify_event(MonitorEvent event) > monitor_puts(cur_mon, "* EVENT "); > > switch (event) { > + case EVENT_REBOOT: > + monitor_puts(cur_mon, "reboot"); > + break; > + case EVENT_SHUTDOWN: > + monitor_puts(cur_mon, "shutdown"); > + break; > + case EVENT_POWERDOWN: > + monitor_puts(cur_mon, "powerdown"); > + break; > case EVENT_MAX: > // Avoid gcc warning, will never get here > break; > diff --git a/monitor.h b/monitor.h > index 7cc88cc..579b80b 100644 > --- a/monitor.h > +++ b/monitor.h > @@ -14,6 +14,9 @@ extern Monitor *cur_mon; > > /* QMP events */ > typedef enum MonitorEvent { > + EVENT_REBOOT, > + EVENT_SHUTDOWN, > + EVENT_POWERDOWN, > EVENT_MAX, > } MonitorEvent; > > diff --git a/vl.c b/vl.c > index 60a00e1..7dc5954 100644 > --- a/vl.c > +++ b/vl.c > @@ -3693,18 +3693,21 @@ void qemu_system_reset_request(void) > reset_requested = 1; > } > qemu_notify_event(); > + monitor_notify_event(EVENT_REBOOT); > } > > void qemu_system_shutdown_request(void) > { > shutdown_requested = 1; > qemu_notify_event(); > + monitor_notify_event(EVENT_SHUTDOWN); > } > > void qemu_system_powerdown_request(void) > { > powerdown_requested = 1; > qemu_notify_event(); > + monitor_notify_event(EVENT_POWERDOWN); > } I could be mis-reading this code, but this implies that the mgmt app would get these events at the time the action is requested, but not neccessarily actually acted upon. Wouldn't you want to be receiving the events immediately after the action has been completed ? Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|