@@ -225,7 +225,7 @@ let compute_evacuation_plan_no_wlb ~__context ~host =
225225 then
226226 begin
227227 List. iter (fun (vm , _ ) ->
228- Hashtbl. add plans vm (Error (Api_errors. no_hosts_available, [ Ref. string_of vm ])))
228+ Hashtbl. replace plans vm (Error (Api_errors. no_hosts_available, [ Ref. string_of vm ])))
229229 all_user_vms ;
230230 plans
231231 end
@@ -269,8 +269,8 @@ let compute_evacuation_plan_no_wlb ~__context ~host =
269269 let plan = Xapi_ha_vm_failover. compute_evacuation_plan ~__context (List. length all_hosts) target_hosts migratable_vms in
270270 (* Check if the plan was actually complete: if some VMs are missing it means there wasn't enough memory *)
271271 let vms_handled = List. map fst plan in
272- let vms_missing = List. filter (fun x -> not (List. mem x vms_handled)) (List. map fst protected_vms ) in
273- List. iter (fun vm -> Hashtbl. add plans vm (Error (Api_errors. host_not_enough_free_memory, [ Ref. string_of vm ]))) vms_missing;
272+ let vms_missing = List. filter (fun x -> not (List. mem x vms_handled)) (List. map fst migratable_vms ) in
273+ List. iter (fun vm -> Hashtbl. replace plans vm (Error (Api_errors. host_not_enough_free_memory, [ Ref. string_of vm ]))) vms_missing;
274274
275275 (* Now for each VM we did place, verify storage and network visibility. *)
276276 List. iter (fun (vm , host ) ->
@@ -279,7 +279,7 @@ let compute_evacuation_plan_no_wlb ~__context ~host =
279279 try Xapi_vm_helpers. assert_can_boot_here ~__context ~self: vm ~host ~snapshot ~do_memory_check: false ()
280280 with (Api_errors. Server_error (code , params )) -> Hashtbl. replace plans vm (Error (code, params))
281281 end ;
282- if not (Hashtbl. mem plans vm) then Hashtbl. add plans vm (Migrate host)
282+ if not (Hashtbl. mem plans vm) then Hashtbl. replace plans vm (Migrate host)
283283 ) plan;
284284 plans
285285 end
0 commit comments