Skip to content

Commit 1dfbc43

Browse files
committed
On startup, only update dom0 static_min if it is unset
This maintains dom0's static_min as the memory allocation at install time, which serves as a useful minimum in general, even if the memory allocation is increased later (unless explicitly changed by a client). Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
1 parent 1ef03b6 commit 1dfbc43

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ocaml/xapi/create_misc.ml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,16 @@ and create_domain_zero_guest_metrics_record ~__context ~domain_zero_metrics_ref
331331
and update_domain_zero_record ~__context ~domain_zero_ref (host_info: host_info) : unit =
332332
(* Write the updated memory constraints to the database, if the VM is not
333333
marked as requiring reboot. *)
334+
let constraints_in_db = Vm_memory_constraints.get ~__context ~vm_ref:domain_zero_ref in
334335
let constraints = create_domain_zero_memory_constraints host_info in
335336
if not (Xapi_host_helpers.Host_requires_reboot.get ()) then begin
337+
let constraints =
338+
(* Only update static_min if it is unset (i.e. 0) *)
339+
if constraints_in_db.static_min > 0L then
340+
{constraints with static_min = constraints_in_db.static_min}
341+
else
342+
constraints
343+
in
336344
Vm_memory_constraints.set ~__context ~vm_ref:domain_zero_ref ~constraints;
337345
Db.VM.set_requires_reboot ~__context ~self:domain_zero_ref ~value:false
338346
end;

0 commit comments

Comments
 (0)