and memory = ref (-1)
in
- let set_action ref_var s =
+ let action_of_string s =
match s with
- | "restart" -> ref_var := ActionRestart
- | "destroy" -> ref_var := ActionDestroy
- | "preserve" -> ref_var := ActionPreserve
+ | "restart" -> ActionRestart
+ | "destroy" -> ActionDestroy
+ | "preserve" -> ActionPreserve
| _ -> failwith "unknown action state"
in
let set_startup s =
| "disk" | "vif" | "nic" | "pci" | "cpuid" | "cpus-affinity"
| "extra-hvm" | "extra-local-watch" | "extra-vm-watch" ->
cfg := list_add !cfg k v
+ | "on_halt" -> cfg := { !cfg with on_halt = action_of_string v }
+ | "on_restart" -> cfg := { !cfg with on_restart = action_of_string v }
+ | "on_crash" -> cfg := { !cfg with on_crash = action_of_string v }
| _ ->
cfg := set !cfg k v
in
| Xal.Vanished -> ActionPreserve
| Xal.Halted -> state.vm_cfg.on_halt
| Xal.Rebooted ->
+ Vmact.stop_vm xc xs state;
Vmact.change_vmstate state VmRebooted;
state.vm_cfg.on_restart
| Xal.Suspended -> state.vm_on_suspend_action