Skip to content

Commit 76a9459

Browse files
authored
Merge pull request #2726 from robhoes/memory2
Fix memory setting issues
2 parents d6d2f65 + 1dfbc43 commit 76a9459

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
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;

ocaml/xapi/message_forwarding.ml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -793,9 +793,11 @@ module Forward = functor(Local: Custom_actions.CUSTOM_ACTIONS) -> struct
793793

794794
(* Read resisdent-on field from vm to determine who to forward to *)
795795
let forward_vm_op ~local_fn ~__context ~vm op =
796-
Xapi_vm_lifecycle.assert_power_state_in ~__context ~self:vm
797-
~allowed:[`Running; `Paused];
798-
do_op_on ~local_fn ~__context ~host:(Db.VM.get_resident_on ~__context ~self:vm) op
796+
let power_state = Db.VM.get_power_state ~__context ~self:vm in
797+
if List.mem power_state [`Running; `Paused] then
798+
do_op_on ~local_fn ~__context ~host:(Db.VM.get_resident_on ~__context ~self:vm) op
799+
else
800+
local_fn ~__context
799801

800802
(* Clear scheduled_to_be_resident_on for a VM and all its vGPUs. *)
801803
let clear_scheduled_to_be_resident_on ~__context ~vm =

0 commit comments

Comments
 (0)