Skip to content

Commit

Permalink
Remove CVM and relevant test cases
Browse files Browse the repository at this point in the history
CVM had been supported but not since long time ago.

This commit is to clean up the remanent code and test csaes.

Signed-off-by: Ming Lu <[email protected]>
  • Loading branch information
minglumlu committed May 29, 2024
1 parent cc4a203 commit 3a80f2a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 37 deletions.
25 changes: 1 addition & 24 deletions ocaml/tests/test_host.ml
Original file line number Diff line number Diff line change
Expand Up @@ -65,27 +65,4 @@ let test_host_join_restriction () =
(Xapi_globs.restricted_pool_size + 1)
(Db.Host.get_all ~__context |> List.length)

let test_cvm_exception () =
let __context = setup_test () in
(* Check adding one more is a failure *)
Alcotest.check_raises "Should fail"
(Api_errors.Server_error
( Api_errors.license_restriction
, [Features.name_of_feature Features.Pool_size]
)
)
(fun () -> ignore (add_host __context "badhost")) ;
let new_vm = Test_common.make_vm ~__context ~name_label:"My test VM-CVM" () in
Db.VM.set_is_control_domain ~__context ~self:new_vm ~value:true ;
(* Adding hosts should now work *)
add_host __context "goodhost" ;
Alcotest.(check int)
"one added OK"
(Xapi_globs.restricted_pool_size + 1)
(Db.Host.get_all ~__context |> List.length)

let test =
[
("test_host_join_restriction", `Quick, test_host_join_restriction)
; ("test_host_join_cvm_exception", `Quick, test_cvm_exception)
]
let test = [("test_host_join_restriction", `Quick, test_host_join_restriction)]
1 change: 0 additions & 1 deletion ocaml/tests/test_xapi_xenops.ml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ let test_xapi_restart_inner () =
Xapi_xenops.start ~__context ~self:vm5 false false ;
Xapi_xenops.start ~__context ~self:vm6 false false ;
Xapi_xenops.start ~__context ~self:vm7 false false ;
(* vm6 is a ntnx CVM *)
Db.VM.set_is_control_domain ~__context ~self:vm6 ~value:true ;
(* Kill the event thread *)
cancel := true ;
Expand Down
13 changes: 1 addition & 12 deletions ocaml/xapi/xapi_host.ml
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,7 @@ let assert_safe_to_reenable ~__context ~self =

(* The maximum pool size allowed must be restricted to 3 hosts for the pool which does not have Pool_size feature *)
let pool_size_is_restricted ~__context =
let cvm_exception =
let dom0 = Helpers.get_domain_zero ~__context in
Db.VM.get_records_where ~__context
~expr:(Eq (Field "is_control_domain", Literal "true"))
|> List.exists (fun (vmref, vmrec) ->
vmref <> dom0
&& Xapi_stdext_std.Xstringext.String.endswith "-CVM"
vmrec.API.vM_name_label
)
in
(not cvm_exception)
&& not (Pool_features.is_enabled ~__context Features.Pool_size)
not (Pool_features.is_enabled ~__context Features.Pool_size)

let bugreport_upload ~__context ~host:_ ~url ~options =
let proxy =
Expand Down

0 comments on commit 3a80f2a

Please sign in to comment.