Skip to content

Commit 0c3aaca

Browse files
committed
CP-311475: do not change a domain's memory allocation while it is being built
When a domain takes a long time to be built (e.g. >1TiB) then squeezed might run and attempt to change maxmem, causing the domain build to fail to complete. ``` 2026-02-04T13:59:12.915844+00:00 orca squeezed: [debug||9 ||squeeze_xen] Xenctrl.domain_setmaxmem domid=717 max=6370254848 (was=0) 2026-02-04T13:59:22.878301+00:00 orca squeezed: [debug||3 ||squeeze_xen] Xenctrl.domain_setmaxmem domid=717 max=2075287552 (was=6370254848) ``` Squeezed shouldn't change the maxmem setting on domains that have never been run (other than to initialize it if 0). In fact another module in Squeezed had code to detect whether a domain has ever been run, which has been replaced with checking whether it has an active balloon driver (if it hasn't reported a balloon driver it is still not very safe to change it too early). But that check missed one place that was still setting maxmem, ignoring the balloon driver's presence. Fix this (hopefully last!) place: if there is no balloon driver and we attempt to decrease maxmem then just log a message instead. Fixes: 9819bdb ("CA-32810: prevent the memory ballooning daemon capping a domain's memory usage before it has written feature-balloon.") Signed-off-by: Edwin Török <edwin.torok@citrix.com>
1 parent ba43e00 commit 0c3aaca

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

ocaml/squeezed/src/squeeze_xen.ml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,8 @@ let make_host ~verbose ~xc =
794794
(fun domain ->
795795
let domid = domain.Squeeze.domid
796796
and target_kib = domain.Squeeze.target_kib in
797-
if target_kib < Domain.get_maxmem xc domid then
797+
if target_kib < Domain.get_maxmem xc domid && domain.Squeeze.can_balloon
798+
then
798799
Domain.set_maxmem_noexn xc domid target_kib
799800
)
800801
domains ;
@@ -828,16 +829,14 @@ let execute_action ~xc action =
828829
"Not setting target for domid: %d since no feature-balloon. Setting \
829830
maxmem to %Ld"
830831
domid target_kib
831-
) else (
832-
if can_balloon then
833-
Domain.set_target_noexn cnx domid target_kib
834-
else
835-
debug
836-
"Not setting target for domid: %d since no feature-balloon. Setting \
837-
maxmem to %Ld"
838-
domid target_kib ;
832+
) else if can_balloon then begin
833+
Domain.set_target_noexn cnx domid target_kib ;
839834
Domain.set_maxmem_noexn cnx domid target_kib
840-
)
835+
end else
836+
debug
837+
"Not setting target for domid: %d since no feature-balloon. Not \
838+
setting maxmem to %Ld"
839+
domid target_kib
841840
with e ->
842841
debug "Failed to reset balloon target (domid: %d) (target: %Ld): %s"
843842
action.Squeeze.action_domid action.Squeeze.new_target_kib

0 commit comments

Comments
 (0)