Skip to content

Commit 7c4fc42

Browse files
committed
Revert "CA-220610: Changed host.get_vms_which_prevent_evacutation to return a map with unique keys"
This reverts commit 8db0f66. The call should have only retuned one error per VM anyway. Signed-off-by: Jon Ludlam <[email protected]> (cherry picked from commit f1f98a2)
1 parent d052406 commit 7c4fc42

File tree

5 files changed

+2
-39
lines changed

5 files changed

+2
-39
lines changed

ocaml/idl/datamodel.ml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2884,25 +2884,11 @@ let host_get_vms_which_prevent_evacuation = call
28842884
~in_product_since:rel_orlando
28852885
~name:"get_vms_which_prevent_evacuation"
28862886
~doc:"Return a set of VMs which prevent the host being evacuated, with per-VM error codes"
2887-
~lifecycle:[
2888-
Published, rel_orlando, "The call returns for each VM all the reasons why a host cannot be evacuated";
2889-
Changed, rel_ely, "The call now retuns only one reason per VM."
2890-
]
28912887
~params:[Ref _host, "self", "The host to query"]
28922888
~result:(Map(Ref _vm, Set(String)), "VMs which block evacuation together with reasons")
28932889
~allowed_roles:_R_READ_ONLY
28942890
()
28952891

2896-
let host_get_vms_which_prevent_evacuation_all = call
2897-
~in_product_since:rel_ely
2898-
~name:"get_vms_which_prevent_evacuation_all"
2899-
~doc:"Return a set of VMs which prevent the host being evacuated, with per-VM error codes. This call returns for each VM all the reasons why a host cannot be evacuated."
2900-
~params:[Ref _host, "self", "The host to query"]
2901-
~hide_from_docs:true
2902-
~result:(Map(Ref _vm, Set(String)), "VMs which block evacuation together with reasons")
2903-
~allowed_roles:_R_READ_ONLY
2904-
()
2905-
29062892
let host_evacuate = call
29072893
~in_product_since:rel_miami
29082894
~name:"evacuate"
@@ -4857,7 +4843,6 @@ let host =
48574843
host_forget_data_source_archives;
48584844
host_assert_can_evacuate;
48594845
host_get_vms_which_prevent_evacuation;
4860-
host_get_vms_which_prevent_evacuation_all;
48614846
host_get_uncooperative_resident_VMs;
48624847
host_get_uncooperative_domains;
48634848
host_evacuate;

ocaml/xapi/cli_operations.ml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3170,10 +3170,7 @@ let host_evacuate printer rpc session_id params =
31703170
let host_get_vms_which_prevent_evacuation printer rpc session_id params =
31713171
let uuid = List.assoc "uuid" params in
31723172
let host = Client.Host.get_by_uuid rpc session_id uuid in
3173-
(* Although the API call get_vms_which_prevent_evacuation was changed within CA-220610
3174-
to return per VM only one reason why the host cannot be evacuated, it was decided
3175-
the CLI call should still return all the reasons *)
3176-
let vms = Client.Host.get_vms_which_prevent_evacuation_all rpc session_id host in
3173+
let vms = Client.Host.get_vms_which_prevent_evacuation rpc session_id host in
31773174

31783175
let op (vm, error) =
31793176
let error = String.concat "," error in

ocaml/xapi/message_forwarding.ml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2278,10 +2278,6 @@ module Forward = functor(Local: Custom_actions.CUSTOM_ACTIONS) -> struct
22782278
info "Host.get_vms_which_prevent_evacuation: host = '%s'" (host_uuid ~__context self);
22792279
Local.Host.get_vms_which_prevent_evacuation ~__context ~self
22802280

2281-
let get_vms_which_prevent_evacuation_all ~__context ~self =
2282-
info "Host.get_vms_which_prevent_evacuation_all: host = '%s'" (host_uuid ~__context self);
2283-
Local.Host.get_vms_which_prevent_evacuation_all ~__context ~self
2284-
22852281
let evacuate ~__context ~host =
22862282
info "Host.evacuate: host = '%s'" (host_uuid ~__context host);
22872283
(* Block call if this would break our VM restart plan (because the body of this sets enabled to false) *)

ocaml/xapi/xapi_host.ml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -292,22 +292,10 @@ let assert_can_evacuate ~__context ~host =
292292
if errors <> []
293293
then raise (Api_errors.Server_error (Api_errors.cannot_evacuate_host, [ String.concat "|" errors ]))
294294

295-
(* New Orlando style function which returns a Map *)
296-
let get_vms_which_prevent_evacuation_all ~__context ~self =
297-
let plans = compute_evacuation_plan_no_wlb ~__context ~host:self in
298-
Hashtbl.fold (fun vm plan acc -> match plan with Error(code, params) -> (vm, (code :: params)) :: acc | _ -> acc) plans []
299-
300295
(* New Orlando style function which returns a Map *)
301296
let get_vms_which_prevent_evacuation ~__context ~self =
302297
let plans = compute_evacuation_plan_no_wlb ~__context ~host:self in
303-
let get_error_per_vm vm plan acc =
304-
match plan with
305-
| Error(code, params) ->
306-
if List.exists (fun (x,_) -> x = vm) acc then acc
307-
else (vm, (code :: params)) :: acc
308-
| _ -> acc
309-
in
310-
Hashtbl.fold get_error_per_vm plans []
298+
Hashtbl.fold (fun vm plan acc -> match plan with Error(code, params) -> (vm, (code :: params)) :: acc | _ -> acc) plans []
311299

312300
let compute_evacuation_plan_wlb ~__context ~self =
313301
(* We treat xapi as primary when it comes to "hard" errors, i.e. those that aren't down to memory constraints. These are things like

ocaml/xapi/xapi_host.mli

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ val notify : __context:Context.t -> ty:string -> params:string -> unit
4242
val assert_can_evacuate : __context:Context.t -> host:API.ref_host -> unit
4343
val get_vms_which_prevent_evacuation :
4444
__context:Context.t -> self:API.ref_host -> (API.ref_VM * string list) list
45-
val get_vms_which_prevent_evacuation_all :
46-
__context:Context.t -> self:API.ref_host -> (API.ref_VM * string list) list
47-
4845
val evacuate : __context:Context.t -> host:API.ref_host -> unit
4946
val retrieve_wlb_evacuate_recommendations :
5047
__context:Context.t -> self:API.ref_host -> (API.ref_VM * string list) list

0 commit comments

Comments
 (0)