From 336a029d14260ec3d82af43d14c6d490b97c03fd Mon Sep 17 00:00:00 2001 From: Pau Ruiz Safont Date: Thu, 20 Jun 2024 11:39:57 +0100 Subject: [PATCH] fixup! CA-390277: Stop using records on CLI cross-pool migrations --- ocaml/xapi-cli-server/cli_operations.ml | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/ocaml/xapi-cli-server/cli_operations.ml b/ocaml/xapi-cli-server/cli_operations.ml index f1120b21e6..2f0f172eb5 100644 --- a/ocaml/xapi-cli-server/cli_operations.ml +++ b/ocaml/xapi-cli-server/cli_operations.ml @@ -4330,10 +4330,10 @@ let vm_migrate printer rpc session_id params = ) in let all_hosts = remote Client.Host.get_all in - match List.filter matches all_hosts with - | host :: _ -> + match List.find_opt matches all_hosts with + | Some host -> host - | [] -> + | None -> failwith fail_msg in let network = @@ -4346,29 +4346,28 @@ let vm_migrate printer rpc session_id params = match List.assoc_opt "remote-network" params with | Some x -> ( let all_networks = remote Client.Network.get_all in - match List.filter (network_matches x) all_networks with - | network :: _ -> + match List.find_opt (network_matches x) all_networks with + | Some network -> network - | [] -> + | None -> failwith (Printf.sprintf "Failed to find network: %s" x) ) | None -> ( let pifs = remote (Client.Host.get_PIFs ~self:host) in - let management_pifs = - List.filter + let management_pif = + List.find_opt (fun self -> remote (Client.PIF.get_management ~self)) pifs in - match management_pifs with - | [] -> + match management_pif with + | None -> let host_uuid = remote (Client.Host.get_uuid ~self:host) in failwith (Printf.sprintf "Could not find management PIF on host %s" host_uuid ) - | pif :: _ -> - let net = remote (Client.PIF.get_network ~self:pif) in - net + | Some pif -> + remote (Client.PIF.get_network ~self:pif) ) in let vif_map =