Skip to content

Commit

Permalink
Merge pull request #5432 from Vincent-lau/private/shul2/cluster-healt…
Browse files Browse the repository at this point in the history
…h-flag

Refactor cluster_health flag checking
  • Loading branch information
robhoes authored Feb 6, 2024
2 parents 2ee9b21 + 3dd0932 commit b7515cc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 5 additions & 0 deletions ocaml/xapi/xapi_cluster_helpers.ml
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,8 @@ let with_cluster_operation ~__context ~(self : [`Cluster] API.Ref.t) ~doc ~op
(Datamodel_common._cluster, Ref.string_of self)
with _ -> ()
)

let cluster_health_enabled ~__context =
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"
7 changes: 1 addition & 6 deletions ocaml/xapi/xapi_clustering.ml
Original file line number Diff line number Diff line change
Expand Up @@ -515,12 +515,7 @@ let create_cluster_watcher_on_master ~__context ~host =
Thread.delay 3.
done
in
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 (
if Xapi_cluster_helpers.cluster_health_enabled ~__context then (
debug "%s: create watcher for corosync-notifyd on master" __FUNCTION__ ;
ignore @@ Thread.create watch ()
) else
Expand Down

0 comments on commit b7515cc

Please sign in to comment.