diff --git a/ocaml/tests/test_host.ml b/ocaml/tests/test_host.ml index 3c4e1bb3da5..80e72f4f113 100644 --- a/ocaml/tests/test_host.ml +++ b/ocaml/tests/test_host.ml @@ -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)] diff --git a/ocaml/tests/test_xapi_xenops.ml b/ocaml/tests/test_xapi_xenops.ml index 85d8cd26794..551c7d0d90f 100644 --- a/ocaml/tests/test_xapi_xenops.ml +++ b/ocaml/tests/test_xapi_xenops.ml @@ -57,7 +57,6 @@ let test_xapi_restart_inner () = let vm4 = make_vm ~__context ~name_label:"vm4" () in let vm5 = make_vm ~__context ~name_label:"vm5" () in let vm6 = make_vm ~__context ~name_label:"vm6" () in - let vm7 = make_vm ~__context ~name_label:"vm7" () in let host2 = make_host ~__context ~name_label:"host2" ~hostname:"localhost2" () in @@ -72,23 +71,20 @@ let test_xapi_restart_inner () = Db.VM.add_to_other_config ~__context ~self:vm ~key:"xenops" ~value:"simulator" in - List.iter add_flags [vm1; vm2; vm3; vm4; vm5; vm6; vm7] ; + List.iter add_flags [vm1; vm2; vm3; vm4; vm5; vm6] ; try (* Domain zero is running but not in xenopsd *) Db.VM.set_is_control_domain ~__context ~self:vm0 ~value:true ; Db.VM.set_resident_on ~__context ~self:vm0 ~value:(Helpers.get_localhost ~__context) ; Db.VM.set_power_state ~__context ~self:vm0 ~value:`Running ; - (* Start all 7 VMs *) + (* Start all 6 VMs *) Xapi_xenops.start ~__context ~self:vm1 false false ; Xapi_xenops.start ~__context ~self:vm2 false false ; Xapi_xenops.start ~__context ~self:vm3 false false ; Xapi_xenops.start ~__context ~self:vm4 false false ; 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 ; Client.UPDATES.inject_barrier "dbg" @@ -122,7 +118,7 @@ let test_xapi_restart_inner () = in List.iter (fun vm -> assert_correct_state (vm, true)) - [vm1; vm2; vm3; vm4; vm5; vm6; vm7] ; + [vm1; vm2; vm3; vm4; vm5; vm6] ; (* Simulate various out-of-band VM operations by resetting the xapi state to halted, and stop one that was running *) Db.VM.set_resident_on ~__context ~self:vm1 ~value:Ref.null ; Db.VM.set_name_label ~__context ~self:vm1 @@ -138,13 +134,11 @@ let test_xapi_restart_inner () = Db.VM.set_name_label ~__context ~self:vm4 ~value:"vm4: xapi thinks it's running somewhere else" ; Db.VM.destroy ~__context ~self:vm5 ; - Db.VM.set_name_label ~__context ~self:vm6 - ~value:"vm6: is_control_domain=true" ; ignore - (Client.VM.shutdown "dbg" (Xapi_xenops.id_of_vm ~__context ~self:vm7) None) ; - Db.VM.set_name_label ~__context ~self:vm7 + (Client.VM.shutdown "dbg" (Xapi_xenops.id_of_vm ~__context ~self:vm6) None) ; + Db.VM.set_name_label ~__context ~self:vm6 ~value: - "vm7: shutdown in xenopsd while xapi was off (and is_control_domain)" ; + "vm6: shutdown in xenopsd while xapi was off (and is_control_domain)" ; (* Now run the on_xapi_restart logic *) debug "Resync resident on" ; Xapi_xenops.resync_resident_on ~__context ; @@ -176,14 +170,7 @@ let test_xapi_restart_inner () = debug "Elapsed time for thread death: %f\n%!" (after -. before) ; (* And check that the right thing has happened *) List.iter assert_correct_state - [ - (vm1, true) - ; (vm2, true) - ; (vm3, false) - ; (vm4, false) - ; (vm6, true) - ; (vm7, false) - ] + [(vm1, true); (vm2, true); (vm3, false); (vm4, false); (vm6, false)] with e -> Printf.printf "Caught: %s\n" (Printexc.to_string e) ; Printf.printf "Backtrace: %s\n%!" (Backtrace.to_string_hum (Backtrace.get e)) ; diff --git a/ocaml/xapi/xapi_host.ml b/ocaml/xapi/xapi_host.ml index 4d5872aa5ca..bb3c718647c 100644 --- a/ocaml/xapi/xapi_host.ml +++ b/ocaml/xapi/xapi_host.ml @@ -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 =