Skip to content

Commit a40a75e

Browse files
authored
Merge pull request xapi-project#3328 from mseri/CA-271052
CA-271052: pool join fixup
2 parents 2172ed0 + 0b2a5f7 commit a40a75e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

ocaml/xapi/xapi_pool.ml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,18 @@ let pre_join_checks ~__context ~rpc ~session_id ~force =
113113

114114
(* The maximum pool size allowed must be restricted to 3 hosts for the pool which does not have Pool_size feature *)
115115
let assert_pool_size_unrestricted () =
116-
if (not (Pool_features.is_enabled ~__context Features.Pool_size)) &&
117-
(List.length (Client.Host.get_all ~rpc ~session_id) >= Xapi_globs.restricted_pool_size) then
116+
let allowed =
117+
let dom0 = Helpers.get_domain_zero ~__context in
118+
Db.VM.get_records_where ~__context
119+
~expr:(Eq(Field "is_control_domain", Literal "true"))
120+
|> List.exists (fun (vmref, vmrec) ->
121+
(vmref <> dom0) &&
122+
(Xapi_stdext_std.Xstringext.String.endswith "-CVM" vmrec.API.vM_name_label)
123+
)
124+
in
125+
if (not allowed) &&
126+
(not (Pool_features.is_enabled ~__context Features.Pool_size)) &&
127+
(List.length (Client.Host.get_all ~rpc ~session_id) >= Xapi_globs.restricted_pool_size) then
118128
raise (Api_errors.Server_error(Api_errors.license_restriction, [Features.name_of_feature Features.Pool_size]))
119129
in
120130

0 commit comments

Comments
 (0)