]> xenbits.xen.org Git - xenclient/toolstack.git/commitdiff
XC-817 xenvm - make action after halt/reboot/crash customisable
authorTomasz Wroblewski <tomasz.wroblewski@citrix.com>
Thu, 10 Dec 2009 13:39:47 +0000 (13:39 +0000)
committerTomasz Wroblewski <tomasz.wroblewski@citrix.com>
Thu, 10 Dec 2009 13:39:47 +0000 (13:39 +0000)
xenvm/vmconfig.ml
xenvm/xenvm.ml

index af905e845eb402853b37fa59693c1aed70bb6f24..be96b4b2f49434c5077cba49bcbf9f1825b2eaaa 100644 (file)
@@ -658,11 +658,11 @@ let of_file uuid error_report file =
        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 =
@@ -687,6 +687,9 @@ let of_file uuid error_report file =
                | "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
index ff4fa4c0788930c5f7608fcfb4810c4bc93c7066..3a81378c41d6ff9988d7df54a355e3f1e6f7a90a 100644 (file)
@@ -271,6 +271,7 @@ let monitor_vm state =
                        | 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