Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ocaml/rrd2csv/src/rrd2csv.ml
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ module Ds_selector = struct
if fs = [] then
true
else
List.fold_left (fun acc f -> acc || filter11 f d) false fs
List.exists (fun f -> filter11 f d) fs

(* Returns the d \in ds that passes at least one of the filters
fs *)
Expand Down
5 changes: 1 addition & 4 deletions ocaml/tests/binpack_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ let check_plan config dead_hosts plan =
let memory_remaining = account config.hosts config.vms plan in
(* List.iter (fun mem -> Printf.printf "%Ld\n" mem) free; *)
(* No host should be overcommitted: *)
if
List.fold_left ( || ) false
(List.map (fun x -> x < 0L) (List.map snd memory_remaining))
then
if List.exists (fun (_, x) -> x < 0L) memory_remaining then
raise BadPlan ;
(* All failed VMs should be restarted: *)
let failed_vms = get_failed_vms config dead_hosts in
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xapi-cli-server/cli_util.ml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ let track callback rpc (session_id : API.ref_session) task =
| _ ->
false
in
finished := List.fold_left ( || ) false (List.map matches events)
finished := List.exists matches events
done
with
| Api_errors.Server_error (code, _)
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xapi-idl/storage/storage_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ let names =

let vdi_exists sr vdi =
let all = Client.SR.scan dbg sr in
List.fold_left (fun acc vdi_info -> acc || vdi_info.vdi = vdi) false all
List.exists (fun vdi_info -> vdi_info.vdi = vdi) all

let create sr name_label =
let vdi_info =
Expand Down
10 changes: 2 additions & 8 deletions ocaml/xapi-idl/storage/vdi_automaton.ml
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,9 @@ let ( + ) state operation =

let superstate states =
let activated =
List.fold_left
(fun acc s -> acc || s = Activated RO || s = Activated RW)
false states
in
let rw =
List.fold_left
(fun acc s -> acc || s = Activated RW || s = Attached RW)
false states
List.exists (fun s -> s = Activated RO || s = Activated RW) states
in
let rw = List.exists (fun s -> s = Activated RW || s = Attached RW) states in
if states = [] then
Detached
else if activated then
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xapi/helpers.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ let pool_has_different_host_platform_versions ~__context =
let is_different_to_me platform_version =
platform_version <> Xapi_version.platform_version ()
in
List.fold_left ( || ) false (List.map is_different_to_me platform_versions)
List.exists is_different_to_me platform_versions

(* Checks that a host has a PBD for a particular SR (meaning that the
SR is visible to the host) *)
Expand Down
11 changes: 5 additions & 6 deletions ocaml/xapi/pool_features_helpers.ml
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,16 @@ let rec compute_additional_restrictions all_host_params = function
[]
| flag :: rest ->
let switches =
List.map
List.exists
(function
| params ->
if List.mem_assoc flag params then
bool_of_string (List.assoc flag params)
else
true
List.assoc_opt flag params
|> Fun.flip Option.bind bool_of_string_opt
|> Option.value ~default:true
)
all_host_params
in
(flag, string_of_bool (List.fold_left ( || ) false switches))
(flag, string_of_bool switches)
:: compute_additional_restrictions all_host_params rest

(* Combine the host-level feature restrictions into pool-level ones, and write
Expand Down
6 changes: 3 additions & 3 deletions ocaml/xapi/xapi_bond.ml
Original file line number Diff line number Diff line change
Expand Up @@ -427,9 +427,9 @@ let create ~__context ~network ~members ~mAC ~mode ~properties =
in
let disallow_unplug =
(* this is always true if one of the PIFs is a cluster_host.PIF *)
List.fold_left
(fun a m -> Db.PIF.get_disallow_unplug ~__context ~self:m || a)
false members
List.exists
(fun m -> Db.PIF.get_disallow_unplug ~__context ~self:m)
members
in
(* Validate constraints: *)
(* 1. Members must not be in a bond already *)
Expand Down
18 changes: 7 additions & 11 deletions ocaml/xapi/xapi_globs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1334,18 +1334,14 @@ let gen_list_option name desc of_string string_of opt =
let sm_plugins = ref []

let accept_sm_plugin name =
List.(
fold_left ( || ) false
(map
(function
| `All ->
true
| `Sm x ->
String.lowercase_ascii x = String.lowercase_ascii name
)
!sm_plugins
List.exists
(function
| `All ->
true
| `Sm x ->
String.lowercase_ascii x = String.lowercase_ascii name
)
)
!sm_plugins

let nvidia_multi_vgpu_enabled_driver_versions =
ref ["430.42"; "430.62"; "440.00+"]
Expand Down
18 changes: 9 additions & 9 deletions ocaml/xapi/xapi_host.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2185,19 +2185,19 @@ let reset_networking ~__context ~host =
(Db.PIF.get_all ~__context)
in
let bond_is_local bond =
List.fold_left
(fun a pif -> Db.Bond.get_master ~__context ~self:bond = pif || a)
false local_pifs
List.exists
(fun pif -> Db.Bond.get_master ~__context ~self:bond = pif)
local_pifs
in
let vlan_is_local vlan =
List.fold_left
(fun a pif -> Db.VLAN.get_untagged_PIF ~__context ~self:vlan = pif || a)
false local_pifs
List.exists
(fun pif -> Db.VLAN.get_untagged_PIF ~__context ~self:vlan = pif)
local_pifs
in
let tunnel_is_local tunnel =
List.fold_left
(fun a pif -> Db.Tunnel.get_access_PIF ~__context ~self:tunnel = pif || a)
false local_pifs
List.exists
(fun pif -> Db.Tunnel.get_access_PIF ~__context ~self:tunnel = pif)
local_pifs
in
let bonds = List.filter bond_is_local (Db.Bond.get_all ~__context) in
List.iter
Expand Down
Loading