[Debian-ha-commits] [resource-agents] 01/04: New upstream version 4.0.1

Valentin Vidic vvidic-guest at moszumanska.debian.org
Wed Mar 22 08:58:10 UTC 2017


This is an automated email from the git hooks/post-receive script.

vvidic-guest pushed a commit to branch master
in repository resource-agents.

commit 72a7379dd64fa3210f78d13eedb048dce2deebf2
Author: Valentin Vidic <Valentin.Vidic at CARNet.hr>
Date:   Wed Mar 22 09:21:14 2017 +0100

    New upstream version 4.0.1
---
 ChangeLog                   |  17 ++
 configure.ac                |   2 +-
 heartbeat/Filesystem        |   6 +-
 heartbeat/IPaddr2           |  30 ++-
 heartbeat/LVM               |   6 +-
 heartbeat/exportfs          |   9 +-
 heartbeat/galera            | 449 +++++++++++++++++---------------------------
 heartbeat/nfsserver         |   2 +-
 heartbeat/nginx             |   2 +-
 heartbeat/ocf-shellfuncs.in |   2 +-
 heartbeat/pgsql             |   2 +-
 heartbeat/rabbitmq-cluster  | 130 +++++++------
 heartbeat/redis             |  11 ++
 heartbeat/scsi2reservation  |   2 +-
 resource-agents.spec.in     |   1 +
 15 files changed, 308 insertions(+), 363 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index dcdae56..bed973c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+* Thu Feb  2 2017 resource-agents contributors
+- stable release 4.0.1
+- galera: remove "long SST monitoring" support due to corner-case issues
+- exportfs: improve regexp handling of clientspec (only strip brackets from edges to support IPv6)
+
+* Tue Jan 31 2017 resource-agents contributors
+- stable release 4.0.0
+- LVM: fix partial activation detection
+- Filesystem: add ZFS support
+- specfile: add metadata.rng
+- redis: use "CLIENT KILL type normal" to notify clients of master being demoted
+- IPaddr2: add IPv4 collision detection
+- galera: add "cluster_host_map" parameter to map Pacemaker hostnames to Galera hostnames
+- multiple RA: fix grammar, spelling and typos
+- pgsql: add support for PostgreSQL 9.6
+- rabbitmq-cluster: reset Mnesia and fetch data when joining cluster
+
 * Tue Jan 10 2017 resource-agents contributors
 - release candidate 4.0.0 rc1
 - CI: add metadata verification
diff --git a/configure.ac b/configure.ac
index 9afee62..3bb0b7d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -901,7 +901,7 @@ dnl *****************
 AC_MSG_RESULT([])
 AC_MSG_RESULT([$PACKAGE configuration:])
 AC_MSG_RESULT([  Version                  = ${VERSION}])
-AC_MSG_RESULT([  Build Version            = 18222e08b4a70df8ae561b3460dcdf8bce0f6c63])
+AC_MSG_RESULT([  Build Version            = 150fb85f2a442f53157fb8063089817e6ee05b00])
 AC_MSG_RESULT([  Features                 =${PKG_FEATURES}])
 AC_MSG_RESULT([])
 AC_MSG_RESULT([  Prefix                   = ${prefix}])
diff --git a/heartbeat/Filesystem b/heartbeat/Filesystem
index 4b9b3f0..145be49 100755
--- a/heartbeat/Filesystem
+++ b/heartbeat/Filesystem
@@ -275,7 +275,7 @@ determine_blockdevice() {
 	# Get the current real device name, if possible.
 	# (specified devname could be -L or -U...)
 	case "$FSTYPE" in
-	nfs4|nfs|smbfs|cifs|glusterfs|ceph|tmpfs|overlay|overlayfs|rozofs|none)
+	nfs4|nfs|smbfs|cifs|glusterfs|ceph|tmpfs|overlay|overlayfs|rozofs|zfs|none)
 		: ;;
 	*)
 		DEVICE=`list_mounts | grep " $MOUNTPOINT " | cut -d' ' -f1`
@@ -326,7 +326,7 @@ is_fsck_needed() {
 		no)    false;;
 		""|auto)
 		case $FSTYPE in
-			ext4|ext4dev|ext3|reiserfs|reiser4|nss|xfs|jfs|vfat|fat|nfs4|nfs|cifs|smbfs|ocfs2|gfs2|none|lustre|glusterfs|ceph|tmpfs|overlay|overlayfs|rozofs)
+			ext4|ext4dev|ext3|reiserfs|reiser4|nss|xfs|jfs|vfat|fat|nfs4|nfs|cifs|smbfs|ocfs2|gfs2|none|lustre|glusterfs|ceph|tmpfs|overlay|overlayfs|rozofs|zfs)
 			false;;
 			*)
 			true;;
@@ -730,7 +730,7 @@ set_blockdevice_var() {
 
 	# these are definitely not block devices
 	case $FSTYPE in
-	nfs4|nfs|smbfs|cifs|none|glusterfs|ceph|tmpfs|overlay|overlayfs|rozofs) return;;
+	nfs4|nfs|smbfs|cifs|none|glusterfs|ceph|tmpfs|overlay|overlayfs|rozofs|zfs) return;;
 	esac
 
 	if `is_option "loop"`; then
diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2
index b416e31..27b7208 100755
--- a/heartbeat/IPaddr2
+++ b/heartbeat/IPaddr2
@@ -79,6 +79,7 @@ OCF_RESKEY_arp_count_default=5
 OCF_RESKEY_arp_count_refresh_default=0
 OCF_RESKEY_arp_bg_default=true
 OCF_RESKEY_arp_mac_default="ffffffffffff"
