@@ -1223,12 +1223,13 @@ let assert_configuration_change_preserves_ha_plan ~__context c =
12231223 " assert_configuration_change_preserves_ha_plan: plan exists after \
12241224 change"
12251225 | Plan_exists_excluding_non_agile_VMs | No_plan_exists ->
1226- debug
1226+ let reason =
12271227 " assert_configuration_change_preserves_ha_plan: proposed change \
1228- breaks plan" ;
1228+ breaks plan"
1229+ in
12291230 raise
1230- ( Api_errors. Server_error
1231- ( Api_errors. ha_operation_would_break_failover_plan, [] )
1231+ Api_errors. (
1232+ Server_error ( ha_operation_would_break_failover_plan, [reason ])
12321233 )
12331234 )
12341235
@@ -1413,16 +1414,19 @@ let restart_auto_run_vms ~__context ~last_live_set ~live_set n =
14131414 let open TaskChains.Infix in
14141415 (* execute the plan *)
14151416 Helpers. call_api_functions ~__context (fun rpc session_id ->
1416- (* Helper function to start a VM somewhere. If the HA overcommit protection stops us then disable it and try once more.
1417- Returns true if the VM was restarted and false otherwise. *)
1417+ (* Helper function to start a VM somewhere. If the HA overcommit
1418+ protection stops us then disable it and try once more. Returns true if
1419+ the VM was restarted and false otherwise. *)
14181420 let restart_vm vm ?host () =
14191421 let go () =
14201422 ( if Xapi_fist. simulate_restart_failure () then
14211423 match Random. int 3 with
14221424 | 0 ->
1425+ let reason = " Simulated restart failure" in
14231426 raise
1424- (Api_errors. Server_error
1425- (Api_errors. ha_operation_would_break_failover_plan, [] )
1427+ Api_errors. (
1428+ Server_error
1429+ (ha_operation_would_break_failover_plan, [reason])
14261430 )
14271431 | 1 ->
14281432 raise
@@ -1579,10 +1583,11 @@ let restart_auto_run_vms ~__context ~last_live_set ~live_set n =
15791583 in
15801584 gc_table last_start_attempt ;
15811585 gc_table restart_failed ;
1582- (* Consider restarting the best-effort VMs we *think* have failed (but we might get this wrong --
1583- ok since this is 'best-effort'). NOTE we do not use the restart_vm function above as this will mark the
1584- pool as overcommitted if an HA_OPERATION_WOULD_BREAK_FAILOVER_PLAN is received (although this should never
1585- happen it's better safe than sorry) *)
1586+ (* Consider restarting the best-effort VMs we *think* have failed (but we
1587+ might get this wrong -- ok since this is 'best-effort'). NOTE we do
1588+ not use the restart_vm function above as this will mark the pool as
1589+ overcommitted if an HA_OPERATION_WOULD_BREAK_FAILOVER_PLAN is received
1590+ (although this should never happen it's better safe than sorry) *)
15861591 let is_best_effort r =
15871592 r.API. vM_ha_restart_priority = Constants. ha_restart_best_effort
15881593 && r.API. vM_power_state = `Halted
0 commit comments