|
|
cf07b3 |
diff --git a/heartbeat/SAPInstance b/heartbeat/SAPInstance
|
|
|
cf07b3 |
index 510de7b..da394f5 100755
|
|
|
cf07b3 |
--- a/heartbeat/SAPInstance
|
|
|
cf07b3 |
+++ b/heartbeat/SAPInstance
|
|
|
cf07b3 |
@@ -856,7 +856,7 @@ sapinstance_notify() {
|
|
|
cf07b3 |
# that is, when a slave resource was startet after the promote event of a already running master (e.g. node of slave was down)
|
|
|
cf07b3 |
# We also have to make sure to overrule the globaly set resource_stickiness or any fail-count factors => INFINITY
|
|
|
cf07b3 |
local n_uname="$OCF_RESKEY_CRM_meta_notify_demote_uname"
|
|
|
cf07b3 |
- if [ ${n_uname} != ${HOSTNAME} ]; then
|
|
|
cf07b3 |
+ if [ ${n_uname} != ${NODENAME} ]; then
|
|
|
cf07b3 |
${HA_SBIN_DIR}/crm_master -v INFINITY -l reboot
|
|
|
cf07b3 |
fi
|
|
|
cf07b3 |
fi
|
|
|
cf07b3 |
@@ -879,6 +879,7 @@ SAPCONTROL=""
|
|
|
cf07b3 |
DIR_PROFILE=""
|
|
|
cf07b3 |
SAPSTARTPROFILE=""
|
|
|
cf07b3 |
CLONE=0
|
|
|
cf07b3 |
+NODENAME=$(ocf_local_nodename)
|
|
|
cf07b3 |
|
|
|
cf07b3 |
|
|
|
cf07b3 |
if
|
|
|
cf07b3 |
diff --git a/heartbeat/mysql b/heartbeat/mysql
|
|
|
cf07b3 |
index c1c5573..f7eb9f2 100755
|
|
|
cf07b3 |
--- a/heartbeat/mysql
|
|
|
cf07b3 |
+++ b/heartbeat/mysql
|
|
|
cf07b3 |
@@ -137,8 +137,8 @@ MYSQL_OPTIONS_TEST="$MYSQL_OPTIONS_LOCAL --user=$OCF_RESKEY_test_user --password
|
|
|
cf07b3 |
MYSQL_TOO_MANY_CONN_ERR=1040
|
|
|
cf07b3 |
|
|
|
cf07b3 |
CRM_MASTER="${HA_SBIN_DIR}/crm_master -l reboot "
|
|
|
cf07b3 |
-HOSTNAME=`uname -n`
|
|
|
cf07b3 |
-CRM_ATTR="${HA_SBIN_DIR}/crm_attribute -N $HOSTNAME "
|
|
|
cf07b3 |
+NODENAME=$(ocf_local_nodename)
|
|
|
cf07b3 |
+CRM_ATTR="${HA_SBIN_DIR}/crm_attribute -N $NODENAME "
|
|
|
cf07b3 |
INSTANCE_ATTR_NAME=`echo ${OCF_RESOURCE_INSTANCE}| awk -F : '{print $1}'`
|
|
|
cf07b3 |
CRM_ATTR_REPL_INFO="${HA_SBIN_DIR}/crm_attribute --type crm_config --name ${INSTANCE_ATTR_NAME}_REPL_INFO -s mysql_replication"
|
|
|
cf07b3 |
|
|
|
cf07b3 |
@@ -998,7 +998,7 @@ mysql_start() {
|
|
|
cf07b3 |
# node that is just joining the cluster, and the CRM may have
|
|
|
cf07b3 |
# promoted a master before.
|
|
|
cf07b3 |
master_host=`echo $OCF_RESKEY_CRM_meta_notify_master_uname|tr -d " "`
|
|
|
cf07b3 |
- if [ "$master_host" -a "$master_host" != ${HOSTNAME} ]; then
|
|
|
cf07b3 |
+ if [ "$master_host" -a "$master_host" != ${NODENAME} ]; then
|
|
|
cf07b3 |
ocf_log info "Changing MySQL configuration to replicate from $master_host."
|
|
|
cf07b3 |
set_master
|
|
|
cf07b3 |
start_slave
|
|
|
cf07b3 |
@@ -1147,7 +1147,7 @@ mysql_notify() {
|
|
|
cf07b3 |
# time to check whether our replication slave is working
|
|
|
cf07b3 |
# correctly.
|
|
|
cf07b3 |
master_host=`echo $OCF_RESKEY_CRM_meta_notify_promote_uname|tr -d " "`
|
|
|
cf07b3 |
- if [ "$master_host" = ${HOSTNAME} ]; then
|
|
|
cf07b3 |
+ if [ "$master_host" = ${NODENAME} ]; then
|
|
|
cf07b3 |
ocf_log info "This will be the new master, ignoring post-promote notification."
|
|
|
cf07b3 |
else
|
|
|
cf07b3 |
ocf_log info "Resetting replication"
|
|
|
cf07b3 |
@@ -1172,7 +1172,7 @@ mysql_notify() {
|
|
|
cf07b3 |
;;
|
|
|
cf07b3 |
'pre-demote')
|
|
|
cf07b3 |
demote_host=`echo $OCF_RESKEY_CRM_meta_notify_demote_uname|tr -d " "`
|
|
|
cf07b3 |
- if [ $demote_host = ${HOSTNAME} ]; then
|
|
|
cf07b3 |
+ if [ $demote_host = ${NODENAME} ]; then
|
|
|
cf07b3 |
ocf_log info "post-demote notification for $demote_host"
|
|
|
cf07b3 |
set_read_only on
|
|
|
cf07b3 |
if [ $? -ne 0 ]; then
|
|
|
cf07b3 |
@@ -1199,7 +1199,7 @@ mysql_notify() {
|
|
|
cf07b3 |
;;
|
|
|
cf07b3 |
'post-demote')
|
|
|
cf07b3 |
demote_host=`echo $OCF_RESKEY_CRM_meta_notify_demote_uname|tr -d " "`
|
|
|
cf07b3 |
- if [ $demote_host = ${HOSTNAME} ]; then
|
|
|
cf07b3 |
+ if [ $demote_host = ${NODENAME} ]; then
|
|
|
cf07b3 |
ocf_log info "Ignoring post-demote notification for my own demotion."
|
|
|
cf07b3 |
return $OCF_SUCCESS
|
|
|
cf07b3 |
fi
|
|
|
cf07b3 |
diff --git a/heartbeat/ocf-shellfuncs.in b/heartbeat/ocf-shellfuncs.in
|
|
|
cf07b3 |
index 35b0a5a..1406c80 100644
|
|
|
cf07b3 |
--- a/heartbeat/ocf-shellfuncs.in
|
|
|
cf07b3 |
+++ b/heartbeat/ocf-shellfuncs.in
|
|
|
cf07b3 |
@@ -513,6 +513,25 @@ ocf_version_cmp() {
|
|
|
cf07b3 |
fi
|
|
|
cf07b3 |
}
|
|
|
cf07b3 |
|
|
|
cf07b3 |
+ocf_local_nodename() {
|
|
|
cf07b3 |
+ # use crm_node -n for pacemaker > 1.1.8
|
|
|
cf07b3 |
+ which pacemakerd > /dev/null 2>&1
|
|
|
cf07b3 |
+ if [ $? -eq 0 ]; then
|
|
|
cf07b3 |
+ local version=$(pacemakerd -$ | grep "Pacemaker .*" | awk '{ print $2 }')
|
|
|
cf07b3 |
+ ocf_version_cmp "$version" "1.1.8"
|
|
|
cf07b3 |
+ if [ $? -eq 2 ]; then
|
|
|
cf07b3 |
+ which crm_node > /dev/null 2>&1
|
|
|
cf07b3 |
+ if [ $? -eq 0 ]; then
|
|
|
cf07b3 |
+ crm_node -n
|
|
|
cf07b3 |
+ return
|
|
|
cf07b3 |
+ fi
|
|
|
cf07b3 |
+ fi
|
|
|
cf07b3 |
+ fi
|
|
|
cf07b3 |
+
|
|
|
cf07b3 |
+ # otherwise use uname -n
|
|
|
cf07b3 |
+ uname -n
|
|
|
cf07b3 |
+}
|
|
|
cf07b3 |
+
|
|
|
cf07b3 |
# usage: dirname DIR
|
|
|
cf07b3 |
dirname()
|
|
|
cf07b3 |
{
|
|
|
cf07b3 |
diff --git a/heartbeat/pgsql b/heartbeat/pgsql
|
|
|
cf07b3 |
index 14fdfa6..b6b54b0 100755
|
|
|
cf07b3 |
--- a/heartbeat/pgsql
|
|
|
cf07b3 |
+++ b/heartbeat/pgsql
|
|
|
cf07b3 |
@@ -1734,7 +1734,7 @@ BACKUPLABEL=${OCF_RESKEY_pgdata}/backup_label
|
|
|
cf07b3 |
RESOURCE_NAME=`echo $OCF_RESOURCE_INSTANCE | cut -d ":" -f 1`
|
|
|
cf07b3 |
PGSQL_WAL_RECEIVER_STATUS_ATTR="${RESOURCE_NAME}-receiver-status"
|
|
|
cf07b3 |
RECOVERY_CONF=${OCF_RESKEY_pgdata}/recovery.conf
|
|
|
cf07b3 |
-NODENAME=`uname -n | tr '[A-Z]' '[a-z]'`
|
|
|
cf07b3 |
+NODENAME=$(ocf_local_nodename | tr '[A-Z]' '[a-z]')
|
|
|
cf07b3 |
|
|
|
cf07b3 |
if is_replication; then
|
|
|
cf07b3 |
REP_MODE_CONF=${OCF_RESKEY_tmpdir}/rep_mode.conf
|
|
|
cf07b3 |
|