Add monitor_host option with its monitor_interval option to decide whether to configure the Ping service. This service will ping a provided network IP address to check whether connectivity exists and determine whether networking is working.
This commit is contained in:
parent
eea6d3e39b
commit
bc8b401891
13
config.yaml
13
config.yaml
@ -41,3 +41,16 @@ options:
|
||||
type: int
|
||||
default: 2
|
||||
description: Number of peer units required to bootstrap cluster services.
|
||||
monitor_host:
|
||||
type: string
|
||||
description: |
|
||||
One or more IPs, separated by space, that will be used as a saftey check
|
||||
for avoiding split brain situations. Nodes in the cluster will ping these
|
||||
IPs periodicaly. Node that can not ping monitor_host will not run shared
|
||||
resources (VIP, shared disk...).
|
||||
monitor_interval:
|
||||
type: string
|
||||
default: 5s
|
||||
description: |
|
||||
Time period between checks of resource health. It consists of a number
|
||||
and a time factor, e.g. 5s = 5 seconds. 2m = 2 minutes.
|
||||
|
@ -226,6 +226,19 @@ def configure_cluster():
|
||||
' resource-stickiness="100"'
|
||||
pcmk.commit(cmd)
|
||||
|
||||
# Configure Ping service
|
||||
monitor_host = utils.config_get('monitor_host')
|
||||
if monitor_host:
|
||||
cmd = 'crm -F configure primitive Ping' \
|
||||
' ocf:pacemaker:ping params host_list="%s"' \
|
||||
' multiplier="100" op monitor interval="%s"' %\
|
||||
(monitor_host,
|
||||
monitor_interval)
|
||||
cmd2 = 'crm -F configure clone PingClone Ping' \
|
||||
' meta interleave="true"'
|
||||
pcmk.commit(cmd)
|
||||
pcmk.commit(cmd2)
|
||||
|
||||
# Only configure the cluster resources
|
||||
# from the oldest peer unit.
|
||||
if cluster.oldest_peer(cluster.peer_units()):
|
||||
@ -256,6 +269,10 @@ def configure_cluster():
|
||||
resource_params[res_name])
|
||||
pcmk.commit(cmd)
|
||||
utils.juju_log('INFO', '%s' % cmd)
|
||||
if monitor_host:
|
||||
cmd = 'crm -F configure location Ping-%s %s rule' \
|
||||
' -inf: pingd lte 0' % (res_name, res_name)
|
||||
pcmk.commit(cmd)
|
||||
|
||||
utils.juju_log('INFO', 'Configuring Groups')
|
||||
utils.juju_log('INFO', str(groups))
|
||||
|
Loading…
Reference in New Issue
Block a user