Skip to content

Commit 8e54338

Browse files
committed
SCTX-1334: Ensure that hard_shutdown and hard_reboot cancels clean_shutdown and clean_reboot respectively.
1 parent 6049936 commit 8e54338

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ocaml/xapi/message_forwarding.ml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,6 +1302,9 @@ module Forward = functor(Local: Custom_actions.CUSTOM_ACTIONS) -> struct
13021302
let local_fn = Local.VM.hard_shutdown ~vm in
13031303
with_vm_operation ~__context ~self:vm ~doc:"VM.hard_shutdown" ~op:`hard_shutdown
13041304
(fun () ->
1305+
List.iter (fun (task,op) ->
1306+
if op = `clean_shutdown then
1307+
try Local.Task.cancel ~__context ~task:(Ref.of_string task) with _ -> () )(Db.VM.get_current_operations ~__context ~self:vm);
13051308
(* If VM is actually suspended and we ask to hard_shutdown, we need to
13061309
forward to any host that can see the VDIs *)
13071310
let policy =
@@ -1343,6 +1346,9 @@ module Forward = functor(Local: Custom_actions.CUSTOM_ACTIONS) -> struct
13431346
let local_fn = Local.VM.hard_reboot ~vm in
13441347
with_vm_operation ~__context ~self:vm ~doc:"VM.hard_reboot" ~op:`hard_reboot
13451348
(fun () ->
1349+
List.iter (fun (task,op) ->
1350+
if op = `clean_reboot then
1351+
try Local.Task.cancel ~__context ~task:(Ref.of_string task) with _ -> () )(Db.VM.get_current_operations ~__context ~self:vm);
13461352
with_vbds_marked ~__context ~vm ~doc:"VM.hard_reboot" ~op:`attach
13471353
(fun vbds ->
13481354
with_vifs_marked ~__context ~vm ~doc:"VM.hard_reboot" ~op:`attach

0 commit comments

Comments
 (0)