Skip to content

Commit b5d3566

Browse files
committed
CP-18860 move memory check to assert_valid_for_current_context
The only place where the memory configuration is checked is xapi_vm_memory_constraints.assert_valid_for_current_context. Signed-off-by: Christian Lindig <christian.lindig@citrix.com>
1 parent f81d86b commit b5d3566

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

ocaml/xapi/xapi_vm_memory_constraints.ml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ module Vm_memory_constraints : T = struct
5151

5252
include Vm_memory_constraints.Vm_memory_constraints
5353

54+
let nested_virt ~__context vm =
55+
let metrics = Db.VM.get_metrics ~__context ~self:vm in
56+
Xapi_vm_lifecycle.nested_virt ~__context vm metrics
57+
5458
let order_constraint =
5559
"Memory limits must satisfy: \
5660
static_min ≤ dynamic_min ≤ dynamic_max ≤ static_max"
@@ -70,10 +74,11 @@ module Vm_memory_constraints : T = struct
7074

7175
let assert_valid_for_current_context ~__context ~vm ~constraints =
7276
let is_control_domain = Db.VM.get_is_control_domain ~__context ~self:vm in
73-
(if Pool_features.is_enabled ~__context Features.DMC && not is_control_domain
74-
then assert_valid
75-
else assert_valid_and_pinned_at_static_max)
76-
~constraints
77+
if Pool_features.is_enabled ~__context Features.DMC
78+
&& not is_control_domain
79+
&& not (nested_virt ~__context vm)
80+
then assert_valid ~constraints
81+
else assert_valid_and_pinned_at_static_max ~constraints
7782

7883
let extract ~vm_record =
7984
{

0 commit comments

Comments
 (0)