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