+OCF_RESKEY_run_arping_default=false
 
 : ${OCF_RESKEY_lvs_support=${OCF_RESKEY_lvs_support_default}}
 : ${OCF_RESKEY_lvs_ipv6_addrlabel=${OCF_RESKEY_lvs_ipv6_addrlabel_default}}
@@ -90,6 +91,7 @@ OCF_RESKEY_arp_mac_default="ffffffffffff"
 : ${OCF_RESKEY_arp_count_refresh=${OCF_RESKEY_arp_count_refresh_default}}
 : ${OCF_RESKEY_arp_bg=${OCF_RESKEY_arp_bg_default}}
 : ${OCF_RESKEY_arp_mac=${OCF_RESKEY_arp_mac_default}}
+: ${OCF_RESKEY_run_arping=${OCF_RESKEY_run_arping_default}}
 #######################################################################
 
 SENDARP=$HA_BIN/send_arp
@@ -340,6 +342,14 @@ IP address goes away.
 <content type="boolean" default="false"/>
 </parameter>
 
+<parameter name="run_arping">
+<longdesc lang="en">
+Whether or not to run arping for IPv4 collision detection check.
+</longdesc>
+<shortdesc lang="en">Run arping for IPv4 collision detection check</shortdesc>
+<content type="string" default="${OCF_RESKEY_run_arping_default}"/>
+</parameter>
+
 </parameters>
 <actions>
 <action name="start"   timeout="20s" />
@@ -556,6 +566,15 @@ add_interface () {
 	iface="$4"
 	label="$5"
 
+	if [ "$FAMILY" = "inet" ] && ocf_is_true $OCF_RESKEY_run_arping &&
+	   check_binary arping; then
+		arping -q -c 2 -w 3 -D -I $iface $ipaddr
+		if [ $? = 1 ]; then
+			ocf_log err "IPv4 address collision $ipaddr [DAD]"
+			return $OCF_ERR_CONFIGURED
+		fi
+	fi
+
 	if [ "$FAMILY" = "inet6" ] && ocf_is_true $OCF_RESKEY_lvs_ipv6_addrlabel ;then
 	    add_ipv6_addrlabel $ipaddr
 	fi
@@ -722,7 +741,7 @@ run_send_ua() {
 			;;
 		*tentative*)
 			if [ $i -eq 10 ]; then
-				ofc_log warn "IPv6 address : DAD is still in tentative"
+				ocf_log warn "IPv6 address : DAD is still in tentative"
 			fi
 			;;
 		*)
