# HG changeset patch # User David Scott # Date 1265222077 0 # Node ID 0626509183504d757e9b77d8688307a20f039556 # Parent e1d8b800b96520a64edf53d6c1c41b1eb88f13c3 CA-37257: Always allow dom0 to be ballooned even if we're trying to prevent domUs from being ballooned. Signed-off-by: David Scott diff -r e1d8b800b965 -r 062650918350 ocaml/xapi/xapi_vm.ml --- a/ocaml/xapi/xapi_vm.ml Wed Feb 03 18:34:37 2010 +0000 +++ b/ocaml/xapi/xapi_vm.ml Wed Feb 03 18:34:37 2010 +0000 @@ -140,7 +140,7 @@ static_max = max; } in Vm_memory_constraints.assert_valid_for_current_context - ~__context ~constraints; + ~__context ~vm:self ~constraints; Db.VM.set_memory_static_min ~__context ~self ~value:min; Db.VM.set_memory_static_max ~__context ~self ~value:max; update_memory_overhead ~__context ~vm:self @@ -171,7 +171,7 @@ static_max = static_max; } in Vm_memory_constraints.assert_valid_for_current_context - ~__context ~constraints; + ~__context ~vm:self ~constraints; Vm_memory_constraints.set ~__context ~vm_ref:self ~constraints; update_memory_overhead ~__context ~vm:self diff -r e1d8b800b965 -r 062650918350 ocaml/xapi/xapi_vm_helpers.ml --- a/ocaml/xapi/xapi_vm_helpers.ml Wed Feb 03 18:34:37 2010 +0000 +++ b/ocaml/xapi/xapi_vm_helpers.ml Wed Feb 03 18:34:37 2010 +0000 @@ -579,7 +579,7 @@ target = min; dynamic_max = max } in Vm_memory_constraints.assert_valid_for_current_context - ~__context ~constraints; + ~__context ~vm:self ~constraints; (* memory_target is now unused but setting it equal *) (* to dynamic_min avoids tripping validation code. *) diff -r e1d8b800b965 -r 062650918350 ocaml/xapi/xapi_vm_memory_constraints.ml --- a/ocaml/xapi/xapi_vm_memory_constraints.ml Wed Feb 03 18:34:37 2010 +0000 +++ b/ocaml/xapi/xapi_vm_memory_constraints.ml Wed Feb 03 18:34:37 2010 +0000 @@ -31,7 +31,7 @@ (** Asserts that the given set of constraints [c] is valid for the current context. *) val assert_valid_for_current_context : - __context:Context.t -> constraints:t -> unit + __context:Context.t -> vm:API.ref_VM -> constraints:t -> unit (** Extracts memory constraints from the given VM record. *) val extract : vm_record:API.vM_t -> t @@ -65,8 +65,10 @@ ["Memory limits must satisfy: \ static_min ≤ dynamic_min = dynamic_max = static_max"])) - let assert_valid_for_current_context ~__context ~constraints = - (if Restrictions.context_ok_for_dmc ~__context + let assert_valid_for_current_context ~__context ~vm ~constraints = + (* NB we don't want to prevent dom0 ballooning even if we do want to prevent + domU ballooning. *) + (if Db.VM.get_is_control_domain ~__context ~self:vm || (Restrictions.context_ok_for_dmc ~__context) then assert_valid else assert_valid_and_pinned_at_static_max) ~constraints