Skip to content

Commit

Permalink
Merge pull request xapi-project#40 from koushikcgit/CA-195440
Browse files Browse the repository at this point in the history
CA-195440: Mark VM stuck only once balloon-driver has published featur…
  • Loading branch information
robhoes committed Jan 12, 2016
2 parents d91ea39 + 15b79fa commit 31f11a1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/squeeze.ml
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ let change_host_free_memory ?fistpoints io required_mem_kib success_condition =
let debug_string = String.concat "; " (host_debug_string :: (List.map (fun domain -> short_string_of_domain domain ^ (new_target_direction domain)) host.domains)) in
debug "%s" debug_string;

List.iter (io.declare_domain_stuck ) declared_inactive_domids;
List.iter (io.declare_domain_stuck) declared_inactive_domids;

(* For each domid, decide what maxmem should be *)
let maxmems = IntMap.mapi
Expand Down
14 changes: 10 additions & 4 deletions src/squeeze_xen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,12 @@ module Domain = struct
let set_domain_stuck_noexn cnx domid _val = write_noexn cnx domid _domain_stuck _val

(** Query to find if a domain is stuck. Don't throw an exception if the domain has been destroyed *)
let get_domain_stuck cnx domid = try ignore(read cnx domid _domain_stuck); true with Xs_protocol.Enoent _ -> false
let get_domain_stuck cnx domid =
try
match (read cnx domid _domain_stuck) with
| "true" -> true
| _ -> false
with Xs_protocol.Enoent _ -> false

(** Set a domain's maxmem. Don't throw an exception if the domain has been destroyed *)
let set_maxmem_noexn cnx domid target_kib =
Expand All @@ -370,9 +375,10 @@ module Domain = struct
end

(** Mark the domain as squeezed declared stuck *)
let declare_domain_stuck ~xc domid =
let set_domain_stuck ~xc domid value =
let cnx = xc in
Domain.set_domain_stuck_noexn cnx domid "true"
let can_balloon = Domain.get_feature_balloon cnx domid in
if can_balloon then Domain.set_domain_stuck_noexn cnx domid value

(** Record when the domain was last co-operative *)
let when_domain_was_last_cooperative : (int, float) Hashtbl.t = Hashtbl.create 10
Expand Down Expand Up @@ -619,7 +625,7 @@ let io ~xc ~verbose = {
execute_action = (fun action -> execute_action ~xc action);
target_host_free_mem_kib = target_host_free_mem_kib;
free_memory_tolerance_kib = free_memory_tolerance_kib;
declare_domain_stuck = (fun domid -> declare_domain_stuck ~xc domid);
declare_domain_stuck = (fun domid -> set_domain_stuck ~xc domid "true");
}

let change_host_free_memory ~xc required_mem_kib success_condition =
Expand Down

0 comments on commit 31f11a1

Please sign in to comment.