@@ -877,10 +896,11 @@ ip_start() {
 		fi
 		
 		add_interface $OCF_RESKEY_ip $NETMASK ${BRDCAST:-none} $NIC $IFLABEL
-		
-		if [ $? -ne 0 ]; then
-			ocf_exit_reason "$CMD failed."
-			exit $OCF_ERR_GENERIC
+		rc=$?
+
+		if [ $rc -ne $OCF_SUCCESS ]; then
+			ocf_exit_reason "Failed to add $OCF_RESKEY_ip"
+			exit $rc
 		fi
 	fi
 
diff --git a/heartbeat/LVM b/heartbeat/LVM
index 79c2791..90a900b 100755
--- a/heartbeat/LVM
+++ b/heartbeat/LVM
@@ -548,7 +548,8 @@ LVM_validate_all() {
 		# "unknown device" then another node may have marked a device missing 
 		# where we have access to all of them and can start without issue. 
 		if vgs -o pv_attr --noheadings $OCF_RESKEY_volgrpname 2>/dev/null | grep 'm' > /dev/null 2>&1; then
-			if vgs -o pv_name --noheadings $OCF_RESKEY_volgrpname 2>/dev/null | grep -E "unknown device|Couldn't find device|Device mismatch detected" > /dev/null 2>&1; then
+			case $(vgs -o attr --noheadings $OCF_RESKEY_volgrpname | tr -d ' ') in
+			???p??*)
 				if ! ocf_is_true "$OCF_RESKEY_partial_activation" ; then
 					# We are missing devices and cannot activate partially
 					ocf_exit_reason "Volume group [$VOLUME] has devices missing.  Consider partial_activation=true to attempt to activate partially"
@@ -558,7 +559,8 @@ LVM_validate_all() {
 					# Assume that caused the vgck failure and carry on
 					ocf_log warn "Volume group inconsistency detected with missing device(s) and partial_activation enabled.  Proceeding with requested action."
 				fi
-			fi
+				;;
+			esac
 			# else the vg is partial but all devices are accounted for, so another 
 			# node must have marked the device missing.  Proceed.
 		else
diff --git a/heartbeat/exportfs b/heartbeat/exportfs
index c6ea920..4c66b16 100755
--- a/heartbeat/exportfs
+++ b/heartbeat/exportfs
@@ -165,7 +165,7 @@ return $OCF_SUCCESS
 }
 
 exportfs_methods() {
-  cat <<-!
+  cat <<-EOF
 	start
 	stop
 	status
@@ -174,7 +174,7 @@ exportfs_methods() {
 	methods
 	meta-data
 	usage
-	!
+	EOF
 }
 
 reset_fsid() {
@@ -266,11 +266,14 @@ is_exported() {
 
 exportfs_monitor ()
 {
+	local spec
+
 	if ! ha_pseudo_resource "${OCF_RESOURCE_INSTANCE}" monitor; then
 		return $OCF_NOT_RUNNING
 	fi
 
-	if forall is_exported "$(echo "${OCF_RESKEY_clientspec}" | tr -d '[]')"; then
+	spec="$(echo "$OCF_RESKEY_clientspec" | sed -e 's/^\[*//' -e 's/\]*$//')"
+	if forall is_exported "$spec"; then
 		if [ ${OCF_RESKEY_rmtab_backup} != "none" ]; then
 			forall backup_rmtab
 		fi
diff --git a/heartbeat/galera b/heartbeat/galera
index fe2aa8a..0cab9a4 100755
--- a/heartbeat/galera
+++ b/heartbeat/galera
@@ -32,7 +32,7 @@
 # Slave vs Master role:
 #
 # During the 'Slave' role, galera instances are in read-only mode and
-# will not attempt to connect to the cluster. This role exists as
+# will not attempt to connect to the cluster. This role exists only as
 # a means to determine which galera instance is the most up-to-date. The
 # most up-to-date node will be used to bootstrap a galera cluster that
 # has no current members.
@@ -40,12 +40,9 @@
 # The galera instances will only begin to be promoted to the Master role
 # once all the nodes in the 'wsrep_cluster_address' connection address
 # have entered read-only mode. At that point the node containing the
-# database that is most current will be promoted to Master.
-#
-# Once the first Master instance bootstraps the galera cluster, the
-# other nodes will join the cluster and start synchronizing via SST.
-# They will stay in Slave role as long as the SST is running. Their
-# promotion to Master will happen once synchronization is finished.
+# database that is most current will be promoted to Master. Once the first
+# Master instance bootstraps the galera cluster, the other nodes will be
+# promoted to Master as well.
 #
 # Example: Create a galera cluster using nodes rhel7-node1 rhel7-node2 rhel7-node3
 #
@@ -208,13 +205,30 @@ The galera cluster address. This takes the form of:
 gcomm://node,node,node
 
 Only nodes present in this node list will be allowed to start a galera instance.
-It is expected that the galera node names listed in this address match valid
-pacemaker node names.
+The galera node names listed in this address are expected to match valid
+pacemaker node names. If both names need to differ, you must provide a
+mapping in option cluster_host_map.
 </longdesc>
 <shortdesc lang="en">Galera cluster address</shortdesc>
 <content type="string" default=""/>
 </parameter>
 
+<parameter name="cluster_host_map" unique="0" required="0">
+<longdesc lang="en">
+A mapping of pacemaker node names to galera node names.
+
+To be used when both pacemaker and galera names need to differ,
+(e.g. when galera names map to IP from a specific network interface)
+This takes the form of:
+pcmk1:node.1.galera;pcmk2:node.2.galera;pcmk3:node.3.galera
+
+where the galera resource started on node pcmk1 would be named
+node.1.galera in the wsrep_cluster_address
+</longdesc>
+<shortdesc lang="en">Pacemaker to Galera name mapping</shortdesc>
+<content type="string" default=""/>
+</parameter>
+
 <parameter name="check_user" unique="0" required="0">
 <longdesc lang="en">
 Cluster check user.
@@ -330,56 +344,6 @@ wait_for_sync()
     ocf_log info "Database synced."
 }
 
-set_sync_needed()
-{
-    ${HA_SBIN_DIR}/crm_attribute -N $NODENAME -l reboot --name "${INSTANCE_ATTR_NAME}-sync-needed" -v "true"
-}
-
-clear_sync_needed()
-{
-    ${HA_SBIN_DIR}/crm_attribute -N $NODENAME -l reboot --name "${INSTANCE_ATTR_NAME}-sync-needed" -D
-}
-
-check_sync_needed()
-{
-    ${HA_SBIN_DIR}/crm_attribute -N $NODENAME -l reboot --name "${INSTANCE_ATTR_NAME}-sync-needed" -Q 2>/dev/null
-}
-
-
-# this function is called when attribute sync-needed is set in the CIB
-check_sync_status()
-{
-    # if the pidfile is created, mysqld is up and running
-    # an IST might still be in progress, check wsrep status
-    if [ -e $OCF_RESKEY_pid ]; then
-        local cluster_status=$(get_status_variable "wsrep_cluster_status")
-        local state=$(get_status_variable "wsrep_local_state")
-        local ready=$(get_status_variable "wsrep_ready")
-
-        if [ -z "$cluster_status" -o -z "$state" -o -z "$ready" ]; then
-            ocf_exit_reason "Unable to retrieve state transfer status, verify check_user '$OCF_RESKEY_check_user' has permissions to view status"
-            return $OCF_ERR_GENERIC
-        fi
-
-        if [ "$cluster_status" != "Primary" ]; then
-            ocf_exit_reason "local node <${NODENAME}> is started, but not in primary mode. Unknown state."
-            return $OCF_ERR_GENERIC
-        fi
-
-        if [ "$state" = "4" -a "$ready" = "ON" ]; then
-            ocf_log info "local node synced with the cluster"
-            # when sync is finished, we are ready to switch to Master
-            clear_sync_needed
-            set_master_score
-            return $OCF_SUCCESS
-        fi
-    fi
-
-    # if we pass here, an IST or SST is still in progress
-    ocf_log info "local node syncing"
-    return $OCF_SUCCESS
-}
-
 is_primary()
 {
     cluster_status=$(get_status_variable "wsrep_cluster_status")
@@ -447,6 +411,15 @@ set_master_score()
     fi
 }
 
+promote_everyone()
+{
+
+    for node in $(echo "$OCF_RESKEY_wsrep_cluster_address" | sed 's/gcomm:\/\///g' | tr -d ' ' | tr -s ',' ' '); do
+
+        set_master_score $node
+    done
+}
+
 greater_than_equal_long()
 {
     # there are values we need to compare in this script
@@ -454,6 +427,27 @@ greater_than_equal_long()
     echo | awk -v n1="$1" -v n2="$2"  '{if (n1>=n2) printf ("true"); else printf ("false");}' |  grep -q "true"
 }
 
+galera_to_pcmk_name()
+{
+    local galera=$1
+    if [ -z "$OCF_RESKEY_cluster_host_map" ]; then
+        echo $galera
+    else
+        echo "$OCF_RESKEY_cluster_host_map" | tr ';' '\n' | tr -d ' ' | sed 's/:/ /' | awk -F' ' '$2=="'"$galera"'" {print $1;exit}'
+    fi
+}
+
+pcmk_to_galera_name()
+{
+    local pcmk=$1
+    if [ -z "$OCF_RESKEY_cluster_host_map" ]; then
+        echo $pcmk
+    else
+        echo "$OCF_RESKEY_cluster_host_map" | tr ';' '\n' | tr -d ' ' | sed 's/:/ /' | awk -F' ' '$1=="'"$pcmk"'" {print $2;exit}'
+    fi
+}
+
+
 detect_first_master()
 {
     local best_commit=0
@@ -465,6 +459,14 @@ detect_first_master()
 
     # avoid selecting a recovered node as bootstrap if possible
     for node in $(echo "$OCF_RESKEY_wsrep_cluster_address" | sed 's/gcomm:\/\///g' | tr -d ' ' | tr -s ',' ' '); do
+        local pcmk_node=$(galera_to_pcmk_name $node)
+        if [ -z "$pcmk_node" ]; then
+            ocf_log error "Could not determine pacemaker node from galera name <${node}>."
+            return
+        else
+            node=$pcmk_node
+        fi
+
         if is_no_grastate $node; then
             nodes_recovered="$nodes_recovered $node"
         else
@@ -503,157 +505,6 @@ detect_first_master()
     set_bootstrap_node $best_node
 }
 
-detect_galera_pid()
-{
-    ps auxww | grep -v -e "${OCF_RESKEY_binary}" -e grep | grep -qe "--pid-file=$OCF_RESKEY_pid"
-}
-
-galera_status()
-{
-    local loglevel=$1
-    local rc
-    local running
-
-    if [ -e $OCF_RESKEY_pid ]; then
-        mysql_common_status $loglevel
-        rc=$?
-    else
-        # if pidfile is not created, the server may
-        # still be starting up, e.g. running SST
-        detect_galera_pid
-        running=$?
-        if [ $running -eq 0 ]; then
-            rc=$OCF_SUCCESS
-        else
-            ocf_log $loglevel "MySQL is not running"
-            rc=$OCF_NOT_RUNNING
-        fi
-    fi
-
-    return $rc
-}
-
-galera_start_nowait()
-{
-    local mysql_extra_params="$1"
-    local pid
-    local running
-
-    ${OCF_RESKEY_binary} --defaults-file=$OCF_RESKEY_config \
-    --pid-file=$OCF_RESKEY_pid \
-    --socket=$OCF_RESKEY_socket \
-    --datadir=$OCF_RESKEY_datadir \
-    --log-error=$OCF_RESKEY_log \
-    --user=$OCF_RESKEY_user $OCF_RESKEY_additional_parameters \
-    $mysql_extra_params >/dev/null 2>&1 &
-    pid=$!
-
-    # Spin waiting for the server to be spawned.
-    # Let the CRM/LRM time us out if required.
-    start_wait=1
-    while [ $start_wait = 1 ]; do
-        if ! ps $pid > /dev/null 2>&1; then
-            wait $pid
-            ocf_exit_reason "MySQL server failed to start (pid=$pid) (rc=$?), please check your installation"
-            return $OCF_ERR_GENERIC
-        fi
-        detect_galera_pid
-        running=$?
-        if [ $running -eq 0 ]; then
-            start_wait=0
-        else
-            ocf_log info "MySQL is not running"
-        fi
-        sleep 2
-    done
-
-    return $OCF_SUCCESS
-}
-
-galera_start_local_node()
-{
-    local rc
-    local extra_opts
-    local bootstrap
-
-    bootstrap=$(is_bootstrap)
-    
-    master_exists
-    if [ $? -eq 0 ]; then
-        # join without bootstrapping
-        ocf_log info "Node <${NODENAME}> is joining the cluster"
-        extra_opts="--wsrep-cluster-address=${OCF_RESKEY_wsrep_cluster_address}"
-    elif ocf_is_true $bootstrap; then
-        ocf_log info "Node <${NODENAME}> is bootstrapping the cluster"
-        extra_opts="--wsrep-cluster-address=gcomm://"
-    else
-        ocf_exit_reason "Failure, Attempted to join cluster of $OCF_RESOURCE_INSTANCE before master node has been detected."
-        clear_last_commit
-        return $OCF_ERR_GENERIC
-    fi
-
-    # clear last_commit before we start galera to make sure there
-    # won't be discrepency between the cib and galera if this node
-    # processes a few transactions and fails before we detect it
-    clear_last_commit
-
-    mysql_common_prepare_dirs
-
-    # At start time, if galera requires a SST rather than an IST, the
-    # mysql server's pidfile won't be available until SST finishes,
-    # which can be longer than the start timeout.  So we only check
-    # bootstrap node extensively. Joiner nodes are monitored in the
-    # "monitor" op
-    if ocf_is_true $bootstrap; then
-        # start server and wait until it's up and running
-        mysql_common_start "$extra_opts"
-        rc=$?
-        if [ $rc != $OCF_SUCCESS ]; then
-            return $rc
-        fi
-
-        mysql_common_status info
-        rc=$?
-
-        if [ $rc != $OCF_SUCCESS ]; then
-            ocf_exit_reason "Failed initial monitor action"
-            return $rc
-        fi
-
-        is_readonly
-        if [ $? -eq 0 ]; then
-            ocf_exit_reason "Failure. Master instance started in read-only mode, check configuration."
-            return $OCF_ERR_GENERIC
-        fi
-
-        is_primary
-        if [ $? -ne 0 ]; then
-            ocf_exit_reason "Failure. Master instance started, but is not in Primary mode."
-            return $OCF_ERR_GENERIC
-        fi
-
-        clear_bootstrap_node
-        # clear attribute no-grastate. if last shutdown was
-        # not clean, we cannot be extra-cautious by requesting a SST
-        # since this is the bootstrap node
-        clear_no_grastate
-    else
-        # only start server, defer full checks to "monitor" op
-        galera_start_nowait "$extra_opts"
-        rc=$?
-        if [ $rc != $OCF_SUCCESS ]; then
-            return $rc
-        fi
-
-        set_sync_needed
-        # attribute no-grastate will be cleared once the joiner
-        # has finished syncing and is promoted to Master
-    fi
-
-    ocf_log info "Galera started"
-    return $OCF_SUCCESS
-}
-
 detect_last_commit()
 {
     local last_commit
@@ -721,35 +572,88 @@ detect_last_commit()
     fi
 }
 
+# For galera, promote is really start
 galera_promote()
 {
     local rc
     local extra_opts
     local bootstrap
-
+    
     master_exists
-    if [ $? -ne 0 ]; then
-        # promoting the first master will bootstrap the cluster
-        if is_bootstrap; then
-            galera_start_local_node
-            rc=$?
-            return $rc
-        else
-            ocf_exit_reason "Attempted to start the cluster without being a bootstrap node."
-            return $OCF_ERR_GENERIC
-        fi
+    if [ $? -eq 0 ]; then
+        # join without bootstrapping
+        extra_opts="--wsrep-cluster-address=${OCF_RESKEY_wsrep_cluster_address}"
     else
-        # promoting other masters only performs sanity checks
-        # as the joining nodes were started during the "monitor" op
-        if ! check_sync_needed; then
-            # sync is done, clear info about last startup
-            clear_no_grastate
-            return $OCF_SUCCESS
+        bootstrap=$(is_bootstrap)
+
+        if ocf_is_true $bootstrap; then
+            ocf_log info "Node <${NODENAME}> is bootstrapping the cluster"
+            extra_opts="--wsrep-cluster-address=gcomm://"
         else
-            ocf_exit_reason "Attempted to promote local node while sync was still needed."
+            ocf_exit_reason "Failure, Attempted to promote Master instance of $OCF_RESOURCE_INSTANCE before bootstrap node has been detected."
+            clear_last_commit
             return $OCF_ERR_GENERIC
         fi
     fi
+
+    galera_monitor
+    if [ $? -eq $OCF_RUNNING_MASTER ]; then
+        if ocf_is_true $bootstrap; then
+            promote_everyone
+            clear_bootstrap_node
+            ocf_log info "boostrap node already up, promoting the rest of the galera instances."
+        fi
+        clear_last_commit
+        return $OCF_SUCCESS
+    fi
+
+    # last commit is no longer relevant once promoted
+    clear_last_commit
+
+    mysql_common_prepare_dirs
+    mysql_common_start "$extra_opts"
+    rc=$?
+    if [ $rc != $OCF_SUCCESS ]; then
+        return $rc
+    fi
+
+    galera_monitor
+    rc=$?
+    if [ $rc != $OCF_SUCCESS -a $rc != $OCF_RUNNING_MASTER ]; then
+        ocf_exit_reason "Failed initial monitor action"
+        return $rc
+    fi
+
+    is_readonly
+    if [ $? -eq 0 ]; then
+        ocf_exit_reason "Failure. Master instance started in read-only mode, check configuration."
+        return $OCF_ERR_GENERIC
+    fi
+
+    is_primary
+    if [ $? -ne 0 ]; then
+        ocf_exit_reason "Failure. Master instance started, but is not in Primary mode."
+        return $OCF_ERR_GENERIC
+    fi
+
+    if ocf_is_true $bootstrap; then
+        promote_everyone
+        clear_bootstrap_node
+        # clear attribute no-grastate. if last shutdown was
+        # not clean, we cannot be extra-cautious by requesting a SST
+        # since this is the bootstrap node
+        clear_no_grastate
+        ocf_log info "Bootstrap complete, promoting the rest of the galera instances."
+    else
+        # if this is not the bootstrap node, make sure this instance
+        # syncs with the rest of the cluster before promotion returns.
+        wait_for_sync
+        # sync is done, clear info about last startup
+        clear_no_grastate
+    fi
+
+    ocf_log info "Galera started"
+    return $OCF_SUCCESS
 }
 
 galera_demote()
@@ -764,7 +668,6 @@ galera_demote()
     # if this node was previously a bootstrap node, that is no longer the case.
     clear_bootstrap_node
     clear_last_commit
-    clear_sync_needed
     clear_no_grastate
 
     # Clear master score here rather than letting pacemaker do so once
@@ -783,15 +686,22 @@ galera_demote()
 galera_start()
 {
     local rc
+    local galera_node
+
+    galera_node=$(pcmk_to_galera_name $NODENAME)
+    if [ -z "$galera_node" ]; then
+        ocf_exit_reason "Could not determine galera name from pacemaker node <${NODENAME}>."
+        return $OCF_ERR_CONFIGURED
+    fi
 
-    echo $OCF_RESKEY_wsrep_cluster_address | grep -q $NODENAME
+    echo $OCF_RESKEY_wsrep_cluster_address | grep -q -F $galera_node
     if [ $? -ne 0 ]; then
-        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"
+        ocf_exit_reason "local node <${NODENAME}> (galera node <${galera_node}>) 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
+    galera_monitor
+    if [ $? -eq $OCF_RUNNING_MASTER ]; then
         ocf_exit_reason "master galera instance started outside of the cluster's control"
         return $OCF_ERR_GENERIC
     fi
@@ -806,7 +716,8 @@ galera_start()
 
     master_exists
     if [ $? -eq 0 ]; then
-        ocf_log info "Master instances are already up, local node will join in when started"
+        ocf_log info "Master instances are already up, setting master score so this instance will join galera cluster."
+        set_master_score $NODENAME
     else
         clear_master_score
         detect_first_master
@@ -818,6 +729,7 @@ galera_start()
 galera_monitor()
 {
     local rc
+    local galera_node
     local status_loglevel="err"
 
     # Set loglevel to info during probe
@@ -825,29 +737,22 @@ galera_monitor()
         status_loglevel="info"
     fi
 
-    # Check whether mysql is running or about to start after sync
-    galera_status $status_loglevel
+    mysql_common_status $status_loglevel
     rc=$?
 
     if [ $rc -eq $OCF_NOT_RUNNING ]; then
-        last_commit=$(get_last_commit $NODENAME)
-        if [ -n "$last_commit" ];then
+        last_commit=$(get_last_commit $node)
+        if [ -n "$last_commit" ]; then
+            # if last commit is set, this instance is considered started in slave mode
             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=$?
+                # a master instance exists and is healthy, promote this
+                # local read only instance
+                # so it can join the master galera cluster.
+                set_master_score
             fi
         fi
         return $rc
@@ -855,40 +760,31 @@ galera_monitor()
         return $rc
     fi
 
-    # if we make it here, mysql is running or about to start after sync.
-    # Check cluster status now.
+    # if we make it here, mysql is running. Check cluster status now.
+    galera_node=$(pcmk_to_galera_name $NODENAME)
+    if [ -z "$galera_node" ]; then
+        ocf_exit_reason "Could not determine galera name from pacemaker node <${NODENAME}>."
+        return $OCF_ERR_CONFIGURED
+    fi
 
-    echo $OCF_RESKEY_wsrep_cluster_address | grep -q $NODENAME
+    echo $OCF_RESKEY_wsrep_cluster_address | grep -q -F $galera_node
     if [ $? -ne 0 ]; then
-        ocf_exit_reason "local node <${NODENAME}> is started, but is not a member of the wsrep_cluster_address <${OCF_RESKEY_wsrep_cluster_address}>"
+        ocf_exit_reason "local node <${NODENAME}> (galera node <${galera_node}>) is started, but is not a member of the wsrep_cluster_address <${OCF_RESKEY_wsrep_cluster_address}>"
         return $OCF_ERR_GENERIC
     fi
 
-    check_sync_needed
+    is_primary
     if [ $? -eq 0 ]; then
-        # galera running and sync is needed: slave state
+
         if ocf_is_probe; then
-            # prevent state change during probe
-            rc=$OCF_SUCCESS
-        else
-            check_sync_status
-            rc=$?
+            # restore master score during probe
+            # if we detect this is a master instance
+            set_master_score
         fi
+        rc=$OCF_RUNNING_MASTER
     else
-        is_primary
-        if [ $? -ne 0 ]; then
-            ocf_exit_reason "local node <${NODENAME}> is started, but not in primary mode. Unknown state."
-            rc=$OCF_ERR_GENERIC
-        else
-            # galera running, no need to sync: master state and everything's clear
-            rc=$OCF_RUNNING_MASTER
-
-            if ocf_is_probe; then
-                # restore master score during probe
-                # if we detect this is a master instance
-                set_master_score
-            fi
-        fi
+        ocf_exit_reason "local node <${NODENAME}> is started, but not in primary mode. Unknown state."
+        rc=$OCF_ERR_GENERIC
     fi
 
     return $rc
@@ -899,12 +795,11 @@ galera_stop()
     local rc
     # make sure the process is stopped
     mysql_common_stop
-    rc=$?
+    rc=$1
 
     clear_last_commit
     clear_master_score
     clear_bootstrap_node
-    clear_sync_needed
     clear_no_grastate
     return $rc
 }
@@ -974,7 +869,7 @@ fi
 case "$1" in
   start)    galera_start;;
   stop)     galera_stop;;
-  status)   galera_status err;;
+  status)   mysql_common_status err;;
   monitor)  galera_monitor;;
   promote)  galera_promote;;
   demote)   galera_demote;;
