[hopem,r=]
Provide min-cluster-size config option to get round clustering races until we have leadership election support in Juju.
This commit is contained in:
parent
4c3a18856d
commit
5648312ec9
@ -166,3 +166,9 @@ options:
|
||||
order for this charm to function correctly, the privacy extension must be
|
||||
disabled and a non-temporary address must be configured/available on
|
||||
your network interface.
|
||||
min-cluster-size:
|
||||
type: int
|
||||
default:
|
||||
description: |
|
||||
Minimum number of units expected to exist before charm will attempt to
|
||||
form a cluster.
|
||||
|
@ -276,6 +276,18 @@ def cluster_changed():
|
||||
if rabbit.cluster_with():
|
||||
# resync nrpe user after clustering
|
||||
update_nrpe_checks()
|
||||
|
||||
min_size = config('min-cluster-size')
|
||||
if min_size:
|
||||
size = 0
|
||||
for rid in relation_ids('cluster'):
|
||||
size = len(related_units(rid))
|
||||
|
||||
if min_size != size:
|
||||
log("Not enough units to form cluster (required=%s, got=%s)" %
|
||||
(min_size, size), level=INFO)
|
||||
return
|
||||
|
||||
# If cluster has changed peer db may have changed so run amqp_changed
|
||||
# to sync any changes
|
||||
for rid in relation_ids('amqp'):
|
||||
|
Loading…
Reference in New Issue
Block a user