Skip to content

Commit

Permalink
Merge pull request xapi-project#1469 from jonludlam/CA-112284
Browse files Browse the repository at this point in the history
CA-112284: Be more careful with errors from start_paused
  • Loading branch information
johnelse committed Aug 29, 2013
2 parents 0832b96 + 623ae4b commit 23ecc46
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions ocaml/xapi/xapi_xenops.ml
Expand Up @@ -1883,8 +1883,23 @@ let start ~__context ~self paused =
let vm_start = Client.VM.start dbg id in
info "xenops: Queueing VM.unpause %s" id;
let vm_unpause = Client.VM.unpause dbg id in
Pervasiveext.finally (fun () -> sync_with_task __context vm_start)
(fun () -> sync __context vm_unpause)
begin
try
sync_with_task __context vm_start;
with e ->
(* If the VM.start throws an error, clean up the unpause
which will fail in an irrelevant manor, then reraise
the original error *)
begin
try sync __context vm_unpause with _ -> ()
end;
raise e
end;

(* At this point, the start paused has succeeded. Now
we _do_ care about any error from unpause *)

sync_with_task __context vm_unpause
end
else
Client.VM.start dbg id |> sync_with_task __context;
Expand Down

0 comments on commit 23ecc46

Please sign in to comment.