let cfg = Config.of_file state.vm_uuid (fun errors -> ()) path in
state.vm_next_cfg <- Some cfg
+(* Monitor acpi state and notify when it changes from S3 to S0.
+ * Other cases are already signalled from qemu *)
+let monitor_acpi state =
+ let rec poll acpi_state =
+ let s' = match state.vm_lifestate with
+ | VmShutdown -> 5
+ | _ ->
+ with_xc (fun xc ->
+ let s' = Xc.domain_get_acpi_s_state xc state.vm_domid in
+ match (acpi_state,s') with
+ | (3,0) ->
+ Vmact.notify state Xenvmlib.code_vmtrigger [ "power-state"; "0" ];
+ s'
+ | _ -> s'
+ )
+ in
+ Thread.delay 1.;
+ poll s'
+ in
+ if state.vm_cfg.hvm then (
+ poll 0
+ )
+
let monitor_vm state =
let xs = Xs.daemon_open () in
let callback_introduce ctx id =
| _ -> ()
)
in
-
while true
do
try Xal.loop ~callback_introduce ~callback_release ~callback_devices
*)
let monitor socket state =
thread_create monitor_vm state;
+ thread_create monitor_acpi state;
if state.vm_monitors.monitor_use_json then
thread_create (monitor_rpc_json socket) state;
if state.vm_monitors.monitor_use_dbus then