diff --git a/heartbeat/nfsserver b/heartbeat/nfsserver
index 52d9bb2..bac5bbb 100755
--- a/heartbeat/nfsserver
+++ b/heartbeat/nfsserver
@@ -43,7 +43,7 @@ nfsserver_meta_data() {
 <version>1.0</version>
 
 <longdesc lang="en">
-Nfsserver helps to manage the Linux nfs server as a failover-able resource in Linux-HA.
+Nfsserver helps one to manage the Linux nfs server as a failover-able resource in Linux-HA.
 It depends on Linux specific NFS implementation details, so is considered not portable to other platforms yet.
 </longdesc>
 
diff --git a/heartbeat/nginx b/heartbeat/nginx
index d28c5a1..eed6665 100755
--- a/heartbeat/nginx
+++ b/heartbeat/nginx
@@ -721,7 +721,7 @@ Case insensitive.
 Client to use to query to Nginx for level 10 and level 20 tests.
 If not specified, the RA will try to find one on the system.
 Currently, wget and curl are supported, with curl being preferred.
-For example, you can set this paramter to "wget" if you prefer that to curl.
+For example, you can set this parameter to "wget" if you prefer that to curl.
 </longdesc>
 <shortdesc lang="en">http client</shortdesc>
 <content type="string" />
diff --git a/heartbeat/ocf-shellfuncs.in b/heartbeat/ocf-shellfuncs.in
index fdd314a..7d856a8 100644
--- a/heartbeat/ocf-shellfuncs.in
+++ b/heartbeat/ocf-shellfuncs.in
@@ -22,7 +22,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 # 
 
-# Build version: 18222e08b4a70df8ae561b3460dcdf8bce0f6c63
+# Build version: 150fb85f2a442f53157fb8063089817e6ee05b00
 
 # TODO: Some of this should probably split out into a generic OCF
 # library for shell scripts, but for the time being, we'll just use it
diff --git a/heartbeat/pgsql b/heartbeat/pgsql
index b230647..15b06df 100755
--- a/heartbeat/pgsql
+++ b/heartbeat/pgsql
@@ -1493,7 +1493,7 @@ set_sync_mode() {
         ocf_log debug "$sync_node_in_conf is already sync mode."
     else
         ocf_log info "Setup $1 into sync mode."
-        runasowner -q err "echo \"synchronous_standby_names = '$1'\" > \"$REP_MODE_CONF\""
+        runasowner -q err "echo \"synchronous_standby_names = '\\\"$1\\\"'\" > \"$REP_MODE_CONF\""
         [ "$RE_CONTROL_SLAVE" = "false" ] && RE_CONTROL_SLAVE="true"
         exec_with_retry 0 reload_conf
     fi
diff --git a/heartbeat/rabbitmq-cluster b/heartbeat/rabbitmq-cluster
index ac394e0..74378be 100755
--- a/heartbeat/rabbitmq-cluster
+++ b/heartbeat/rabbitmq-cluster
@@ -353,75 +353,71 @@ rmq_start() {
 		return $rc
 	fi
 
-	# first try to join without wiping mnesia data
+	# Try to join existing cluster
+	ocf_log info "wiping data directory before joining"
+	local local_rmq_node="$(${HA_SBIN_DIR}/crm_attribute -N $NODENAME -l forever --query --name $RMQ_CRM_ATTR_COOKIE_LAST_KNOWN -q)"
+
+	rmq_stop
+	rmq_wipe_data
+	rmq_forget_cluster_node_remotely "$join_list" "$local_rmq_node"
 	rmq_join_existing "$join_list"
-	if [ $? -ne 0 ]; then
-		ocf_log info "node failed to join, wiping data directory and trying again"
-		local local_rmq_node="$(${HA_SBIN_DIR}/crm_attribute -N $NODENAME -l forever --query --name $RMQ_CRM_ATTR_COOKIE_LAST_KNOWN -q)"
-
-		# if the graceful join fails, use the hammer and reset all the data.
-		rmq_stop 
-		rmq_wipe_data
-		rmq_forget_cluster_node_remotely "$join_list" "$local_rmq_node"
-		rmq_join_existing "$join_list"
-		rc=$?
+	rc=$?
 
-		# Restore users and users' permissions (if any)
-		BaseDataDir=`dirname $RMQ_DATA_DIR`
-		if [ -f $BaseDataDir/users.erl ] ; then
-			rabbitmqctl eval "
-				%% Run only if Mnesia is ready.
-				lists:any(fun({mnesia,_,_}) -> true; ({_,_,_}) -> false end, application:which_applications()) andalso
-				begin
-					[WildPattern] = ets:select(mnesia_gvar, [ { {{rabbit_user, wild_pattern}, '\\\$1'}, [], ['\\\$1'] } ]),
-
-					%% Read users first
-					{ok, [Users]} = file:consult(\"$BaseDataDir/users.erl\"),
-
-					Upgrade = fun
-						({internal_user, A, B, C}) -> {internal_user, A, B, C, rabbit_password_hashing_md5};
-						({internal_user, A, B, C, D}) -> {internal_user, A, B, C, D}
-					end,
-
-					Downgrade = fun
-						({internal_user, A, B, C}) -> {internal_user, A, B, C};
-						({internal_user, A, B, C, rabbit_password_hashing_md5}) -> {internal_user, A, B, C};
-						%% Incompatible scheme, so we will loose user's password ('B' value) during conversion.
-						%% Unfortunately, this case will require manual intervention - user have to run:
-						%%    rabbitmqctl change_password <A> <somenewpassword>
-						({internal_user, A, B, C, _}) -> {internal_user, A, B, C}
-					end,
-
-					case WildPattern of
-						%% Version < 3.6.0
-						{internal_user,'_','_','_'} ->
-							lists:foreach(fun(X) -> mnesia:dirty_write(rabbit_user, Downgrade(X)) end, Users);
-						%% Version >= 3.6.0
-						{internal_user,'_','_','_','_'} ->
-							lists:foreach(fun(X) -> mnesia:dirty_write(rabbit_user, Upgrade(X)) end, Users)
-					end,
-
-					ok = file:delete(\"$BaseDataDir/users.erl\")
-				end.
-			"
-                fi
-                if [ -f $BaseDataDir/users_perms.erl ] ; then
-                        rabbitmqctl eval "
-				%% Run only if Mnesia is ready.
-				lists:any(fun({mnesia,_,_}) -> true; ({_,_,_}) -> false end, application:which_applications()) andalso
-				begin
-					{ok, [UsersPerms]} = file:consult(\"$BaseDataDir/users_perms.erl\"),
-					lists:foreach(fun(X) -> mnesia:dirty_write(rabbit_user_permission, X) end, UsersPerms),
-
-					ok = file:delete(\"$BaseDataDir/users_perms.erl\")
-				end.
-                        "
-                fi
-
-		if [ $rc -ne 0 ]; then
-			ocf_log info "node failed to join even after reseting local data. Check SELINUX policy"
-			return $OCF_ERR_GENERIC
-		fi
+	if [ $rc -ne 0 ]; then
+		ocf_log info "node failed to join even after reseting local data. Check SELINUX policy"
+		return $OCF_ERR_GENERIC
+	fi
+
+	# Restore users and users' permissions (if any)
+	BaseDataDir=`dirname $RMQ_DATA_DIR`
+	if [ -f $BaseDataDir/users.erl ] ; then
+		rabbitmqctl eval "
+			%% Run only if Mnesia is ready.
+			lists:any(fun({mnesia,_,_}) -> true; ({_,_,_}) -> false end, application:which_applications()) andalso
+			begin
+				[WildPattern] = ets:select(mnesia_gvar, [ { {{rabbit_user, wild_pattern}, '\\\$1'}, [], ['\\\$1'] } ]),
+
+				%% Read users first
+				{ok, [Users]} = file:consult(\"$BaseDataDir/users.erl\"),
+
+				Upgrade = fun
+					({internal_user, A, B, C}) -> {internal_user, A, B, C, rabbit_password_hashing_md5};
+					({internal_user, A, B, C, D}) -> {internal_user, A, B, C, D}
+				end,
+
+				Downgrade = fun
+					({internal_user, A, B, C}) -> {internal_user, A, B, C};
+					({internal_user, A, B, C, rabbit_password_hashing_md5}) -> {internal_user, A, B, C};
+					%% Incompatible scheme, so we will loose user's password ('B' value) during conversion.
+					%% Unfortunately, this case will require manual intervention - user have to run:
+					%%    rabbitmqctl change_password <A> <somenewpassword>
+					({internal_user, A, B, C, _}) -> {internal_user, A, B, C}
+				end,
+
+				case WildPattern of
+					%% Version < 3.6.0
+					{internal_user,'_','_','_'} ->
+						lists:foreach(fun(X) -> mnesia:dirty_write(rabbit_user, Downgrade(X)) end, Users);
+					%% Version >= 3.6.0
+					{internal_user,'_','_','_','_'} ->
+						lists:foreach(fun(X) -> mnesia:dirty_write(rabbit_user, Upgrade(X)) end, Users)
+				end,
+
+				ok = file:delete(\"$BaseDataDir/users.erl\")
+			end.
+		"
+	fi
+	if [ -f $BaseDataDir/users_perms.erl ] ; then
+		rabbitmqctl eval "
+			%% Run only if Mnesia is ready.
+			lists:any(fun({mnesia,_,_}) -> true; ({_,_,_}) -> false end, application:which_applications()) andalso
+			begin
+				{ok, [UsersPerms]} = file:consult(\"$BaseDataDir/users_perms.erl\"),
+				lists:foreach(fun(X) -> mnesia:dirty_write(rabbit_user_permission, X) end, UsersPerms),
+
+				ok = file:delete(\"$BaseDataDir/users_perms.erl\")
+			end.
+		"
 	fi
 
 	return $OCF_SUCCESS
diff --git a/heartbeat/redis b/heartbeat/redis
index 1ea0025..d08e57a 100755
--- a/heartbeat/redis
+++ b/heartbeat/redis
@@ -436,6 +436,11 @@ function demote() {
 	local master_host
 	local master_port
 
+	# client kill is only supported in Redis 2.8.12 or greater
+	version=$(redis_client -v | awk '{print $NF}')
+	ocf_version_cmp "$version" "2.8.11"
+	client_kill=$?
+
 	CHECK_SLAVE_STATE=1
 	monitor
 	status=$?
@@ -478,9 +483,15 @@ function demote() {
 	while true; do 
 		# Wait infinite if replication is syncing
 		# Then start/demote operation timeout determines timeout
+		if [ "$client_kill" -eq 2 ]; then
+			redis_client CLIENT PAUSE 2000
+		fi
 		monitor
 		status=$?
 		if (( status == OCF_SUCCESS )); then
+			if [ "$client_kill" -eq 2 ]; then
+				redis_client CLIENT KILL type normal
+			fi
 			return $OCF_SUCCESS
 		fi
 		
diff --git a/heartbeat/scsi2reservation b/heartbeat/scsi2reservation
index be0c53a..01b067e 100755
--- a/heartbeat/scsi2reservation
+++ b/heartbeat/scsi2reservation
@@ -35,7 +35,7 @@ scsi-2 reservation
 <parameter name="scsi_reserve" unique="0" required="0">
 <longdesc lang="en">
 The scsi_reserve is a command from scsires package. 
-It helps to issue SCSI-2 reservation on SCSI devices.
+It helps one to issue SCSI-2 reservation on SCSI devices.
 </longdesc>
 <shortdesc lang="en">Manages exclusive access to shared storage media thrugh SCSI-2 reservations</shortdesc>
 <content type="string" default="/usr/sbin/scsi_reserve" />
diff --git a/resource-agents.spec.in b/resource-agents.spec.in
index 40f6e5c..d87364d 100644
--- a/resource-agents.spec.in
+++ b/resource-agents.spec.in
@@ -233,6 +233,7 @@ rm -rf %{buildroot}
 %if %{with linuxha}
 %doc doc/README.webapps
 %doc %{_datadir}/%{name}/ra-api-1.dtd
+%doc %{_datadir}/%{name}/metadata.rng
 %endif
 
 %if %{with rgmanager}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-ha/resource-agents.git



More information about the Debian-HA-Commits mailing list