Module Libvirt.Event

module Event: sig .. end

Module dealing with events generated by domain state changes.


module Defined: sig .. end
module Undefined: sig .. end
module Started: sig .. end
module Suspended: sig .. end
module Resumed: sig .. end
module Stopped: sig .. end
module PM_suspended: sig .. end
module Lifecycle: sig .. end
module Reboot: sig .. end
module Rtc_change: sig .. end
module Watchdog: sig .. end
module Io_error: sig .. end
module Graphics_address: sig .. end
module Graphics_subject: sig .. end
module Graphics: sig .. end
module Control_error: sig .. end
module Block_job: sig .. end
module Disk_change: sig .. end
module Tray_change: sig .. end
module PM_wakeup: sig .. end
module PM_suspend: sig .. end
module Balloon_change: sig .. end
module PM_suspend_disk: sig .. end
module Device_removed: sig .. end
type callback = 
| Lifecycle of ([ `R ] Libvirt.Domain.t -> Lifecycle.t -> unit)
| Reboot of ([ `R ] Libvirt.Domain.t -> Reboot.t -> unit)
| RtcChange of ([ `R ] Libvirt.Domain.t -> Rtc_change.t -> unit)
| Watchdog of ([ `R ] Libvirt.Domain.t -> Watchdog.t -> unit)
| IOError of ([ `R ] Libvirt.Domain.t -> Io_error.t -> unit)
| Graphics of ([ `R ] Libvirt.Domain.t -> Graphics.t -> unit)
| IOErrorReason of ([ `R ] Libvirt.Domain.t -> Io_error.t -> unit)
| ControlError of ([ `R ] Libvirt.Domain.t -> Control_error.t -> unit)
| BlockJob of ([ `R ] Libvirt.Domain.t -> Block_job.t -> unit)
| DiskChange of ([ `R ] Libvirt.Domain.t -> Disk_change.t -> unit)
| TrayChange of ([ `R ] Libvirt.Domain.t -> Tray_change.t -> unit)
| PMWakeUp of ([ `R ] Libvirt.Domain.t -> PM_wakeup.t -> unit)
| PMSuspend of ([ `R ] Libvirt.Domain.t -> PM_suspend.t -> unit)
| BalloonChange of ([ `R ] Libvirt.Domain.t -> Balloon_change.t -> unit)
| PMSuspendDisk of ([ `R ] Libvirt.Domain.t -> PM_suspend_disk.t -> unit)
| DeviceRemoved of ([ `R ] Libvirt.Domain.t -> Device_removed.t -> unit)

type of a registered call back function

val register_default_impl : unit -> unit

Registers the default event loop based on poll(). This must be done before connections are opened.

Once registered call run_default_impl in a loop.

val run_default_impl : unit -> unit

Runs one iteration of the event loop. Applications will generally want to have a thread which invokes this in an infinite loop.

type callback_id 

an individual event registration

val register_any : 'a Libvirt.Connect.t ->
?dom:'a Libvirt.Domain.t ->
callback -> callback_id

register_any con ?dom callback registers callback to receive notification of arbitrary domain events. Return a registration id which can be used in deregister_any.

If ?dom is None then register for this kind of event on all domains. If dom is Some d then register for this kind of event only on d.

val deregister_any : 'a Libvirt.Connect.t -> callback_id -> unit

deregister_any con id deregisters the previously registered callback with id id.

type timer_id 

an individual timer event

val add_timeout : 'a Libvirt.Connect.t -> int -> (unit -> unit) -> timer_id

add_timeout con ms cb registers cb as a timeout callback which will be called every ms milliseconds

val remove_timeout : 'a Libvirt.Connect.t -> timer_id -> unit

remove_timeout con t deregisters timeout callback t.