qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [PATCH 10/11] QMP: Introduce basic events


From: Daniel P. Berrange
Subject: [Qemu-devel] Re: [PATCH 10/11] QMP: Introduce basic events
Date: Tue, 23 Jun 2009 11:06:22 +0100
User-agent: Mutt/1.4.1i

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 <address@hidden>
> ---
>  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 :|




reply via email to

[Prev in Thread] Current Thread [Next in Thread]