Skip to content

Commit

Permalink
fixup! CA-390277: Stop using records on CLI cross-pool migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
psafont committed Jun 25, 2024
1 parent 958f58c commit 6327abd
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions ocaml/xapi-cli-server/cli_operations.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4464,32 +4464,33 @@ let vm_migrate printer rpc session_id params =
remote (Client.SR.get_physical_utilisation ~self)
in
let shared self = remote (Client.SR.get_shared ~self) in
let sr, _ =
let sr, _, _ =
List.fold_left
(fun (sr, free_space) sr' ->
(fun (sr, sr_shared, free_space) sr' ->
if is_iso sr' then
(sr, free_space)
(sr, sr_shared, free_space)
else
let free_space' =
Int64.sub (physical_size sr') (physical_utilisation sr')
in
match sr with
| None ->
(Some sr', free_space')
let shared' = shared sr' in
(Some sr', shared', free_space')
| Some sr -> (
match (shared sr, shared sr') with
match (sr_shared, shared sr') with
| true, false ->
(Some sr, free_space)
(Some sr, true, free_space)
| false, true ->
(Some sr', free_space')
| _ ->
(Some sr', true, free_space')
| shared, _ ->
if free_space' > free_space then
(Some sr', free_space')
(Some sr', shared, free_space')
else
(Some sr, free_space)
(Some sr, shared, free_space)
)
)
(None, Int64.zero) srs
(None, false, Int64.zero) srs
in
sr
with _ -> None
Expand Down

0 comments on commit 6327abd

Please sign in to comment.