Skip to content

Commit

Permalink
Merge pull request #284 from jonludlam/CA-217805
Browse files Browse the repository at this point in the history
CA-217805: Prefer asking newer guests to poweroff rather than halt
  • Loading branch information
robhoes committed Aug 22, 2016
2 parents 50bb4c8 + 7a71ef8 commit 02a8cd2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions xc/xenops_server_xen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,18 @@ module VM = struct
let reason = shutdown_reason reason in
on_domain
(fun xc xs task vm di ->

let domid = di.Xenctrl.domid in

(* As per comment on CA-217805 *)
let use_poweroff =
try
xs.Xs.read (xs.Xs.getdomainpath domid ^ "/control/feature-poweroff") = "1"
with _ -> false
in

let reason = match reason, use_poweroff with Domain.Halt, true -> Domain.PowerOff | x, _ -> x in

try
Domain.shutdown ~xc ~xs domid reason;
Domain.shutdown_wait_for_ack task ~timeout:ack_delay ~xc ~xs domid reason;
Expand Down

0 comments on commit 02a8cd2

Please sign in to comment.