ocf_exit_reason "local node <${NODENAME}> must be a member of the wsrep_cluster_address <${OCF_RESKEY_wsrep_cluster_address}>to start this galera instance"
return $OCF_ERR_CONFIGURED
fi
galera_status info
if [ $? -ne $OCF_NOT_RUNNING ]; then
ocf_exit_reason "master galera instance started outside of the cluster's control"
return $OCF_ERR_GENERIC
fi
mysql_common_prepare_dirs
detect_last_commit
rc=$?
if [ $rc -ne $OCF_SUCCESS ]; then
return $rc
fi
master_exists
if [ $? -eq 0 ]; then
ocf_log info "Master instances are already up, local node will join in when started"
else
clear_master_score
detect_first_master
fi
return $OCF_SUCCESS
}
galera_monitor()
{
local rc
local status_loglevel="err"
# Set loglevel to info during probe
if ocf_is_probe; then
status_loglevel="info"
fi
# Check whether mysql is running or about to start after sync
galera_status $status_loglevel
rc=$?
if [ $rc -eq $OCF_NOT_RUNNING ]; then
last_commit=$(get_last_commit $NODENAME)
if [ -n "$last_commit" ];then
rc=$OCF_SUCCESS
if ocf_is_probe; then
# prevent state change during probe
return $rc
fi
master_exists
if [ $? -ne 0 ]; then
detect_first_master
else
# a master instance exists and is healthy.
# start this node and mark it as "pending sync"
ocf_log info "cluster is running. start local node to join in"
galera_start_local_node
rc=$?
fi
fi
return $rc
elif [ $rc -ne $OCF_SUCCESS ]; then
return $rc
fi
# if we make it here, mysql is running or about to start after sync.