File tree Expand file tree Collapse file tree 10 files changed +34
-45
lines changed Expand file tree Collapse file tree 10 files changed +34
-45
lines changed Original file line number Diff line number Diff line change @@ -304,7 +304,7 @@ module Ds_selector = struct
304304 if fs = [] then
305305 true
306306 else
307- List. fold_left (fun acc f -> acc || filter11 f d) false fs
307+ List. exists (fun f -> filter11 f d) fs
308308
309309 (* Returns the d \in ds that passes at least one of the filters
310310 fs *)
Original file line number Diff line number Diff line change @@ -45,10 +45,7 @@ let check_plan config dead_hosts plan =
4545 let memory_remaining = account config.hosts config.vms plan in
4646 (* List.iter (fun mem -> Printf.printf "%Ld\n" mem) free; *)
4747 (* No host should be overcommitted: *)
48- if
49- List. fold_left ( || ) false
50- (List. map (fun x -> x < 0L ) (List. map snd memory_remaining))
51- then
48+ if List. exists (fun (_ , x ) -> x < 0L ) memory_remaining then
5249 raise BadPlan ;
5350 (* All failed VMs should be restarted: *)
5451 let failed_vms = get_failed_vms config dead_hosts in
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ let track callback rpc (session_id : API.ref_session) task =
9191 | _ ->
9292 false
9393 in
94- finished := List. fold_left ( || ) false ( List. map matches events)
94+ finished := List. exists matches events
9595 done
9696 with
9797 | Api_errors. Server_error (code, _)
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ let names =
6363
6464let vdi_exists sr vdi =
6565 let all = Client.SR. scan dbg sr in
66- List. fold_left (fun acc vdi_info -> acc || vdi_info.vdi = vdi) false all
66+ List. exists (fun vdi_info -> vdi_info.vdi = vdi) all
6767
6868let create sr name_label =
6969 let vdi_info =
Original file line number Diff line number Diff line change @@ -94,15 +94,9 @@ let ( + ) state operation =
9494
9595let superstate states =
9696 let activated =
97- List. fold_left
98- (fun acc s -> acc || s = Activated RO || s = Activated RW )
99- false states
100- in
101- let rw =
102- List. fold_left
103- (fun acc s -> acc || s = Activated RW || s = Attached RW )
104- false states
97+ List. exists (fun s -> s = Activated RO || s = Activated RW ) states
10598 in
99+ let rw = List. exists (fun s -> s = Activated RW || s = Attached RW ) states in
106100 if states = [] then
107101 Detached
108102 else if activated then
Original file line number Diff line number Diff line change @@ -1012,7 +1012,7 @@ let pool_has_different_host_platform_versions ~__context =
10121012 let is_different_to_me platform_version =
10131013 platform_version <> Xapi_version. platform_version ()
10141014 in
1015- List. fold_left ( || ) false ( List. map is_different_to_me platform_versions)
1015+ List. exists is_different_to_me platform_versions
10161016
10171017(* Checks that a host has a PBD for a particular SR (meaning that the
10181018 SR is visible to the host) *)
Original file line number Diff line number Diff line change @@ -58,17 +58,19 @@ let rec compute_additional_restrictions all_host_params = function
5858 []
5959 | flag :: rest ->
6060 let switches =
61- List. map
61+ List. exists
6262 (function
63- | params ->
64- if List. mem_assoc flag params then
65- bool_of_string (List. assoc flag params)
66- else
63+ | params -> (
64+ match List. assoc_opt flag params with
65+ | Some x ->
66+ bool_of_string x
67+ | None ->
6768 true
6869 )
70+ )
6971 all_host_params
7072 in
71- (flag, string_of_bool ( List. fold_left ( || ) false switches) )
73+ (flag, string_of_bool switches)
7274 :: compute_additional_restrictions all_host_params rest
7375
7476(* Combine the host-level feature restrictions into pool-level ones, and write
Original file line number Diff line number Diff line change @@ -427,9 +427,9 @@ let create ~__context ~network ~members ~mAC ~mode ~properties =
427427 in
428428 let disallow_unplug =
429429 (* this is always true if one of the PIFs is a cluster_host.PIF *)
430- List. fold_left
431- (fun a m -> Db.PIF. get_disallow_unplug ~__context ~self: m || a )
432- false members
430+ List. exists
431+ (fun m -> Db.PIF. get_disallow_unplug ~__context ~self: m)
432+ members
433433 in
434434 (* Validate constraints: *)
435435 (* 1. Members must not be in a bond already *)
Original file line number Diff line number Diff line change @@ -1334,18 +1334,14 @@ let gen_list_option name desc of_string string_of opt =
13341334let sm_plugins = ref []
13351335
13361336let accept_sm_plugin name =
1337- List. (
1338- fold_left ( || ) false
1339- (map
1340- (function
1341- | `All ->
1342- true
1343- | `Sm x ->
1344- String. lowercase_ascii x = String. lowercase_ascii name
1345- )
1346- ! sm_plugins
1337+ List. exists
1338+ (function
1339+ | `All ->
1340+ true
1341+ | `Sm x ->
1342+ String. lowercase_ascii x = String. lowercase_ascii name
13471343 )
1348- )
1344+ ! sm_plugins
13491345
13501346let nvidia_multi_vgpu_enabled_driver_versions =
13511347 ref [" 430.42" ; " 430.62" ; " 440.00+" ]
Original file line number Diff line number Diff line change @@ -2185,19 +2185,19 @@ let reset_networking ~__context ~host =
21852185 (Db.PIF. get_all ~__context)
21862186 in
21872187 let bond_is_local bond =
2188- List. fold_left
2189- (fun a pif -> Db.Bond. get_master ~__context ~self: bond = pif || a )
2190- false local_pifs
2188+ List. exists
2189+ (fun pif -> Db.Bond. get_master ~__context ~self: bond = pif)
2190+ local_pifs
21912191 in
21922192 let vlan_is_local vlan =
2193- List. fold_left
2194- (fun a pif -> Db.VLAN. get_untagged_PIF ~__context ~self: vlan = pif || a )
2195- false local_pifs
2193+ List. exists
2194+ (fun pif -> Db.VLAN. get_untagged_PIF ~__context ~self: vlan = pif)
2195+ local_pifs
21962196 in
21972197 let tunnel_is_local tunnel =
2198- List. fold_left
2199- (fun a pif -> Db.Tunnel. get_access_PIF ~__context ~self: tunnel = pif || a )
2200- false local_pifs
2198+ List. exists
2199+ (fun pif -> Db.Tunnel. get_access_PIF ~__context ~self: tunnel = pif)
2200+ local_pifs
22012201 in
22022202 let bonds = List. filter bond_is_local (Db.Bond. get_all ~__context) in
22032203 List. iter
You can’t perform that action at this time.
0 commit comments