Skip to content

Commit ea89a26

Browse files
committed
Add Xapi_globs.ha_best_effort_max_retries to eliminate hard-coding
Signed-off-by: Ming Lu <[email protected]>
1 parent 3dd583a commit ea89a26

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

ocaml/xapi/xapi_globs.ml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,10 @@ let xapi_clusterd_port = ref 8896
436436
*)
437437
let local_yum_repo_port = ref 8000
438438

439+
(* The maximum number of start attempts for HA best-effort VMs. Each attempt is
440+
spaced 20 seconds apart. *)
441+
let ha_best_effort_max_retries = ref 2
442+
439443
(* When a host is known to be shutting down or rebooting, we add it's reference in here.
440444
This can be used to force the Host_metrics.live flag to false. *)
441445
let hosts_which_are_shutting_down : API.ref_host list ref = ref []
@@ -1238,6 +1242,7 @@ let xapi_globs_spec =
12381242
; ("max_observer_file_size", Int max_observer_file_size)
12391243
; ("test-open", Int test_open) (* for consistency with xenopsd *)
12401244
; ("local_yum_repo_port", Int local_yum_repo_port)
1245+
; ("ha_best_effort_max_retries", Int ha_best_effort_max_retries)
12411246
]
12421247

12431248
let xapi_globs_spec_with_descriptions =

ocaml/xapi/xapi_ha_vm_failover.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1654,7 +1654,10 @@ let restart_auto_run_vms ~__context ~last_live_set ~live_set n =
16541654
tried_best_eff_vms :=
16551655
VMMap.update vm
16561656
(Option.fold ~none:(Some 1) ~some:(fun n ->
1657-
if n < 2 then Some (n + 1) else None
1657+
if n < !Xapi_globs.ha_best_effort_max_retries then
1658+
Some (n + 1)
1659+
else
1660+
None
16581661
)
16591662
)
16601663
!tried_best_eff_vms ;

0 commit comments

Comments
 (0)