From 8e543388939a460330c95545b937bf83f4fdd664 Mon Sep 17 00:00:00 2001 From: Ravi Pandey Date: Fri, 28 Feb 2014 15:59:49 +0000 Subject: [PATCH] SCTX-1334: Ensure that hard_shutdown and hard_reboot cancels clean_shutdown and clean_reboot respectively. --- ocaml/xapi/message_forwarding.ml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ocaml/xapi/message_forwarding.ml b/ocaml/xapi/message_forwarding.ml index 1d7832661a..9589c6c4c1 100644 --- a/ocaml/xapi/message_forwarding.ml +++ b/ocaml/xapi/message_forwarding.ml @@ -1302,6 +1302,9 @@ module Forward = functor(Local: Custom_actions.CUSTOM_ACTIONS) -> struct let local_fn = Local.VM.hard_shutdown ~vm in with_vm_operation ~__context ~self:vm ~doc:"VM.hard_shutdown" ~op:`hard_shutdown (fun () -> + List.iter (fun (task,op) -> + if op = `clean_shutdown then + try Local.Task.cancel ~__context ~task:(Ref.of_string task) with _ -> () )(Db.VM.get_current_operations ~__context ~self:vm); (* If VM is actually suspended and we ask to hard_shutdown, we need to forward to any host that can see the VDIs *) let policy = @@ -1343,6 +1346,9 @@ module Forward = functor(Local: Custom_actions.CUSTOM_ACTIONS) -> struct let local_fn = Local.VM.hard_reboot ~vm in with_vm_operation ~__context ~self:vm ~doc:"VM.hard_reboot" ~op:`hard_reboot (fun () -> + List.iter (fun (task,op) -> + if op = `clean_reboot then + try Local.Task.cancel ~__context ~task:(Ref.of_string task) with _ -> () )(Db.VM.get_current_operations ~__context ~self:vm); with_vbds_marked ~__context ~vm ~doc:"VM.hard_reboot" ~op:`attach (fun vbds -> with_vifs_marked ~__context ~vm ~doc:"VM.hard_reboot" ~op:`attach