[libvirt] [PATCH 10/13] Add support for an explicit RTC change event

Daniel Veillard veillard at redhat.com
Mon Mar 22 16:17:42 UTC 2010


On Fri, Mar 19, 2010 at 03:38:58PM +0000, Daniel P. Berrange wrote:
> This introduces a new event type
> 
>    VIR_DOMAIN_EVENT_ID_RTC_CHANGE
> 
> This event includes the new UTC offset measured in seconds.
> Thus there is a new callback definition for this event type
> 
>  typedef void (*virConnectDomainEventRTCChangeCallback)(virConnectPtr conn,
>                                                         virDomainPtr dom,
>                                                         long long utcoffset,
>                                                         void *opaque);
> 
> If the guest XML configuration for the <clock> is set to
> offset='variable', then the XML will automatically be
> updated with the new UTC offset value. This ensures that
> during migration/save/restore the new offset is preserved.
> 
> * daemon/remote.c: Dispatch RTC change events to client
> * examples/domain-events/events-c/event-test.c: Watch for
>   RTC change events
> * include/libvirt/libvirt.h.in: Define new RTC change event ID
>   and callback signature
> * src/conf/domain_event.c, src/conf/domain_event.h,
>   src/libvirt_private.syms: Extend API to handle RTC change events
> * src/qemu/qemu_driver.c: Connect to the QEMU monitor event
>   for RTC changes and emit a libvirt RTC change event
> * src/remote/remote_driver.c: Receive and dispatch RTC change
>   events to application
> * src/remote/remote_protocol.x: Wire protocol definition for
>   RTC change events
> * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
>   src/qemu/qemu_monitor_json.c: Watch for RTC_CHANGE event
>   from QEMU monitor

  Okay, in taht case we need to add a new event handler,

[...]
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -1842,6 +1842,10 @@ int virDomainAbortJob(virDomainPtr dom);
>  typedef void (*virConnectDomainEventGenericCallback)(virConnectPtr conn,
>                                                       virDomainPtr dom,
>                                                       void *opaque);

> +typedef void (*virConnectDomainEventRTCChangeCallback)(virConnectPtr conn,
> +                                                       virDomainPtr dom,
> +                                                       long long utcoffset,
> +                                                       void *opaque);

  I think the time unit of the offset should be documented there, and
maybe a bit of explanation people may get confused and expect the offset
to be relative to the previous offset instead of absolute

[...]
> --- a/src/qemu/qemu_monitor_json.c
> +++ b/src/qemu/qemu_monitor_json.c
> @@ -49,6 +49,7 @@ static void qemuMonitorJSONHandleShutdown(qemuMonitorPtr mon, virJSONValuePtr da
>  static void qemuMonitorJSONHandleReset(qemuMonitorPtr mon, virJSONValuePtr data);
>  static void qemuMonitorJSONHandlePowerdown(qemuMonitorPtr mon, virJSONValuePtr data);
>  static void qemuMonitorJSONHandleStop(qemuMonitorPtr mon, virJSONValuePtr data);
> +static void qemuMonitorJSONHandleRTCChange(qemuMonitorPtr mon, virJSONValuePtr data);
>  
>  struct {
>      const char *type;
> @@ -58,6 +59,7 @@ struct {
>      { "RESET", qemuMonitorJSONHandleReset, },
>      { "POWERDOWN", qemuMonitorJSONHandlePowerdown, },
>      { "STOP", qemuMonitorJSONHandleStop, },
> +    { "RTC_CHANGE", qemuMonitorJSONHandleRTCChange, },
>  };

  The new event lookup registration, okay


  ACK,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list