Skip to content

Commit

Permalink
Only start cluster watcher if cluster_health feature enabled
Browse files Browse the repository at this point in the history
This is an experimental feature, which is disabled by default.
It can be enabled by running:

    echo 1 > /etc/xenserver/features.d/cluster_health

and restarting xapi.

Signed-off-by: Rob Hoes <[email protected]>
  • Loading branch information
robhoes committed Jan 24, 2024
1 parent 8ab1fe3 commit c8c6625
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions ocaml/xapi/xapi_clustering.ml
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ let on_corosync_update ~__context ~cluster updates =
__FUNCTION__ (Printexc.to_string exn)

let create_cluster_watcher_on_master ~__context ~host =
if Helpers.is_pool_master ~__context ~host then (
if Helpers.is_pool_master ~__context ~host then
let watch () =
while !Daemon.enabled do
let m =
Expand Down Expand Up @@ -515,6 +515,16 @@ let create_cluster_watcher_on_master ~__context ~host =
Thread.delay 3.
done
in
debug "%s: create watcher for corosync-notifyd on master" __FUNCTION__ ;
ignore @@ Thread.create watch ()
)
let feature_enabled =
let pool = Helpers.get_pool ~__context in
let restrictions = Db.Pool.get_restrictions ~__context ~self:pool in
List.assoc_opt "restrict_cluster_health" restrictions = Some "false"
in
if feature_enabled then (
debug "%s: create watcher for corosync-notifyd on master" __FUNCTION__ ;
ignore @@ Thread.create watch ()
) else
debug
"%s: not creating watcher for corosync-notifyd: feature cluster_health \
not enabled"
__FUNCTION__

0 comments on commit c8c6625

Please sign in to comment.