[Debian-ha-commits] [resource-agents] 01/04: New upstream version 4.0.0~rc1

Christoph Berg myon at debian.org
Tue Jan 10 22:32:38 UTC 2017


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

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

commit a18bf6f832340e226fab9298bd595bb043e62de8
Author: Christoph Berg <myon at debian.org>
Date:   Tue Jan 10 23:12:59 2017 +0100

    New upstream version 4.0.0~rc1
---
 .gitignore                                         |  22 ++
 .travis.yml                                        |  11 +-
 ChangeLog                                          |  80 ++++
 ci/build.sh                                        |  75 +++-
 ci/install.sh                                      |  10 -
 configure.ac                                       |   4 +-
 .../{ra-dev-guide.txt => ra-dev-guide.asc}         |   0
 doc/man/Makefile.am                                |   2 +
 doc/man/mkappendix.sh                              |   2 +-
 doc/man/ra2refentry.xsl                            | 406 ++++++++++----------
 doc/man/ralist.sh                                  |   4 +-
 heartbeat/AoEtarget                                |   2 +-
 heartbeat/CTDB                                     | 108 +++---
 heartbeat/ClusterMon                               |   2 +-
 heartbeat/Delay                                    |   8 +-
 heartbeat/Dummy                                    |   4 +-
 heartbeat/EvmsSCC                                  |   2 +-
 heartbeat/Evmsd                                    |   2 +-
 heartbeat/Filesystem                               |  12 +-
 heartbeat/ICP                                      |   2 +-
 heartbeat/IPaddr                                   |   2 +-
 heartbeat/IPaddr2                                  |  60 ++-
 heartbeat/IPsrcaddr                                |   2 +-
 heartbeat/LVM                                      |   8 +-
 heartbeat/LinuxSCSI                                |   2 +-
 heartbeat/MailTo                                   |   2 +-
 heartbeat/Makefile.am                              | 106 +++---
 heartbeat/ManageRAID                               |  18 +-
 heartbeat/README.galera                            |   9 +-
 heartbeat/Raid1                                    |   2 +-
 heartbeat/Route                                    |   2 +-
 heartbeat/SAPDatabase                              |  32 +-
 heartbeat/SAPInstance                              |  61 +--
 heartbeat/SendArp                                  |   4 +-
 heartbeat/ServeRAID                                |   8 +-
 heartbeat/SphinxSearchDaemon                       |   2 +-
 heartbeat/Squid                                    |  14 +-
 heartbeat/Stateful                                 |   2 +-
 heartbeat/SysInfo                                  |  11 +-
 heartbeat/VIPArip                                  |   2 +-
 heartbeat/VirtualDomain                            |  48 +--
 heartbeat/WAS                                      |   2 +-
 heartbeat/WAS6                                     |   2 +-
 heartbeat/Xen                                      |   2 +-
 heartbeat/Xinetd                                   |   2 +-
 heartbeat/apache                                   |  52 ++-
 heartbeat/apache-conf.sh                           |   4 +-
 heartbeat/asterisk                                 |   2 +-
 heartbeat/awseip                                   | 250 ++++++++++++
 heartbeat/awsvip                                   | 225 +++++++++++
 heartbeat/clvm                                     |   2 +-
 heartbeat/conntrackd                               |  94 ++---
 heartbeat/db2                                      |   4 +
 heartbeat/dhcpd                                    |   2 +-
 heartbeat/dnsupdate                                |   2 +-
 heartbeat/docker                                   |  46 ++-
 heartbeat/eDir88                                   |   6 +-
 heartbeat/ethmonitor                               |   2 +-
 heartbeat/exportfs                                 |  10 +-
 heartbeat/findif.sh                                |   2 +-
 heartbeat/fio                                      |   2 +-
 heartbeat/galera                                   | 286 +++++++++-----
 heartbeat/garbd                                    | 417 +++++++++++++++++++++
 heartbeat/http-mon.sh                              |   2 +-
 heartbeat/iSCSILogicalUnit                         |  25 +-
 heartbeat/iSCSITarget                              |  22 +-
 heartbeat/ids                                      |   2 +-
 heartbeat/jboss                                    |  36 +-
 heartbeat/kamailio                                 |   2 +-
 heartbeat/lxc                                      |   7 +-
 heartbeat/metadata.rng                             |  91 +++++
 heartbeat/mysql                                    |   3 +-
 heartbeat/mysql-proxy                              |   4 +-
 heartbeat/nagios                                   |  26 +-
 heartbeat/nfsnotify                                |   2 +-
 heartbeat/nfsserver                                | 213 +++++++++--
 heartbeat/nginx                                    |   8 +-
 heartbeat/ocf-directories.in                       |   4 +-
 heartbeat/ocf-shellfuncs.in                        |  15 +-
 heartbeat/ora-common.sh                            |   2 +-
 heartbeat/oracle                                   |  29 +-
 heartbeat/oralsnr                                  |   6 +-
 heartbeat/pgagent                                  | 139 +++++++
 heartbeat/pgsql                                    |  30 +-
 heartbeat/portblock                                |  25 +-
 heartbeat/postfix                                  |   2 +-
 heartbeat/pound                                    |   2 +-
 heartbeat/rabbitmq-cluster                         | 168 ++++++++-
 heartbeat/redis                                    |   6 +-
 heartbeat/rsyslog                                  |   6 +-
 heartbeat/sapdb.sh                                 |  97 +++--
 heartbeat/sg_persist                               |  57 +--
 heartbeat/shellfuncs.in                            |   2 +-
 heartbeat/slapd                                    |  60 +--
 heartbeat/symlink                                  |   2 +-
 heartbeat/syslog-ng                                |   8 +-
 heartbeat/tomcat                                   | 133 ++++---
 heartbeat/varnish                                  |   2 +-
 ldirectord/OCF/ldirectord.in                       |   4 +-
 ldirectord/ldirectord.cf                           |   2 +
 ldirectord/ldirectord.in                           | 143 +++++--
 make/release.mk                                    |   2 +-
 resource-agents.spec.in                            |  36 +-
 rgmanager/src/resources/clusterfs.sh               |   1 +
 rgmanager/src/resources/fs.sh.in                   |   2 +
 rgmanager/src/resources/lvm_by_lv.sh               |   2 +
 rgmanager/src/resources/ra2rng.xsl                 |  18 +-
 rgmanager/src/resources/resources.rng.mid          |  19 +-
 rgmanager/src/resources/resources.rng.tail         |  19 +-
 tools/ocf-tester.in                                |   2 +-
 tools/ocft/IPaddr2                                 |   6 +-
 tools/ocft/Makefile.am                             |   2 +-
 tools/ocft/README.in                               |  90 ++---
 tools/ocft/runocft                                 |   1 +
 tools/tickle_tcp.c                                 |   2 +-
 115 files changed, 3081 insertions(+), 1079 deletions(-)

diff --git a/.gitignore b/.gitignore
index 7bdd5cf..59df506 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,6 +36,28 @@ rgmanager/src/resources/utils/config-utils.sh
 resource-agents-*
 .version
 
+# generated by ./autogen.sh && ./configure
+heartbeat/ocf-binaries
+heartbeat/ocf-directories
+heartbeat/ocf-shellfuncs
+heartbeat/shellfuncs
+include/agent_config.h
+include/config.h
+include/config.h.in
+include/stamp-h1
+include/stamp-h2
+ldirectord/OCF/ldirectord
+ldirectord/init.d/ldirectord
+ldirectord/init.d/ldirectord.debian
+ldirectord/init.d/ldirectord.debian.default
+ldirectord/ldirectord
+ldirectord/systemd/ldirectord.service
+tools/ocf-tester
+tools/ocft/README
+tools/ocft/README.zh_CN
+tools/ocft/caselib
+tools/ocft/ocft
+
 *.cache
 *.upgrade.xml
 py-compile
diff --git a/.travis.yml b/.travis.yml
index 79f7753..e6943fa 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,8 +1,13 @@
 language: bash
-install:
-  - ./ci/install.sh
+sudo: false
+
+addons:
+  apt:
+    sources:
+      - debian-sid
+    packages:
+      - shellcheck
 script:
   - ./ci/build.sh
 notifications:
   email: false
-sudo: required
diff --git a/ChangeLog b/ChangeLog
index 3711574..dcdae56 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,83 @@
+* Tue Jan 10 2017 resource-agents contributors
+- release candidate 4.0.0 rc1
+- CI: add metadata verification
+- ocf_mkstatedir: fix path check
+- IPaddr2: return success on stop with invalid IP
+- Filesystem: check if there are any mounts mounted under the mountpoint
+- specfile: make requirements general and update comments
+- portblock: use -w (wait) to avoid "insufficient privileges" error
+- rabbitmq-cluster: fix dump/restore users for RabbitMQ ver. 3.6.x and newer
+- Updated mailing list/wiki references
+- pgsql: fix tr replacement for replication slot names
+- IPaddr2: log refresh arp packets at debug level instead of info
+- IPaddr2: add option to enable sending refresh arp packets in monitor
+- findif.sh: fix to ifcheck() to not suppress stdout of "ip"
+- galera: prevent promote right after demote
+- galera: make last commit parsing compatible with MariaDB 10.1.18+
+- specfile: add requires netstat
+- multiple RA: fixed issues discovered by ShellCheck
+- apache: reduce log spam for success
+- rgmanager: fix RNG schema for cluster config
+- LVM: add error messages for partial_activation
+- slapd: improved stop processing
+- docker: clarify limitations of monitor_cmd in parameter description
+- redis: restore rundir security context
+- docker: reduce monitor log spam
+- nfsserver: dont stop rpcbind, as other services might use it
+- Filesystem: improved exit reason if mount fails
+- Delay: set default startdelay lower than start timeout to avoid timeout with default values
+- docker: use docker exec for monitor_cmd if supported
+- sapdb.sh add support for HANA Multi-Tenant Databases
+- lvm.sh: fix status clustered to check specified logical volume
+- sg_persist: do not spill info output to stderr
+- sg_persist: allow to run resource agent in debug mode
+- sg_persist: fix matching of hex node ids
+- tomcat: add systemd support and option to disable it
+- oracle: add quotes for monuser and monpassword and inform user to start monuser with C## if it's a container database
+- rabbitmq-cluster: allow automatic cluster recovery before forcing it
+- nfsserver: systemd tests to make sure all services are running and monitored
+- rabbitmq-cluster: add POSIX error codes to detect node failure
+- rabbitmq-cluster: forget node before 2nd joining attempt
+- exportfs: add IPv6 support
+- galera: source settings from /etc/default/clustercheck
+- pgsql: fix to adjust stop_escalate time when it is longer than the timeout
+- heartbeat/Makefile.am: add missing agents
+- exportfs: fix monitor reporting wrong state after the node has been fenced
+- Rename ra-dev-guide.txt to ra-dev-guide.asc
+- awseip: add support to associate secondary private IP with elastic IP
+- garbd: new RA
+- ldirectord: fix for IPv4/IPv6 mixed environments
+- ocf-tester: fix to allow non-shell based agents.
+- nfsserver: add support to detect which init script to use
+- ldirectord: run initial check of all services on start to make sure all services always have the correct state
+- sapdb.sh: pass start/stop timeouts to saphostctrl
+- SAPDatabase: Add START_TIMEOUT and STOP_TIMEOUT parameters
+- rabbitmq-cluster: backup and restore RabbitMQ users during resource restart
+- iSCSILogicalUnit: add support for rbd store.
+- awseip: new RA to manage AWS EC2 elastic IP
+- awsvip: new RA to manage AWS EC2 secondary private IP
+- oracle: inform user that monprofile must start with C## for container databases
+- tickle_tcp: fix "Failed to open raw socket (Invalid argument)" issue
+- symlink: handle missing directories in target
+- mysql: handle non-standard mysql server port
+- VirtualDomain: fix unnecessary error when probing nonexistent domain
+- sapdb.sh fix to evaluate parameter DBOSUSER in start and stop
+- oracle: fix to be able to recover from ORA-01081
+- oralsnr: fix status check fail when username is more than 8 characters long
+- galera: don't bootstrap from a node with no grastate.dat when possible
+- galera: fix monitoring of joining node for long running SST
+- pgagent: new RA
+- ocf_shellfuncs: set OCF_RESOURCE_INSTANCE default to "RESOURCE_ID" for meta-data
+- ldirectord: add new "servicename" and "comment" options for alert e-mails
+- clusterfs.sh / fs.sh: fix .clumanager/statd ownership
+- rabbitmq-cluster: forget stopped rmq nodes with notify=true
+- apache: ensure readable $TESTCONFFILE and improved error handling for testurl/testregex
+- SAPDatabase: support Oracle 12c
+- apache: add Debian support
+- iSCSITarget: iSER enabled portal support
+- SAPInstance: update SAP WebAS version support statement
+- ldirectord: don't send "inaccessible real server" e-mails per child in fork=yes mode
+
 * Wed Feb  3 2016 resource-agents contributors
 - stable release 3.9.7
 - ldirectord: fix unset failcount error
diff --git a/ci/build.sh b/ci/build.sh
index 798bd39..a04973a 100755
--- a/ci/build.sh
+++ b/ci/build.sh
@@ -1,46 +1,81 @@
 #!/usr/bin/env bash
-set -eo pipefail
+set -o pipefail
 [[ "${DEBUG:-}" ]] && set -x
 
 declare -i failed
 failed=0
 
+# SC2046: Quote this to prevent word splitting.
+# SC1090: Can't follow non-constant source. Use a directive to specify location.
+# SC2039: In POSIX sh, 'local' is undefined.
+# SC2086: Double quote to prevent globbing and word splitting.
+# SC2154: var is referenced but not assigned.
+ignored_errors="SC1090,SC2039,SC2154"
+
 success() {
-  printf "\r\033[2K  [ \033[00;32mOK\033[0m ] Checking %s...\n" "$1"
+	printf "\r\033[2K  [ \033[00;32mOK\033[0m ] Checking %s...\n" "$1"
+}
+
+warn() {
+	printf "\r\033[2K  [\033[0;33mWARNING\033[0m] Checking %s...\n" "$1"
 }
 
 fail() {
 	printf "\r\033[2K  [\033[0;31mFAIL\033[0m] Checking %s...\n" "$1"
-	failed=1
+	failed=$((failed + 1))
 }
 
 check() {
-  local script="$1"
-  shellcheck "$script" || fail "$script"
-  success "$script"
+	local script="$1"
+
+	out="$(shellcheck -s sh -f gcc -x -e "$ignored_errors" "$script" 2>&1)"
+	rc=$?
+	if [ $rc -eq 0 ]; then
+		success "$script"
+	elif echo "$out" | grep -i 'error' >/dev/null; then
+		fail "$script"
+	else
+		warn "$script"
+	fi
+	echo "$out"
 }
 
 find_prunes() {
-  local prunes="! -path './.git/*'"
-  if [ -f .gitmodules ]; then
-    while read module; do
-      prunes="$prunes ! -path './$module/*'"
-    done < <(grep path .gitmodules | awk '{print $3}')
-  fi
-  echo "$prunes"
+	local prunes="! -path './.git/*'"
+	if [ -f .gitmodules ]; then
+		while read -r module; do
+			prunes="$prunes ! -path './$module/*'"
+		done < <(grep path .gitmodules | awk '{print $3}')
+	fi
+	echo "$prunes"
 }
 
 find_cmd() {
-  echo "find . -type f -and \( -perm +111 -or -name '*.sh' \) $(find_prunes)"
+	echo "find heartbeat -type f -and \( -perm /111 -or -name '*.sh' \) $(find_prunes)"
 }
 
 check_all_executables() {
-  echo "Checking executables and .sh files..."
-  eval "$(find_cmd)" | while read script; do
-    head=$(head -n1 "$script")
-    check "$script"
-  done
-  exit $failed
+	echo "Checking executables and .sh files..."
+	while read -r script; do
+		file --mime "$script" | grep 'charset=binary' >/dev/null 2>&1 && continue
+		head=$(head -n1 "$script")
+		[[ "$head" =~ .*ruby.* ]] && continue
+		[[ "$head" =~ .*zsh.* ]] && continue
+		[[ "$head" =~ ^#compdef.* ]] && continue
+		[[ "$script" =~ ^.*\.c ]] && continue
+		[[ "$script" =~ ^.*\.orig ]] && continue
+		[[ "$script" =~ ^ldirectord.in ]] && continue
+		check "$script"
+	done < <(eval "$(find_cmd)")
+	if [ $failed -gt 0 ]; then
+		echo "$failed failures detected."
+		exit 1
+	fi
+	exit 0
 }
 
+./autogen.sh
+./configure
+make check
+[ $? ] || failed=$((failed + 1))
 check_all_executables
diff --git a/ci/install.sh b/ci/install.sh
deleted file mode 100755
index c66b56c..0000000
--- a/ci/install.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-set -eo pipefail
-
-main() {
-  local filename="shellcheck_0.3.7-1_amd64.deb"
-  wget "http://ftp.debian.org/debian/pool/main/s/shellcheck/$filename"
-  sudo dpkg -i "$filename"
-}
-
-main
diff --git a/configure.ac b/configure.ac
index 0ecb65e..9afee62 100644
--- a/configure.ac
+++ b/configure.ac
@@ -187,7 +187,7 @@ AC_ARG_WITH(initdir,
     [  --with-initdir=DIR      directory for init (rc) scripts [${INITDIR}]],
     [ INITDIR="$withval" ])
 
-OCF_ROOT_DIR="/usr/lib/ocf"
+OCF_ROOT_DIR="${prefix}/lib/ocf"
 AC_ARG_WITH(ocf-root,
     [  --with-ocf-root=DIR      directory for OCF scripts [${OCF_ROOT_DIR}]],
     [ OCF_ROOT_DIR="$withval" ])
@@ -901,7 +901,7 @@ dnl *****************
 AC_MSG_RESULT([])
 AC_MSG_RESULT([$PACKAGE configuration:])
 AC_MSG_RESULT([  Version                  = ${VERSION}])
-AC_MSG_RESULT([  Build Version            = e697f43c4e59a47bd0dc7c093b7d46174035c2dd])
+AC_MSG_RESULT([  Build Version            = 18222e08b4a70df8ae561b3460dcdf8bce0f6c63])
 AC_MSG_RESULT([  Features                 =${PKG_FEATURES}])
 AC_MSG_RESULT([])
 AC_MSG_RESULT([  Prefix                   = ${prefix}])
diff --git a/doc/dev-guides/ra-dev-guide.txt b/doc/dev-guides/ra-dev-guide.asc
similarity index 100%
rename from doc/dev-guides/ra-dev-guide.txt
rename to doc/dev-guides/ra-dev-guide.asc
diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am
index 5e28895..43a3f70 100644
--- a/doc/man/Makefile.am
+++ b/doc/man/Makefile.am
@@ -105,6 +105,7 @@ man_MANS	       = ocf_heartbeat_AoEtarget.7 \
                           ocf_heartbeat_exportfs.7 \
                           ocf_heartbeat_fio.7 \
                           ocf_heartbeat_galera.7 \
+                          ocf_heartbeat_garbd.7 \
                           ocf_heartbeat_iSCSILogicalUnit.7 \
                           ocf_heartbeat_iSCSITarget.7 \
                           ocf_heartbeat_iface-bridge.7 \
@@ -116,6 +117,7 @@ man_MANS	       = ocf_heartbeat_AoEtarget.7 \
                           ocf_heartbeat_lxc.7 \
                           ocf_heartbeat_mysql.7 \
                           ocf_heartbeat_mysql-proxy.7 \
+                          ocf_heartbeat_nagios.7 \
                           ocf_heartbeat_named.7 \
                           ocf_heartbeat_nfsnotify.7 \
                           ocf_heartbeat_nfsserver.7 \
diff --git a/doc/man/mkappendix.sh b/doc/man/mkappendix.sh
index 8f8a622..8f3ed3d 100755
--- a/doc/man/mkappendix.sh
+++ b/doc/man/mkappendix.sh
@@ -7,7 +7,7 @@ cat <<EOF
   <title>Resource agent manual pages</title>
 EOF
 
-for manpage in `printf "%s\n" $@ | sort -f`; do
+for manpage in $(printf "%s\n" "$@" | sort -f); do
     cat <<EOF
   <xi:include href="./$manpage" xmlns:xi="http://www.w3.org/2001/XInclude"/>
 EOF
diff --git a/doc/man/ra2refentry.xsl b/doc/man/ra2refentry.xsl
index ac148ef..d0535fd 100644
--- a/doc/man/ra2refentry.xsl
+++ b/doc/man/ra2refentry.xsl
@@ -70,7 +70,7 @@
    <refentryinfo>
      <productname><xsl:value-of select="$package"/></productname>
      <productnumber><xsl:value-of select="$version"/></productnumber>
-     <corpauthor>Linux-HA contributors (see the resource agent source for information about individual authors)</corpauthor>
+     <corpauthor>ClusterLabs contributors (see the resource agent source for information about individual authors)</corpauthor>
    </refentryinfo>
  </xsl:template>
 
@@ -97,7 +97,7 @@
    <refsynopsisdiv>
      <cmdsynopsis sepchar=" ">
        <command moreinfo="none">
-	 <xsl:value-of select="@name"/>
+         <xsl:value-of select="@name"/>
        </command>
        <xsl:apply-templates select="actions" mode="synopsis"/>
      </cmdsynopsis>
@@ -136,15 +136,15 @@
 
     <xsl:choose>
     <xsl:when test="starts-with($string, '&#xA;') or starts-with($string, ' ')" >
-	<!-- trim leading newlines and other witespace -->
-	<xsl:variable name="normalized" select="normalize-space($string)" />
-	<xsl:variable name="nlen" select="string-length($normalized)" />
-	<xsl:if test="$nlen > 0" >
-	    <xsl:variable name="leading" select="string-length(substring-before($string, substring($normalized, 1, 1)))" />
+        <!-- trim leading newlines and other witespace -->
+        <xsl:variable name="normalized" select="normalize-space($string)" />
+        <xsl:variable name="nlen" select="string-length($normalized)" />
+        <xsl:if test="$nlen > 0" >
+            <xsl:variable name="leading" select="string-length(substring-before($string, substring($normalized, 1, 1)))" />
             <xsl:call-template name="break_into_para">
-	    <xsl:with-param name="string" select="substring($string, $leading + 1)" />
+            <xsl:with-param name="string" select="substring($string, $leading + 1)" />
             </xsl:call-template>
-	</xsl:if>
+        </xsl:if>
     </xsl:when>
     <xsl:otherwise>
 
@@ -155,29 +155,29 @@
             <xsl:variable name="first" select="substring-before($string, $lf)" />
            <!-- recursively call on remaining string -->
             <xsl:call-template name="break_into_para">
-	    <xsl:with-param name="string" select="$first"/>
+            <xsl:with-param name="string" select="$first"/>
             </xsl:call-template>
             <xsl:call-template name="break_into_para">
-	    <xsl:with-param name="string" select="substring-after($string, $lf)" />
+            <xsl:with-param name="string" select="substring-after($string, $lf)" />
             </xsl:call-template>
         </xsl:when>
         <xsl:when test="contains($string, $lf_dash)">
             <xsl:variable name="first" select="substring-before($string, $lf_dash)" />
            <!-- recursively call on remaining string -->
             <xsl:call-template name="break_into_para">
-	    <xsl:with-param name="string" select="$first"/>
+            <xsl:with-param name="string" select="$first"/>
             </xsl:call-template>
             <xsl:call-template name="break_into_para">
-	    <xsl:with-param name="string" select="concat('-',substring-after($string, $lf_dash))" />
+            <xsl:with-param name="string" select="concat('-',substring-after($string, $lf_dash))" />
             </xsl:call-template>
         </xsl:when>
         <xsl:otherwise>
             <para>
-	    <xsl:value-of select="'&#xA;'"/>
-	    <xsl:value-of select="$string"/>
-	    <xsl:value-of select="'&#xA;'"/>
+            <xsl:value-of select="'&#xA;'"/>
+            <xsl:value-of select="$string"/>
+            <xsl:value-of select="'&#xA;'"/>
             </para>
-	    <xsl:value-of select="'&#xA;'"/>
+            <xsl:value-of select="'&#xA;'"/>
         </xsl:otherwise>
     </xsl:choose>
     </xsl:otherwise>
@@ -218,14 +218,14 @@
     <refsection>
       <title>Supported Parameters</title>
       <xsl:choose>
-	<xsl:when test="parameters">
-	  <xsl:apply-templates mode="parameters"/>
-	</xsl:when>
-	<xsl:otherwise>
-	  <para>
-	    <xsl:text>This resource agent does not support any parameters.</xsl:text>
-	  </para>
-	</xsl:otherwise>
+        <xsl:when test="parameters">
+          <xsl:apply-templates mode="parameters"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <para>
+            <xsl:text>This resource agent does not support any parameters.</xsl:text>
+          </para>
+        </xsl:otherwise>
       </xsl:choose>
     </refsection>
   </xsl:template>
@@ -245,10 +245,10 @@
       <option><xsl:value-of select="concat($variable.prefix, @name)"/></option>
     </term>
     <listitem>
-	<xsl:apply-templates select="longdesc" mode="parameters"/>
-	<para>
-	<xsl:apply-templates select="content" mode="parameters"/>
-	</para>
+        <xsl:apply-templates select="longdesc" mode="parameters"/>
+        <para>
+        <xsl:apply-templates select="content" mode="parameters"/>
+        </para>
     </listitem>
    </varlistentry>
   </xsl:template>
@@ -265,45 +265,45 @@
     <xsl:if test="@type != '' or @default != ''">
       <xsl:text> (</xsl:text>
       <xsl:if test="../@unique = 1">
-	<xsl:text>unique, </xsl:text>
+        <xsl:text>unique, </xsl:text>
       </xsl:if>
       <xsl:choose>
-	<xsl:when test="../@required = 1">
-	  <xsl:text>required</xsl:text>
-	</xsl:when>
-	<xsl:otherwise>
-	  <xsl:text>optional</xsl:text>
-	</xsl:otherwise>
+        <xsl:when test="../@required = 1">
+          <xsl:text>required</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>optional</xsl:text>
+        </xsl:otherwise>
       </xsl:choose>
       <xsl:text>, </xsl:text>
       <xsl:if test="@parameter != ''">
-	<xsl:value-of select="@type"/>
-	<xsl:text>, </xsl:text>
+        <xsl:value-of select="@type"/>
+        <xsl:text>, </xsl:text>
       </xsl:if>
       <xsl:if test="@type != ''">
-	<xsl:value-of select="@type"/>
-	<xsl:text>, </xsl:text>
+        <xsl:value-of select="@type"/>
+        <xsl:text>, </xsl:text>
       </xsl:if>
       <xsl:choose>
-	  <xsl:when test="@default != ''">
-	    <xsl:text>default </xsl:text>
-	    <xsl:if test="@type = 'string'">
-	      <xsl:text>"</xsl:text>
-	    </xsl:if>
-	    <code>
-	      <xsl:value-of select="@default"/>
-	    </code>
-	    <xsl:if test="@type = 'string'">
-	      <xsl:text>"</xsl:text>
-	    </xsl:if>
-	  </xsl:when>
-	  <xsl:when test="@type='boolean' and @default = ''">
-	    <xsl:text>default </xsl:text>
-	    <code>false</code>
-	  </xsl:when>
-	  <xsl:otherwise>
-	    <xsl:text>no default</xsl:text>
-	  </xsl:otherwise>
+          <xsl:when test="@default != ''">
+            <xsl:text>default </xsl:text>
+            <xsl:if test="@type = 'string'">
+              <xsl:text>"</xsl:text>
+            </xsl:if>
+            <code>
+              <xsl:value-of select="@default"/>
+            </code>
+            <xsl:if test="@type = 'string'">
+              <xsl:text>"</xsl:text>
+            </xsl:if>
+          </xsl:when>
+          <xsl:when test="@type='boolean' and @default = ''">
+            <xsl:text>default </xsl:text>
+            <code>false</code>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:text>no default</xsl:text>
+          </xsl:otherwise>
       </xsl:choose>
       <xsl:text>)</xsl:text>
     </xsl:if>
@@ -315,16 +315,16 @@
     <refsection>
       <title>Supported Actions</title>
       <xsl:choose>
-	<xsl:when test="actions">
-	  <xsl:apply-templates select="actions" mode="actions"/>
-	</xsl:when>
-	<xsl:otherwise>
-	  <!-- This should actually never happen. Every RA must
-	       advertise the actions it supports. -->
-	  <para>
-	    <xsl:text>This resource agent does not advertise any supported actions.</xsl:text>
-	  </para>
-	</xsl:otherwise>
+        <xsl:when test="actions">
+          <xsl:apply-templates select="actions" mode="actions"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <!-- This should actually never happen. Every RA must
+               advertise the actions it supports. -->
+          <para>
+            <xsl:text>This resource agent does not advertise any supported actions.</xsl:text>
+          </para>
+        </xsl:otherwise>
       </xsl:choose>
     </refsection>
   </xsl:template>
@@ -340,64 +340,64 @@
    <varlistentry>
     <term>
       <option>
-	<xsl:value-of select="@name"/>
-	<xsl:if test="@role != ''">
-	  <xsl:text> (</xsl:text>
-	  <xsl:value-of select="@role"/>
-	  <xsl:text> role)</xsl:text>
-	</xsl:if>
+        <xsl:value-of select="@name"/>
+        <xsl:if test="@role != ''">
+          <xsl:text> (</xsl:text>
+          <xsl:value-of select="@role"/>
+          <xsl:text> role)</xsl:text>
+        </xsl:if>
       </option>
     </term>
     <listitem>
       <para>
-	<xsl:choose>
-	  <xsl:when test="@name = 'start'">
-	    <xsl:text>Starts the resource.</xsl:text>
-	  </xsl:when>
-	  <xsl:when test="@name = 'stop'">
-	    <xsl:text>Stops the resource.</xsl:text>
-	  </xsl:when>
-	  <xsl:when test="@name = 'status'">
-	    <xsl:text>Performs a status check.</xsl:text>
-	  </xsl:when>
-	  <xsl:when test="@name = 'monitor'">
-	    <xsl:text>Performs a detailed status check.</xsl:text>
-	  </xsl:when>
-	  <xsl:when test="@name = 'promote'">
-	    <xsl:text>Promotes the resource to the Master role.</xsl:text>
-	  </xsl:when>
-	  <xsl:when test="@name = 'demote'">
-	    <xsl:text>Demotes the resource to the Slave role.</xsl:text>
-	  </xsl:when>
-	  <xsl:when test="@name = 'migrate_from'">
-	    <xsl:text>Executes steps necessary for migrating the
-	    resource </xsl:text>
-	    <emphasis>away from</emphasis>
-	    <xsl:text> the node.</xsl:text>
-	  </xsl:when>
-	  <xsl:when test="@name = 'migrate_to'">
-	    <xsl:text>Executes steps necessary for migrating the
-	    resource </xsl:text>
-	    <emphasis>to</emphasis>
-	    <xsl:text> the node.</xsl:text>
-	  </xsl:when>
-	  <xsl:when test="@name = 'validate-all'">
-	    <xsl:text>Performs a validation of the resource configuration.</xsl:text>
-	  </xsl:when>
-	  <xsl:when test="@name = 'meta-data'">
-	    <xsl:text>Retrieves resource agent metadata (internal use only).</xsl:text>
-	  </xsl:when>
-	</xsl:choose>
-	<xsl:if test="@timeout != ''">
-	  <xsl:text> Suggested minimum timeout: </xsl:text>
-	  <xsl:value-of select="@timeout"/>
-	  <xsl:text>.</xsl:text>
-	</xsl:if>
-	<xsl:if test="@interval != ''">
-	  <xsl:text> Suggested interval: </xsl:text>
-	  <xsl:value-of select="@interval"/>
-	  <xsl:text>.</xsl:text>
-	</xsl:if>
+        <xsl:choose>
+          <xsl:when test="@name = 'start'">
+            <xsl:text>Starts the resource.</xsl:text>
+          </xsl:when>
+          <xsl:when test="@name = 'stop'">
+            <xsl:text>Stops the resource.</xsl:text>
+          </xsl:when>
+          <xsl:when test="@name = 'status'">
+            <xsl:text>Performs a status check.</xsl:text>
+          </xsl:when>
+          <xsl:when test="@name = 'monitor'">
+            <xsl:text>Performs a detailed status check.</xsl:text>
+          </xsl:when>
+          <xsl:when test="@name = 'promote'">
+            <xsl:text>Promotes the resource to the Master role.</xsl:text>
+          </xsl:when>
+          <xsl:when test="@name = 'demote'">
+            <xsl:text>Demotes the resource to the Slave role.</xsl:text>
+          </xsl:when>
+          <xsl:when test="@name = 'migrate_from'">
+            <xsl:text>Executes steps necessary for migrating the
+            resource </xsl:text>
+            <emphasis>away from</emphasis>
+            <xsl:text> the node.</xsl:text>
+          </xsl:when>
+          <xsl:when test="@name = 'migrate_to'">
+            <xsl:text>Executes steps necessary for migrating the
+            resource </xsl:text>
+            <emphasis>to</emphasis>
+            <xsl:text> the node.</xsl:text>
+          </xsl:when>
+          <xsl:when test="@name = 'validate-all'">
+            <xsl:text>Performs a validation of the resource configuration.</xsl:text>
+          </xsl:when>
+          <xsl:when test="@name = 'meta-data'">
+            <xsl:text>Retrieves resource agent metadata (internal use only).</xsl:text>
+          </xsl:when>
+        </xsl:choose>
+        <xsl:if test="@timeout != ''">
+          <xsl:text> Suggested minimum timeout: </xsl:text>
+          <xsl:value-of select="@timeout"/>
+          <xsl:text>.</xsl:text>
+        </xsl:if>
+        <xsl:if test="@interval != ''">
+          <xsl:text> Suggested interval: </xsl:text>
+          <xsl:value-of select="@interval"/>
+          <xsl:text>.</xsl:text>
+        </xsl:if>
       </para>
     </listitem>
    </varlistentry>
@@ -409,51 +409,51 @@
     <refsection>
       <title>Example CRM Shell</title>
       <para>
-	<xsl:text>The following is an example configuration for a </xsl:text>
-	<xsl:value-of select="@name"/>
-	<xsl:text> resource using the </xsl:text>
-	<citerefentry><refentrytitle>crm</refentrytitle><manvolnum>8</manvolnum></citerefentry>
-	<xsl:text> shell:</xsl:text>
+        <xsl:text>The following is an example configuration for a </xsl:text>
+        <xsl:value-of select="@name"/>
+        <xsl:text> resource using the </xsl:text>
+        <citerefentry><refentrytitle>crm</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+        <xsl:text> shell:</xsl:text>
       </para>
       <programlisting>
-	<xsl:text>primitive p_</xsl:text>
-	<xsl:value-of select="@name"/>
-	<xsl:text> </xsl:text>
-	<xsl:value-of select="$class"/>
-	<xsl:text>:</xsl:text>
-	<xsl:value-of select="$provider"/>
-	<xsl:text>:</xsl:text>
-	<xsl:choose>
-	  <xsl:when test="parameters/parameter[@required = 1]">
-	    <xsl:value-of select="@name"/>
-	    <xsl:text> \
+        <xsl:text>primitive p_</xsl:text>
+        <xsl:value-of select="@name"/>
+        <xsl:text> </xsl:text>
+        <xsl:value-of select="$class"/>
+        <xsl:text>:</xsl:text>
+        <xsl:value-of select="$provider"/>
+        <xsl:text>:</xsl:text>
+        <xsl:choose>
+          <xsl:when test="parameters/parameter[@required = 1]">
+            <xsl:value-of select="@name"/>
+            <xsl:text> \
   params \
 </xsl:text>
-	    <xsl:apply-templates select="parameters" mode="examplecrmsh"/>
-	  </xsl:when>
-	  <xsl:otherwise>
-	  <xsl:value-of select="@name"/><xsl:text> \</xsl:text>
-	  </xsl:otherwise>
-	</xsl:choose>
-	<!-- Insert a suggested allow-migrate meta attribute if the
-	     resource agent supports migration -->
-	<xsl:if test="actions/action[@name = 'migrate_from' or @name = 'migrate_to']">
-	  <xsl:text>
+            <xsl:apply-templates select="parameters" mode="examplecrmsh"/>
+          </xsl:when>
+          <xsl:otherwise>
+          <xsl:value-of select="@name"/><xsl:text> \</xsl:text>
+          </xsl:otherwise>
+        </xsl:choose>
+        <!-- Insert a suggested allow-migrate meta attribute if the
+             resource agent supports migration -->
+        <xsl:if test="actions/action[@name = 'migrate_from' or @name = 'migrate_to']">
+          <xsl:text>
   meta allow-migrate="true" \</xsl:text>
-	</xsl:if>
-	<xsl:apply-templates select="actions" mode="examplecrmsh"/>
+        </xsl:if>
+        <xsl:apply-templates select="actions" mode="examplecrmsh"/>
       </programlisting>
       <!-- Insert a master/slave set definition if the resource
       agent supports promotion and demotion -->
       <xsl:if test="actions/action/@name = 'promote' and actions/action/@name = 'demote'">
-	<programlisting>
-	  <xsl:text>ms ms_</xsl:text>
-	  <xsl:value-of select="@name"/>
-	  <xsl:text> p_</xsl:text>
-	  <xsl:value-of select="@name"/>
-	<xsl:text> \
+        <programlisting>
+          <xsl:text>ms ms_</xsl:text>
+          <xsl:value-of select="@name"/>
+          <xsl:text> p_</xsl:text>
+          <xsl:value-of select="@name"/>
+        <xsl:text> \
   meta notify="true" interleave="true"</xsl:text>
-	</programlisting>
+        </programlisting>
       </xsl:if>
     </refsection>
   </xsl:template>
@@ -477,12 +477,12 @@
   <xsl:template match="content" mode="examplecrmsh">
     <xsl:choose>
       <xsl:when test="@default != ''">
-	<xsl:text>"</xsl:text>
-	<xsl:value-of select="@default"/>
-	<xsl:text>"</xsl:text>
+        <xsl:text>"</xsl:text>
+        <xsl:value-of select="@default"/>
+        <xsl:text>"</xsl:text>
       </xsl:when>
       <xsl:otherwise>
-	<replaceable><xsl:value-of select="@type"/></replaceable>
+        <replaceable><xsl:value-of select="@type"/></replaceable>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>
@@ -507,10 +507,10 @@
     <xsl:choose>
       <xsl:when test="name() = 'name'"><!-- suppress --></xsl:when>
       <xsl:otherwise>
-	<xsl:value-of select="name()"/>
-	<xsl:text>="</xsl:text>
-	<xsl:value-of select="current()"/>
-	<xsl:text>" </xsl:text>
+        <xsl:value-of select="name()"/>
+        <xsl:text>="</xsl:text>
+        <xsl:value-of select="current()"/>
+        <xsl:text>" </xsl:text>
       </xsl:otherwise>
     </xsl:choose>
     <xsl:if test="following-sibling::*">
@@ -527,36 +527,36 @@
     <refsection>
       <title>Example PCS</title>
       <para>
-	<xsl:text>The following is an example configuration for a </xsl:text>
-	<xsl:value-of select="@name"/>
-	<xsl:text> resource using </xsl:text>
-	<citerefentry><refentrytitle>pcs</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+        <xsl:text>The following is an example configuration for a </xsl:text>
+        <xsl:value-of select="@name"/>
+        <xsl:text> resource using </xsl:text>
+        <citerefentry><refentrytitle>pcs</refentrytitle><manvolnum>8</manvolnum></citerefentry>
       </para>
       <programlisting>
-	<xsl:text>pcs resource create p_</xsl:text>
-	<xsl:value-of select="@name"/>
-	<xsl:text> </xsl:text>
-	<xsl:value-of select="$class"/>
-	<xsl:text>:</xsl:text>
-	<xsl:value-of select="$provider"/>
-	<xsl:text>:</xsl:text>
-	<xsl:choose>
-	  <xsl:when test="parameters/parameter[@required = 1]">
-	    <xsl:value-of select="@name"/>
-	    <xsl:text> \
+        <xsl:text>pcs resource create p_</xsl:text>
+        <xsl:value-of select="@name"/>
+        <xsl:text> </xsl:text>
+        <xsl:value-of select="$class"/>
+        <xsl:text>:</xsl:text>
+        <xsl:value-of select="$provider"/>
+        <xsl:text>:</xsl:text>
+        <xsl:choose>
+          <xsl:when test="parameters/parameter[@required = 1]">
+            <xsl:value-of select="@name"/>
+            <xsl:text> \
 </xsl:text>
-	    <xsl:apply-templates select="parameters" mode="examplepcs"/>
-	  </xsl:when>
-	  <xsl:otherwise>
-	  <xsl:value-of select="@name"/><xsl:text> \</xsl:text>
-	  </xsl:otherwise>
-	</xsl:choose>
-	<xsl:apply-templates select="actions" mode="examplepcs"/>
+            <xsl:apply-templates select="parameters" mode="examplepcs"/>
+          </xsl:when>
+          <xsl:otherwise>
+          <xsl:value-of select="@name"/><xsl:text> \</xsl:text>
+          </xsl:otherwise>
+        </xsl:choose>
+        <xsl:apply-templates select="actions" mode="examplepcs"/>
 
      <!-- Insert a master/slave set definition if the resource
       agent supports promotion and demotion -->
       <xsl:if test="actions/action/@name = 'promote' and actions/action/@name = 'demote'">
-	  <xsl:text>--master</xsl:text>
+          <xsl:text>--master</xsl:text>
       </xsl:if>
       </programlisting>
 
@@ -582,12 +582,12 @@
   <xsl:template match="content" mode="examplepcs">
     <xsl:choose>
       <xsl:when test="@default != ''">
-	<xsl:text>"</xsl:text>
-	<xsl:value-of select="@default"/>
-	<xsl:text>"</xsl:text>
+        <xsl:text>"</xsl:text>
+        <xsl:value-of select="@default"/>
+        <xsl:text>"</xsl:text>
       </xsl:when>
       <xsl:otherwise>
-	<replaceable><xsl:value-of select="@type"/></replaceable>
+        <replaceable><xsl:value-of select="@type"/></replaceable>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>
@@ -612,10 +612,10 @@
     <xsl:choose>
       <xsl:when test="name() = 'name'"><!-- suppress --></xsl:when>
       <xsl:otherwise>
-	<xsl:value-of select="name()"/>
-	<xsl:text>="</xsl:text>
-	<xsl:value-of select="current()"/>
-	<xsl:text>" </xsl:text>
+        <xsl:value-of select="name()"/>
+        <xsl:text>="</xsl:text>
+        <xsl:value-of select="current()"/>
+        <xsl:text>" </xsl:text>
       </xsl:otherwise>
     </xsl:choose>
     <xsl:if test="following-sibling::*">
@@ -630,13 +630,11 @@
     <refsection>
       <title>See also</title>
       <para>
-	<ulink>
-	  <xsl:attribute name="url">
-	    <xsl:text>http://www.linux-ha.org/wiki/</xsl:text>
-	    <xsl:value-of select="@name"/>
-	    <xsl:text>_(resource_agent)</xsl:text>
-	  </xsl:attribute>
-	</ulink>
+        <ulink>
+          <xsl:attribute name="url">
+            <xsl:text>http://clusterlabs.org/</xsl:text>
+          </xsl:attribute>
+        </ulink>
       </para>
     </refsection>
   </xsl:template>
diff --git a/doc/man/ralist.sh b/doc/man/ralist.sh
index ef8f528..31444b6 100755
--- a/doc/man/ralist.sh
+++ b/doc/man/ralist.sh
@@ -4,6 +4,6 @@ RADIR=$1
 PREFIX=$2
 SUFFIX=$3
 
-for f in `find $RADIR -type f -executable`; do
-    echo ${PREFIX}`basename $f`${SUFFIX}
+find "$RADIR" -type f -executable | while read -r file; do
+    echo "${PREFIX}$(basename "$file")${SUFFIX}"
 done
diff --git a/heartbeat/AoEtarget b/heartbeat/AoEtarget
index b18b3a0..176ecd0 100755
--- a/heartbeat/AoEtarget
+++ b/heartbeat/AoEtarget
@@ -48,7 +48,7 @@ meta_data() {
     cat <<EOF
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="AoEtarget" version="0.1">
+<resource-agent name="AoEtarget">
   <version>1.0</version>
   <longdesc lang="en">
 This resource agent manages an ATA-over-Ethernet (AoE) target using vblade.
diff --git a/heartbeat/CTDB b/heartbeat/CTDB
index 6cfff63..b23ffae 100755
--- a/heartbeat/CTDB
+++ b/heartbeat/CTDB
@@ -113,7 +113,7 @@ meta_data() {
 	cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="CTDB" version="1.0">
+<resource-agent name="CTDB">
 <version>1.0</version>
 
 <longdesc lang="en">
@@ -359,7 +359,7 @@ if [ -f /etc/sysconfig/ctdb ]; then
 	CTDB_SYSCONFIG=/etc/sysconfig/ctdb
 elif [ -f /etc/default/ctdb ]; then
 	CTDB_SYSCONFIG=/etc/default/ctdb
-elif [ -f $OCF_RESKEY_ctdb_config_dir/ctdb ]; then
+elif [ -f "$OCF_RESKEY_ctdb_config_dir/ctdb" ]; then
 	CTDB_SYSCONFIG=$OCF_RESKEY_ctdb_config_dir/ctdb
 fi
 
@@ -368,14 +368,16 @@ CTDB_SYSCONFIG_BACKUP=${CTDB_SYSCONFIG}.ctdb-ra-orig
 
 invoke_ctdb() {
 	# CTDB's defaults are:
-	local timeout=3
-	local timelimit=120
+	local timeout
+	local timelimit
+	timeout=3
+	timelimit=120
 	# ...but we override with the timeout for the current op:
 	if [ -n "$OCF_RESKEY_CRM_meta_timeout" ]; then
 		timeout=$((OCF_RESKEY_CRM_meta_timeout/1000))
 		timelimit=$((OCF_RESKEY_CRM_meta_timeout/1000))
 	fi
-	$OCF_RESKEY_ctdb_binary --socket=$OCF_RESKEY_ctdb_socket \
+	$OCF_RESKEY_ctdb_binary --socket="$OCF_RESKEY_ctdb_socket" \
 		-t $timeout -T $timelimit \
 		"$@"
 }
@@ -385,23 +387,24 @@ invoke_ctdb() {
 # with CTDB, but will generally have no effect, beacuase the relevant
 # CTDB_MANAGES_* options won't be set in /etc/sysconfig/ctdb.
 enable_event_scripts() {
-	local event_dir=$OCF_RESKEY_ctdb_config_dir/events.d
+	local event_dir
+	event_dir=$OCF_RESKEY_ctdb_config_dir/events.d
 
 	if [ -f "${OCF_RESKEY_ctdb_config_dir}/public_addresses" ]; then
-		chmod u+x $event_dir/10.interface
+		chmod u+x "$event_dir/10.interface"
 	else
-		chmod a-x $event_dir/10.interface
+		chmod a-x "$event_dir/10.interface"
 	fi
 	if [ -f "${OCF_RESKEY_ctdb_config_dir}/static-routes" ]; then
-		chmod u+x $event_dir/11.routing
+		chmod u+x "$event_dir/11.routing"
 	else
-		chmod a-x $event_dir/11.routing
+		chmod a-x "$event_dir/11.routing"
 	fi
 	if ocf_is_true "$OCF_RESKEY_ctdb_manages_samba" || \
 	   ocf_is_true "$OCF_RESKEY_ctdb_manages_winbind"; then
-		chmod u+x $event_dir/50.samba
+		chmod u+x "$event_dir/50.samba"
 	else
-		chmod a-x $event_dir/50.samba
+		chmod a-x "$event_dir/50.samba"
 	fi
 }
 
@@ -411,9 +414,9 @@ set_ctdb_variables() {
 	rv=$OCF_SUCCESS
 	set | grep ^CTDB_SET_ | cut -d_ -f3- |
 	while read v; do
-		varname=`echo $v | cut -d= -f1`
-		value=`echo $v | cut -d= -f2`
-		invoke_ctdb setvar $varname $value || rv=$OCF_ERR_GENERIC
+		varname=$(echo "$v" | cut -d= -f1)
+		value=$(echo "$v" | cut -d= -f2)
+		invoke_ctdb setvar "$varname" "$value" || rv=$OCF_ERR_GENERIC
 	done || rv=$OCF_ERR_GENERIC
 	return $rv
 }
@@ -434,13 +437,15 @@ init_smb_conf() {
 	ocf_is_true "$OCF_RESKEY_ctdb_manages_samba" || return 0
 
 	# replace these things in smb.conf
-	local repl='# CTDB-RA:|passdb backend|clustering|idmap backend|private dir|ctdbd socket'
+	local repl
+	repl='# CTDB-RA:|passdb backend|clustering|idmap backend|private dir|ctdbd socket'
 
 	local private_dir
 	[ -n "$OCF_RESKEY_smb_private_dir" ] && private_dir="\tprivate dir = $OCF_RESKEY_smb_private_dir\n"
 
 	local vfs_fileid
-	local do_vfs=0
+	local do_vfs
+	do_vfs=0
 	if  [ -n "$OCF_RESKEY_smb_fileid_algorithm" ]; then
 		repl="${repl}|fileid:algorithm|fileid:mapping"
 		vfs_fileid="\tfileid:algorithm = $OCF_RESKEY_smb_fileid_algorithm\n"
@@ -453,7 +458,7 @@ init_smb_conf() {
 		fi
 	fi
 	# Preserve permissions of smb.conf
-	cp -a $OCF_RESKEY_smb_conf $OCF_RESKEY_smb_conf.$$
+	cp -a "$OCF_RESKEY_smb_conf" "$OCF_RESKEY_smb_conf.$$"
 	awk '
 		/^[[:space:]]*\[/ { global = 0 }
 		/^[[:space:]]*\[global\]/ { global = 1 }
@@ -467,15 +472,15 @@ init_smb_conf() {
 			} else {
 				print
 			}
-		}' $OCF_RESKEY_smb_conf | sed "/^[[:space:]]*\[global\]/ a\\
+		}' "$OCF_RESKEY_smb_conf" | sed "/^[[:space:]]*\[global\]/ a\\
 \t# CTDB-RA: Begin auto-generated section (do not change below)\n\
 \tpassdb backend = $OCF_RESKEY_smb_passdb_backend\n\
 \tclustering = yes\n\
 \tidmap backend = $OCF_RESKEY_smb_idmap_backend\n\
 \tctdbd socket = $OCF_RESKEY_ctdb_socket\n$private_dir$vfs_fileid\
-\t# CTDB-RA: End auto-generated section (do not change above)" > $OCF_RESKEY_smb_conf.$$
-	dd conv=notrunc,fsync of=$OCF_RESKEY_smb_conf.$$ if=/dev/null >/dev/null 2>&1
-	mv $OCF_RESKEY_smb_conf.$$ $OCF_RESKEY_smb_conf
+\t# CTDB-RA: End auto-generated section (do not change above)" > "$OCF_RESKEY_smb_conf.$$"
+	dd conv=notrunc,fsync of="$OCF_RESKEY_smb_conf.$$" if=/dev/null >/dev/null 2>&1
+	mv "$OCF_RESKEY_smb_conf.$$" "$OCF_RESKEY_smb_conf"
 }
 
 
@@ -484,13 +489,13 @@ cleanup_smb_conf() {
 	ocf_is_true "$OCF_RESKEY_ctdb_manages_samba" || return 0
 
 	# preserve permissions of smb.conf
-	cp -a $OCF_RESKEY_smb_conf $OCF_RESKEY_smb_conf.$$
-	sed '/# CTDB-RA: Begin/,/# CTDB-RA: End/d' $OCF_RESKEY_smb_conf > $OCF_RESKEY_smb_conf.$$
-	mv $OCF_RESKEY_smb_conf.$$ $OCF_RESKEY_smb_conf
+	cp -a "$OCF_RESKEY_smb_conf" "$OCF_RESKEY_smb_conf.$$"
+	sed '/# CTDB-RA: Begin/,/# CTDB-RA: End/d' "$OCF_RESKEY_smb_conf" > "$OCF_RESKEY_smb_conf.$$"
+	mv "$OCF_RESKEY_smb_conf.$$" "$OCF_RESKEY_smb_conf"
 }
 
 append_ctdb_sysconfig() {
-	[ -n "$2" ] && echo "$1=$2" >> $CTDB_SYSCONFIG
+	[ -n "$2" ] && echo "$1=$2" >> "$CTDB_SYSCONFIG"
 }
 
 # Generate a new, minimal CTDB config file that's just enough
@@ -547,8 +552,8 @@ ctdb_start() {
 	# Die if databases are corrupted
 	persistent_db_dir="${OCF_RESKEY_ctdb_dbdir}/persistent"
 	mkdir -p $persistent_db_dir 2>/dev/null
-	for pdbase in $(ls $persistent_db_dir/*.tdb.[0-9] 2>/dev/null$) ; do
-		/usr/bin/tdbdump $pdbase >/dev/null 2>/dev/null || {
+	for pdbase in $persistent_db_dir/*.tdb.[0-9]; do
+		/usr/bin/tdbdump "$pdbase" >/dev/null 2>/dev/null || {
 			ocf_exit_reason "Persistent database $pdbase is corrupted!  CTDB will not start."
 			return $OCF_ERR_GENERIC
 		}
@@ -566,7 +571,8 @@ ctdb_start() {
 	enable_event_scripts
 
 	# Use logfile by default, or syslog if asked for
-	local log_option="--logfile=$OCF_RESKEY_ctdb_logfile"
+	local log_option
+	log_option="--logfile=$OCF_RESKEY_ctdb_logfile"
 	if [ "$OCF_RESKEY_ctdb_logfile" = "syslog" ]; then
 		log_option="--syslog"
 	elif [ ! -d "$(dirname $OCF_RESKEY_ctdb_logfile)" ]; then
@@ -578,25 +584,27 @@ ctdb_start() {
 	mkdir -p $OCF_RESKEY_ctdb_rundir 2>/dev/null
 
 	# public addresses file (should not be present, but need to set for correctness if it is)
-	local pub_addr_option=""
+	local pub_addr_option
+	pub_addr_option=""
 	[ -f "${OCF_RESKEY_ctdb_config_dir}/public_addresses" ] && \
 		pub_addr_option="--public-addresses=${OCF_RESKEY_ctdb_config_dir}/public_addresses"
 	# start as disabled
-	local start_as_disabled="--start-as-disabled"
+	local start_as_disabled
+	start_as_disabled="--start-as-disabled"
 	ocf_is_true "$OCF_RESKEY_ctdb_start_as_disabled" || start_as_disabled=""
 
 	# Start her up
-	$OCF_RESKEY_ctdbd_binary \
-		--reclock=$OCF_RESKEY_ctdb_recovery_lock \
-		--nlist=$OCF_RESKEY_ctdb_config_dir/nodes \
-		--socket=$OCF_RESKEY_ctdb_socket \
-		--dbdir=$OCF_RESKEY_ctdb_dbdir \
-		--dbdir-persistent=$OCF_RESKEY_ctdb_dbdir/persistent \
-		--event-script-dir=$OCF_RESKEY_ctdb_config_dir/events.d \
-		--notification-script=$OCF_RESKEY_ctdb_config_dir/notify.sh \
+	"$OCF_RESKEY_ctdbd_binary" \
+		--reclock="$OCF_RESKEY_ctdb_recovery_lock" \
+		--nlist="$OCF_RESKEY_ctdb_config_dir/nodes" \
+		--socket="$OCF_RESKEY_ctdb_socket" \
+		--dbdir="$OCF_RESKEY_ctdb_dbdir" \
+		--dbdir-persistent="$OCF_RESKEY_ctdb_dbdir/persistent" \
+		--event-script-dir="$OCF_RESKEY_ctdb_config_dir/events.d" \
+		--notification-script="$OCF_RESKEY_ctdb_config_dir/notify.sh" \
 		--transport=tcp \
 		$start_as_disabled $log_option $pub_addr_option \
-		-d $OCF_RESKEY_ctdb_debuglevel
+		-d "$OCF_RESKEY_ctdb_debuglevel"
 	if [ $? -ne 0 ]; then
 		# cleanup smb.conf
 		cleanup_smb_conf
@@ -618,7 +626,7 @@ ctdb_start() {
 				ocf_exit_reason "Can't invoke $OCF_RESKEY_ctdb_binary --socket=$OCF_RESKEY_ctdb_socket status"
 				return $OCF_ERR_GENERIC
 			fi
-			if ! echo $status | grep -qs 'UNHEALTHY (THIS'; then
+			if ! echo "$status" | grep -qs 'UNHEALTHY (THIS'; then
 				# Status does not say this node is unhealthy,
 				# so we're good to go.  Do a bit of final
 				# setup and (hopefully) return success.
@@ -638,7 +646,7 @@ ctdb_start() {
 
 ctdb_stop() {
 	# Do nothing if already stopped
-	pkill -0 -f $OCF_RESKEY_ctdbd_binary || return $OCF_SUCCESS
+	pkill -0 -f "$OCF_RESKEY_ctdbd_binary" || return $OCF_SUCCESS
 
 	# Tell it to die nicely
 	invoke_ctdb shutdown >/dev/null 2>&1
@@ -646,13 +654,13 @@ ctdb_stop() {
 
 	# No more Mr. Nice Guy
 	count=0
-	while pkill -0 -f $OCF_RESKEY_ctdbd_binary ; do
+	while pkill -0 -f "$OCF_RESKEY_ctdbd_binary" ; do
 		sleep 1
-		count=$(($count + 1))
+		count=$((count + 1))
 		[ $count -gt 10 ] && {
 			ocf_log info "killing ctdbd "
-			pkill -9 -f $OCF_RESKEY_ctdbd_binary
-			pkill -9 -f ${OCF_RESKEY_ctdb_config_dir}/events.d/
+			pkill -9 -f "$OCF_RESKEY_ctdbd_binary"
+			pkill -9 -f "${OCF_RESKEY_ctdb_config_dir}/events.d/"
 		}
 	done
 
@@ -664,7 +672,7 @@ ctdb_stop() {
 
 	# Unclean shutdown, return success if there's no ctdbds left (we
 	# killed them forcibly, but at least they're good and dead).
-	pkill -0 -f $OCF_RESKEY_ctdbd_binary || return $OCF_SUCCESS
+	pkill -0 -f "$OCF_RESKEY_ctdbd_binary" || return $OCF_SUCCESS
 
 	# Problem: ctdb shutdown didn't work and neither did some vigorous
 	# kill -9ing.  Only thing to do is report failure.
@@ -681,16 +689,16 @@ ctdb_monitor() {
 	# whereas if it's wedged, it'll say various other unpleasant things.
 	status=$(invoke_ctdb status 2>&1)
 	if [ $? -ne 0 ]; then
-		if echo $status | grep -qs 'Connection refused'; then
+		if echo "$status" | grep -qs 'Connection refused'; then
 			return $OCF_NOT_RUNNING
-		elif echo $status | grep -qs 'No such file or directory'; then
+		elif echo "$status" | grep -qs 'No such file or directory'; then
 			return $OCF_NOT_RUNNING
 		else
 			ocf_exit_reason "CTDB status call failed: $status"
 			return $OCF_ERR_GENERIC
 		fi
 	fi
-	if echo $status | grep -Eqs '(OK|DISABLED) \(THIS'; then
+	if echo "$status" | grep -Eqs '(OK|DISABLED) \(THIS'; then
 		return $OCF_SUCCESS
 	fi
 
diff --git a/heartbeat/ClusterMon b/heartbeat/ClusterMon
index 0e15664..95cb860 100755
--- a/heartbeat/ClusterMon
+++ b/heartbeat/ClusterMon
@@ -5,7 +5,7 @@
 #	Starts crm_mon in background which logs cluster status as
 #	html to the specified file.
 #
-# Copyright (c) 2004 SUSE LINUX AG, Lars Marowsky-Br�e
+# Copyright (c) 2004 SUSE LINUX AG, Lars Marowsky-Bree
 #                    All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify
diff --git a/heartbeat/Delay b/heartbeat/Delay
index 9cfa939..ab07965 100755
--- a/heartbeat/Delay
+++ b/heartbeat/Delay
@@ -1,7 +1,7 @@
 #!/bin/sh
 #
 #
-# Support:      linux-ha at lists.linux-ha.org
+# Support:      users at clusterlabs.org
 # License:      GNU General Public License (GPL)
 #
 #	This script is a test resource for introducing delay.
@@ -14,7 +14,7 @@
 #		OCF_RESKEY_mondelay
 #
 #	
-#		OCF_RESKEY_startdelay defaults to 30 (seconds)
+#		OCF_RESKEY_startdelay defaults to 20 (seconds)
 #		OCF_RESKEY_stopdelay defaults to $OCF_RESKEY_startdelay
 #		OCF_RESKEY_mondelay defaults to $OCF_RESKEY_startdelay
 #
@@ -55,7 +55,7 @@ This script is a test resource for introducing delay.
 How long in seconds to delay on start operation.
 </longdesc>
 <shortdesc lang="en">Start delay</shortdesc>
-<content type="integer" default="30" />
+<content type="integer" default="20" />
 </parameter>
 
 <parameter name="stopdelay" unique="0"  required="0">
@@ -195,7 +195,7 @@ if [ $# -ne 1 ]; then
   exit $OCF_ERR_ARGS
 fi
 
-: ${OCF_RESKEY_startdelay=30}
+: ${OCF_RESKEY_startdelay=20}
 : ${OCF_RESKEY_stopdelay=$OCF_RESKEY_startdelay}
 : ${OCF_RESKEY_mondelay=$OCF_RESKEY_startdelay}
 
diff --git a/heartbeat/Dummy b/heartbeat/Dummy
index a0929fa..61b442c 100755
--- a/heartbeat/Dummy
+++ b/heartbeat/Dummy
@@ -4,7 +4,7 @@
 #	Dummy OCF RA. Does nothing but wait a few seconds, can be
 #	configured to fail occassionally.
 #
-# Copyright (c) 2004 SUSE LINUX AG, Lars Marowsky-Br�e
+# Copyright (c) 2004 SUSE LINUX AG, Lars Marowsky-Bree
 #                    All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -39,7 +39,7 @@ meta_data() {
 	cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="Dummy" version="0.9">
+<resource-agent name="Dummy">
 <version>1.0</version>
 
 <longdesc lang="en">
diff --git a/heartbeat/EvmsSCC b/heartbeat/EvmsSCC
index 802bac4..21dfc7b 100755
--- a/heartbeat/EvmsSCC
+++ b/heartbeat/EvmsSCC
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Support:      linux-ha at lists.linux-ha.org
+# Support:      users at clusterlabs.org
 # License:      GNU General Public License (GPL)
 #
 # EvmsSCC
diff --git a/heartbeat/Evmsd b/heartbeat/Evmsd
index 40c4aec..c41fd82 100755
--- a/heartbeat/Evmsd
+++ b/heartbeat/Evmsd
@@ -37,7 +37,7 @@ meta_data() {
 	cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="Evmsd" version="0.9">
+<resource-agent name="Evmsd">
 <version>1.0</version>
 
 <longdesc lang="en">
diff --git a/heartbeat/Filesystem b/heartbeat/Filesystem
index e594148..4b9b3f0 100755
--- a/heartbeat/Filesystem
+++ b/heartbeat/Filesystem
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Support:      linux-ha at lists.linux-ha.org
+# Support:      users at clusterlabs.org
 # License:      GNU General Public License (GPL)
 # 
 # Filesystem
@@ -395,6 +395,12 @@ fstype_supported()
 #
 Filesystem_start()
 {
+	# Check if there are any mounts mounted under the mountpoint
+	if list_mounts | grep -q -E " $MOUNTPOINT/\w+" >/dev/null 2>&1; then
+		ocf_log err "There is one or more mounts mounted under $MOUNTPOINT."
+		return $OCF_ERR_CONFIGURED
+	fi
+
 	# See if the device is already mounted.
 	if Filesystem_status >/dev/null 2>&1 ; then
 		ocf_log info "Filesystem $MOUNTPOINT is already mounted."
@@ -448,7 +454,7 @@ Filesystem_start()
 	esac
 
 	if [ $? -ne 0 ]; then
-		ocf_exit_reason "Couldn't mount filesystem $DEVICE on $MOUNTPOINT"
+		ocf_exit_reason "Couldn't mount device [$DEVICE] as $MOUNTPOINT"
 		return $OCF_ERR_GENERIC
 	fi
 	return $OCF_SUCCESS
@@ -680,7 +686,7 @@ Filesystem_monitor()
 #
 Filesystem_validate_all()
 {
-	if [ -n $MOUNTPOINT -a ! -d $MOUNTPOINT ]; then
+	if [ -n "$MOUNTPOINT" ] && [ ! -d "$MOUNTPOINT" ]; then
 		ocf_log warn "Mountpoint $MOUNTPOINT does not exist"
 	fi
 
diff --git a/heartbeat/ICP b/heartbeat/ICP
index c427e7a..8f187e0 100755
--- a/heartbeat/ICP
+++ b/heartbeat/ICP
@@ -7,7 +7,7 @@
 #
 #
 # Author:	Lars Marowsky-Bree <lmb at suse.de>
-# Support:	linux-ha at lists.linux-ha.org
+# Support:	users at clusterlabs.org
 # License:	GNU General Public License (GPL)
 # Copyright:	(C) 2002 SuSE Linux AG
 #
diff --git a/heartbeat/IPaddr b/heartbeat/IPaddr
index 8ada6c4..8c9fb20 100755
--- a/heartbeat/IPaddr
+++ b/heartbeat/IPaddr
@@ -1,7 +1,7 @@
 #!/bin/sh
 #
 # License:      GNU General Public License (GPL) 
-# Support:      linux-ha at lists.linux-ha.org
+# Support:      users at clusterlabs.org
 #
 #	This script manages IP alias IP addresses
 #
diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2
index b224ca5..b416e31 100755
--- a/heartbeat/IPaddr2
+++ b/heartbeat/IPaddr2
@@ -76,6 +76,7 @@ OCF_RESKEY_clusterip_hash_default="sourceip-sourceport"
 OCF_RESKEY_unique_clone_address_default=false
 OCF_RESKEY_arp_interval_default=200
 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"
 
@@ -86,6 +87,7 @@ OCF_RESKEY_arp_mac_default="ffffffffffff"
 : ${OCF_RESKEY_unique_clone_address=${OCF_RESKEY_unique_clone_address_default}}
 : ${OCF_RESKEY_arp_interval=${OCF_RESKEY_arp_interval_default}}
 : ${OCF_RESKEY_arp_count=${OCF_RESKEY_arp_count_default}}
+: ${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}}
 #######################################################################
@@ -274,12 +276,22 @@ Specify the interval between unsolicited ARP packets in milliseconds.
 
 <parameter name="arp_count">
 <longdesc lang="en">
-Number of unsolicited ARP packets to send.
+Number of unsolicited ARP packets to send at resource initialization.
 </longdesc>
-<shortdesc lang="en">ARP packet count</shortdesc>
+<shortdesc lang="en">ARP packet count sent during initialization</shortdesc>
 <content type="integer" default="${OCF_RESKEY_arp_count_default}"/>
 </parameter>
 
+<parameter name="arp_count_refresh">
+<longdesc lang="en">
+Number of unsolicited ARP packets to send during resource monitoring. Doing
+so helps mitigate issues of stuck ARP caches resulting from split-brain
+situations.
+</longdesc>
+<shortdesc lang="en">ARP packet count sent during monitoring</shortdesc>
+<content type="integer" default="${OCF_RESKEY_arp_count_refresh_default}"/>
+</parameter>
+
 <parameter name="arp_bg">
 <longdesc lang="en">
 Whether or not to send the ARP packets in the background.
@@ -351,7 +363,7 @@ ip_init() {
 		exit $OCF_ERR_INSTALLED
 	fi
 
-	if [ X"$OCF_RESKEY_ip" = "X" ]; then
+	if [ X"$OCF_RESKEY_ip" = "X" ] && [ "$__OCF_ACTION" != "stop" ]; then
 		ocf_exit_reason "IP address (the ip parameter) is mandatory"
 		exit $OCF_ERR_CONFIGURED
 	fi
@@ -660,20 +672,30 @@ is_infiniband() {
 # Run send_arp to note peers about new mac address
 #
 run_send_arp() {
-	ARGS="-i $OCF_RESKEY_arp_interval -r $OCF_RESKEY_arp_count -p $SENDARPPIDFILE $NIC $OCF_RESKEY_ip auto not_used not_used"
 	if [ "x$IP_CIP" = "xyes" ] ; then
 	    if [ x = "x$IF_MAC" ] ; then
 		MY_MAC=auto
 	    else
 		MY_MAC=`echo ${IF_MAC} | sed -e 's/://g'`
 	    fi
-	    ARGS="-i $OCF_RESKEY_arp_interval -r $OCF_RESKEY_arp_count -p $SENDARPPIDFILE $NIC $OCF_RESKEY_ip $MY_MAC not_used not_used"
+	else
+		MY_MAC=auto
 	fi
-	ocf_log info "$SENDARP $ARGS"
-	if ocf_is_true $OCF_RESKEY_arp_bg; then
-		($SENDARP $ARGS || ocf_log err "Could not send gratuitous arps")& >&2
+	if [ "x$1" = "xrefresh" ] ; then
+		ARP_COUNT=$OCF_RESKEY_arp_count_refresh
+		LOGLEVEL=debug
 	else
-		$SENDARP $ARGS || ocf_log err "Could not send gratuitous arps"
+		ARP_COUNT=$OCF_RESKEY_arp_count
+		LOGLEVEL=info
+	fi
+	if [ $ARP_COUNT -ne 0 ] ; then
+		ARGS="-i $OCF_RESKEY_arp_interval -r $ARP_COUNT -p $SENDARPPIDFILE $NIC $OCF_RESKEY_ip $MY_MAC not_used not_used"
+		ocf_log $LOGLEVEL "$SENDARP $ARGS"
+		if ocf_is_true $OCF_RESKEY_arp_bg; then
+			($SENDARP $ARGS || ocf_log err "Could not send gratuitous arps")& >&2
+		else
+			$SENDARP $ARGS || ocf_log err "Could not send gratuitous arps"
+		fi
 	fi
 }
 
@@ -720,12 +742,21 @@ run_send_ua() {
 # Run ipoibarping to note peers about new Infiniband address
 #
 run_send_ib_arp() {
-	ARGS="-q -c $OCF_RESKEY_arp_count -U -I $NIC $OCF_RESKEY_ip"
-	ocf_log info "ipoibarping $ARGS"
-	if ocf_is_true $OCF_RESKEY_arp_bg; then
-		(ipoibarping $ARGS || ocf_log err "Could not send gratuitous arps")& >&2
+	if [ "x$1" = "xrefresh" ] ; then
+		ARP_COUNT=$OCF_RESKEY_arp_count_refresh
+		LOGLEVEL=debug
 	else
-		ipoibarping $ARGS || ocf_log err "Could not send gratuitous arps"
+		ARP_COUNT=$OCF_RESKEY_arp_count
+		LOGLEVEL=info
+	fi
+	if [ $ARP_COUNT -ne 0 ] ; then
+		ARGS="-q -c $ARP_COUNT -U -I $NIC $OCF_RESKEY_ip"
+		ocf_log $LOGLEVEL "ipoibarping $ARGS"
+		if ocf_is_true $OCF_RESKEY_arp_bg; then
+			(ipoibarping $ARGS || ocf_log err "Could not send gratuitous arps")& >&2
+		else
+			ipoibarping $ARGS || ocf_log err "Could not send gratuitous arps"
+		fi
 	fi
 }
 
@@ -946,6 +977,7 @@ ip_monitor() {
 	local ip_status=`ip_served`
 	case $ip_status in
 	ok)
+		$ARP_SEND_FUN refresh
 		return $OCF_SUCCESS
 		;;
 	partial|no|partial2)
diff --git a/heartbeat/IPsrcaddr b/heartbeat/IPsrcaddr
index 33c5be6..08fd8a6 100755
--- a/heartbeat/IPsrcaddr
+++ b/heartbeat/IPsrcaddr
@@ -3,7 +3,7 @@
 #	Description:	IPsrcaddr - Preferred source address modification
 #
 #	Author:			John Sutton <john at scl.co.uk>
-#	Support:		linux-ha at lists.linux-ha.org
+#	Support:		users at clusterlabs.org
 #	License:		GNU General Public License (GPL)
 #	Copyright:		SCL Internet
 #
diff --git a/heartbeat/LVM b/heartbeat/LVM
index 5d202c6..79c2791 100755
--- a/heartbeat/LVM
+++ b/heartbeat/LVM
@@ -7,7 +7,7 @@
 #
 #
 # Author:	Alan Robertson
-# Support:	linux-ha at lists.linux-ha.org
+# Support:	users at clusterlabs.org
 # License:	GNU General Public License (GPL)
 # Copyright:	(C) 2002 - 2005 International Business Machines, Inc.
 #
@@ -386,7 +386,7 @@ get_activate_options()
 ##
 retry_exclusive_start()
 {
-	local vgchange_options=$(get_activate_options)
+	local vgchange_options="$(get_activate_options)"
 
 	# Deactivate each LV in the group one by one cluster wide
 	set -- $(lvs -o name,attr --noheadings $OCF_RESKEY_volgrpname 2> /dev/null)
@@ -412,7 +412,7 @@ retry_exclusive_start()
 #	Enable LVM volume
 #
 LVM_start() {
-	local vgchange_options=$(get_activate_options)
+	local vgchange_options="$(get_activate_options)"
 	local vg=$1
 	local clvmd=0
 
@@ -548,7 +548,7 @@ 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 'unknown device' > /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
 				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"
diff --git a/heartbeat/LinuxSCSI b/heartbeat/LinuxSCSI
index ce033c0..89fed6b 100755
--- a/heartbeat/LinuxSCSI
+++ b/heartbeat/LinuxSCSI
@@ -8,7 +8,7 @@
 #
 #
 # Author:	Alan Robertson
-#		Support: linux-ha at lists.linux-ha.org
+#		Support: users at clusterlabs.org
 # License:	GNU General Public License (GPL)
 # Copyright:	(C) 2002 - 2005 IBM
 #
diff --git a/heartbeat/MailTo b/heartbeat/MailTo
index 3936c39..b2aa89b 100755
--- a/heartbeat/MailTo
+++ b/heartbeat/MailTo
@@ -95,7 +95,7 @@ EOF
 
 SubjectLine() {
   case $1 in
-    ??*)	echo $@;;
+    ??*)	echo "$@";;
     *)		echo "Resource Group";;
   esac
 }
diff --git a/heartbeat/Makefile.am b/heartbeat/Makefile.am
index b70c104..91d4090 100644
--- a/heartbeat/Makefile.am
+++ b/heartbeat/Makefile.am
@@ -7,12 +7,12 @@
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; either version 2
 # of the License, or (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
@@ -30,7 +30,7 @@ halibdir		= $(libexecdir)/heartbeat
 ocfdir		        = $(OCF_RA_DIR_PREFIX)/heartbeat
 
 dtddir			= $(datadir)/$(PACKAGE_NAME)
-dtd_DATA		= ra-api-1.dtd
+dtd_DATA		= ra-api-1.dtd metadata.rng
 
 if USE_IPV6ADDR_AGENT
 ocf_PROGRAMS           = IPv6addr
@@ -50,93 +50,98 @@ send_ua_SOURCES         = send_ua.c IPv6addr_utils.c
 IPv6addr_LDADD          = -lplumb $(LIBNETLIBS)
 send_ua_LDADD           = $(LIBNETLIBS)
 
-ocf_SCRIPTS	     =  ClusterMon		\
+ocf_SCRIPTS	     =  AoEtarget		\
+			AudibleAlarm		\
+			ClusterMon		\
 			CTDB			\
+			Delay			\
 			Dummy			\
-		        IPaddr			\
-		        IPaddr2			\
+			EvmsSCC			\
+			Evmsd			\
+			Filesystem		\
+			ICP			\
+			IPaddr			\
+			IPaddr2			\
+			IPsrcaddr		\
+			LVM			\
+			LinuxSCSI		\
+			MailTo			\
+			ManageRAID		\
+			ManageVE		\
+			Pure-FTPd		\
+			Raid1			\
+			Route			\
+			SAPDatabase		\
+			SAPInstance		\
+			SendArp			\
+			ServeRAID		\
+			SphinxSearchDaemon	\
+			Squid			\
+			Stateful		\
+			SysInfo			\
+			VIPArip			\
+			VirtualDomain		\
+			WAS			\
+			WAS6			\
+			WinPopup		\
+			Xen			\
+			Xinetd			\
 			anything		\
-			AoEtarget		\
 			apache			\
 			asterisk		\
-			nginx			\
-			AudibleAlarm		\
-			clvm		\
+			awseip			\
+			awsvip			\
+			clvm			\
 			conntrackd		\
 			db2			\
-			dhcpd		\
-			Delay			\
+			dhcpd			\
 			dnsupdate		\
 			docker			\
 			eDir88			\
-			EvmsSCC			\
-			Evmsd			\
 			ethmonitor		\
 			exportfs		\
-			Filesystem		\
 			fio			\
 			galera			\
-			ids			\
-			iscsi			\
-			ICP			\
-			IPsrcaddr		\
-			iSCSITarget		\
+			garbd			\
 			iSCSILogicalUnit	\
+			iSCSITarget		\
+			ids			\
 			iface-bridge		\
 			iface-vlan		\
+			iscsi			\
 			jboss			\
 			kamailio		\
-			LinuxSCSI		\
-			LVM			\
 			lxc			\
-			MailTo			\
-			ManageRAID		\
-			ManageVE		\
 			mysql			\
 			mysql-proxy		\
 			nagios			\
 			named			\
 			nfsnotify		\
 			nfsserver		\
+			nginx			\
 			oracle			\
 			oralsnr			\
+			pgagent			\
+			pgsql			\
 			pingd			\
 			portblock		\
 			postfix			\
 			pound			\
-			pgsql			\
 			proftpd			\
-			Pure-FTPd		\
 			rabbitmq-cluster	\
-			Raid1			\
 			redis			\
-			Route			\
 			rsyncd			\
 			rsyslog			\
-			SAPDatabase		\
-			SAPInstance		\
-			SendArp			\
-			ServeRAID		\
-			slapd			\
-			SphinxSearchDaemon	\
-			Squid			\
-			Stateful		\
-			SysInfo			\
 			scsi2reservation	\
 			sfex			\
-                        sg_persist              \
+			sg_persist              \
+			slapd			\
 			symlink			\
 			syslog-ng		\
 			tomcat			\
-			VIPArip			\
-			VirtualDomain		\
 			varnish			\
 			vmware			\
-			WAS			\
-			WAS6			\
-			WinPopup		\
-			Xen			\
-			Xinetd			\
+			vsftpd			\
 			zabbixserver
 
 ocfcommondir		= $(OCF_LIB_DIR_PREFIX)/heartbeat
@@ -151,10 +156,15 @@ ocfcommon_DATA		= ocf-shellfuncs 	\
 			  sapdb-nosha.sh	\
 			  sapdb.sh		\
 			  ora-common.sh		\
-			  mysql-common.sh		\
-			  nfsserver-redhat.sh		\
+			  mysql-common.sh	\
+			  nfsserver-redhat.sh	\
 			  findif.sh
 
 # Legacy locations
 hbdir			= $(sysconfdir)/ha.d
 hb_DATA			= shellfuncs
+
+check: $(ocf_SCRIPTS:=.check)
+
+%.check: %
+	OCF_ROOT=$(abs_srcdir) OCF_FUNCTIONS_DIR=$(abs_srcdir) ./$< meta-data | xmllint --path $(abs_srcdir) --noout --relaxng $(abs_srcdir)/metadata.rng -
diff --git a/heartbeat/ManageRAID b/heartbeat/ManageRAID
index fc43eb1..e56dd6a 100755
--- a/heartbeat/ManageRAID
+++ b/heartbeat/ManageRAID
@@ -136,16 +136,16 @@ start_raid()
     return $retcode
   fi
 
-  for ldev in ${RAID_LOCALDISKS[@]}; do
+  for ldev in "${RAID_LOCALDISKS[@]}"; do
     if [[ ! -b $ldev ]]; then
       ocf_log err "$ldev is not a (local) block device."
       return $OCF_ERR_ARGS
     fi
   done
 
-  $MDADM -A $RAID_DEVPATH -a yes -u ${!RAID_UUID} ${RAID_LOCALDISKS[@]} &> /dev/null
+  $MDADM -A $RAID_DEVPATH -a yes -u ${!RAID_UUID} "${RAID_LOCALDISKS[@]}" &> /dev/null
   if [[ $? != 0 ]]; then
-    ocf_log err "starting ${!RAID_DEV} with ${RAID_LOCALDISKS[@]} failed."
+    ocf_log err "starting ${!RAID_DEV} with ${RAID_LOCALDISKS[*]} failed."
     return $OCF_ERR_GENERIC
   fi
 
@@ -199,11 +199,11 @@ status_raid()
   declare -i retcode_uuidcheck
 
   $CAT $RAID_MDSTAT | $GREP -e "${!RAID_DEV}[\ ]*:[\ ]*active" &> /dev/null
-  if [[ $? != 0 ]]; then
+  if [ $? -ne 0 ]; then
     return $OCF_NOT_RUNNING
   fi
  
-  if [[ ! -e $RAID_DEVPATH ]]; then
+  if [ ! -e $RAID_DEVPATH ]; then
     return $OCF_ERR_GENERIC
   fi
 
@@ -212,13 +212,13 @@ status_raid()
   $MDADM --detail -t $RAID_DEVPATH | $GREP -qEe "^[\ ]*UUID[\ ]*:[\ ]*${!RAID_UUID}" &> /dev/null
   retcode_uuidcheck=$?
 
-  if [[ $retcode_raidcheck > 3 ]]; then
+  if [ $retcode_raidcheck -gt 3 ]; then
     ocf_log err "mdadm returned error code $retcode_raidcheck while checking ${!RAID_DEV}."
     return $OCF_ERR_GENERIC
-  elif [[ $retcode_raidcheck == 3 ]]; then
+  elif [ $retcode_raidcheck -eq 3 ]; then
     ocf_log err "${!RAID_DEV} has failed."
     return $OCF_ERR_GENERIC
-  elif [[ $retcode_raidcheck < 3 && $retcode_uuidcheck != 0  ]]; then
+  elif [ $retcode_raidcheck -lt 3 ] && [ $retcode_uuidcheck != 0  ]; then
     ocf_log err "active RAID ${!RAID_DEV} and configured UUID (!$RAID_UUID) do not match."
     return $OCF_ERR_GENERIC
   fi
@@ -336,7 +336,7 @@ fi
 RAID_LOCALDISKS=${OCF_RESKEY_raidname}_LOCALDISKS[@]
 RAID_LOCALDISKS=( "${!RAID_LOCALDISKS}" )
 
-if [[ ${#RAID_LOCALDISKS[@]} < 1 ]]; then
+if [ ${#RAID_LOCALDISKS[@]} -lt 1 ]; then
   ocf_log err "you have to specify at least one local disk."
   exit $OCF_ERR_ARGS
 fi
diff --git a/heartbeat/README.galera b/heartbeat/README.galera
index 1b320cf..dd45618 100644
--- a/heartbeat/README.galera
+++ b/heartbeat/README.galera
@@ -131,7 +131,7 @@ Non-primary state, which would make `galera_monitor()` fail.
 - Deleted: during recurring slave monitor in `check_sync_status()`
            as soon as the Galera code reports to be SYNC-ed.
 
-### heuristic-recovered
+### no-grastate
 
 If a galera node was unexpectedly killed in a middle of a replication,
 InnoDB can retain the equivalent of a XA transaction in prepared state
@@ -139,11 +139,10 @@ in its redo log. If so, mysqld cannot recover state (nor last seqno)
 automatically, and special recovery heuristic has to be used to
 unblock the node.
 
-This attribute is used to keep track of forced recoveries to prevent
-bootstrapping a cluster from a recovered node when possible.
+This transient attribute is used to keep track of forced recoveries to
+prevent bootstrapping a cluster from a recovered node when possible.
 
 - Used   : during `detect_first_master()` to elect the bootstrap node
 - Created: in `detect_last_commit()` if the node has a pending XA
            transaction to recover in the redo log
-- Deleted: when a node is promoted to Master. This attribute is
-           kept in the CIB if a node in stopped.
+- Deleted: when a node is promoted to Master.
diff --git a/heartbeat/Raid1 b/heartbeat/Raid1
index 7cf658b..bef2606 100755
--- a/heartbeat/Raid1
+++ b/heartbeat/Raid1
@@ -2,7 +2,7 @@
 #
 #
 # License:      GNU General Public License (GPL)
-# Support:      linux-ha at lists.linux-ha.org
+# Support:      users at clusterlabs.org
 # 
 # Raid1
 #      Description: Manages a Linux software RAID device on a shared storage medium.
diff --git a/heartbeat/Route b/heartbeat/Route
index c2314bc..b018363 100755
--- a/heartbeat/Route
+++ b/heartbeat/Route
@@ -37,7 +37,7 @@ meta_data() {
 	cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="Route" version="0.1">
+<resource-agent name="Route">
 <version>1.0</version>
 
 <longdesc lang="en">
diff --git a/heartbeat/SAPDatabase b/heartbeat/SAPDatabase
index de7959f..d803df9 100755
--- a/heartbeat/SAPDatabase
+++ b/heartbeat/SAPDatabase
@@ -10,7 +10,7 @@
 # License:      GNU General Public License (GPL)
 # Copyright:    (c) 2006, 2007, 2010, 2012 Alexander Krauth
 #
-# An example usage: 
+# An example usage:
 #      See usage() function below for more details...
 #
 # OCF instance parameters:
@@ -18,6 +18,7 @@
 #       OCF_RESKEY_DIR_EXECUTABLE      (optional, well known directories will be searched by default)
 #       OCF_RESKEY_DBTYPE              (mandatory, one of the following values: ORA,ADA,DB6,SYB,HDB)
 #       OCF_RESKEY_DBINSTANCE          (optional, Database instance name, if not equal to SID)
+#       OCF_RESKEY_DBOSUSER            (optional, the Linux user that owns the database processes on operating system level)
 #       OCF_RESKEY_STRICT_MONITORING   (optional, activate application level monitoring - with Oracle a failover will occur in case of an archiver stuck)
 #       OCF_RESKEY_AUTOMATIC_RECOVER   (optional, automatic startup recovery, default is false)
 #       OCF_RESKEY_MONITOR_SERVICES    (optional, default is to monitor all database services)
@@ -46,7 +47,7 @@ SH=/bin/sh
 usage() {
   methods=`sapdatabase_methods`
   methods=`echo $methods | tr ' ' '|'`
-  cat <<-!
+  cat <<-EOF
 	usage: $0 ($methods)
 
 	$0 manages a SAP database of any type as an HA resource.
@@ -61,7 +62,7 @@ usage() {
 	The 'validate-all' operation reports whether the parameters are valid
 	The 'methods' operation reports on the methods $0 supports
 
-	!
+	EOF
 }
 
 meta_data() {
@@ -69,9 +70,8 @@ meta_data() {
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
 <resource-agent name="SAPDatabase">
-<version>2.06</version>
+<version>2.14</version>
 
-<shortdesc lang="en">Manages a SAP database instance as an HA resource.</shortdesc>
 <longdesc lang="en">
 Resource script for SAP databases. It manages a SAP database of any type as an HA resource.
 
@@ -82,7 +82,7 @@ The resource agent supports the following databases:
 - DB/2 UDB for Windows and Unix 9.x
 - SAP-DB / MaxDB 7.x
 - Sybase ASE 15.7
-- SAP HANA Database since 1.00 - with SAP node 1625203 (http://sdn.sap.com)
+- SAP HANA Database since 1.00 - with SAP note 1625203 (http://sdn.sap.com)
 
 In fact this resource agent does not run any database commands directly. It uses the SAP standard process SAPHostAgent to control the database.
 The SAPHostAgent must be installed on each cluster node locally. It will not work, if you try to run the SAPHostAgent also as a HA resource.
@@ -92,6 +92,7 @@ Release: 7.20
 Patch Number: 90
 or compile time after: Dec 17 2011
 </longdesc>
+<shortdesc lang="en">Manages a SAP database instance as an HA resource.</shortdesc>
 <parameters>
  <parameter name="SID" unique="1" required="1">
   <longdesc lang="en">The unique database system identifier. e.g. P01</longdesc>
@@ -115,6 +116,11 @@ Usually you can leave this empty. Then the default: /usr/sap/hostctrl/exe is use
   <shortdesc lang="en">Database instance name, if not equal to SID</shortdesc>
   <content type="string" default="" />
  </parameter>
+ <parameter name="DBOSUSER" unique="1" required="0">
+  <longdesc lang="en">The parameter can be set, if the database processes on operating system level are not executed with the default user of the used database type. Defaults: ADA=taken from /etc/opt/sdb, DB6=db2SID, ORA=oraSID and oracle, SYB=sybSID, HDB=SIDadm</longdesc>
+  <shortdesc lang="en">the Linux user that owns the database processes on operating system level</shortdesc>
+  <content type="string" default="" />
+ </parameter>
  <parameter name="NETSERVICENAME" unique="0" required="0">
   <longdesc lang="en">Deprecated - do not use anymore. This parameter will be deleted in one of the next releases.</longdesc>
   <shortdesc lang="en">deprecated - do not use anymore</shortdesc>
@@ -200,7 +206,7 @@ END
 # methods: What methods/operations do we support?
 #
 sapdatabase_methods() {
-  cat <<-!
+  cat <<-EOF
 	start
 	stop
 	status
@@ -210,7 +216,7 @@ sapdatabase_methods() {
 	methods
 	meta-data
 	usage
-	!
+	EOF
 }
 
 
@@ -281,7 +287,7 @@ case "$1" in
   *);;
 esac
 
-if  ! ocf_is_root 
+if  ! ocf_is_root
 then
   ocf_log err "$0 must be run as root"
   exit $OCF_ERR_PERM
@@ -305,14 +311,18 @@ DBTYPE=`echo "$OCF_RESKEY_DBTYPE" | tr '[:lower:]' '[:upper:]'`
 if saphostctrl_installed; then
                     . ${OCF_FUNCTIONS_DIR}/sapdb.sh
 else
+                    if [ -n "${OCF_RESKEY_DBOSUSER}" ]; then
+                      ocf_exit_reason "Usage of parameter OCF_RESKEY_DBOSUSER is not possible without having SAP Host-Agent installed"
+                      exit $OCF_ERR_ARGS
+                    fi
                     . ${OCF_FUNCTIONS_DIR}/sapdb-nosha.sh
 fi
 sapdatabase_init
 
 
-# we always want to fall to the faster status method in case of a probe by the cluster  
+# we always want to fall to the faster status method in case of a probe by the cluster
 ACTION=$1
-if ocf_is_probe 
+if ocf_is_probe
 then
   ACTION=status
 fi
diff --git a/heartbeat/SAPInstance b/heartbeat/SAPInstance
index da394f5..49e60aa 100755
--- a/heartbeat/SAPInstance
+++ b/heartbeat/SAPInstance
@@ -2,9 +2,9 @@
 #
 # SAPInstance
 #
-# Description:	Manages a single SAP Instance as a High-Availability
-#		resource. One SAP Instance is defined by one 
-#               SAP Instance-Profile. start/stop handels all services
+# Description:  Manages a single SAP Instance as a High-Availability
+#               resource. One SAP Instance is defined by one
+#               SAP Instance-Profile. start/stop handles all services
 #               of the START-Profile, status and monitor care only
 #               about essential services.
 #
@@ -13,7 +13,7 @@
 # License:      GNU General Public License (GPL)
 # Copyright:    (c) 2006-2008 Alexander Krauth
 #
-# An example usage: 
+# An example usage:
 #      See usage() function below for more details...
 #
 # OCF instance parameters:
@@ -23,10 +23,10 @@
 #	OCF_RESKEY_START_PROFILE    (optional, well known directories will be searched by default)
 #	OCF_RESKEY_START_WAITTIME   (optional, to solve timing problems during J2EE-Addin start)
 #	OCF_RESKEY_AUTOMATIC_RECOVER    (optional, automatic startup recovery using cleanipc, default is false)
-#       OCF_RESKEY_MONITOR_SERVICES     (optional, default is to monitor critical services only)
-#       OCF_RESKEY_SHUTDOWN_METHOD      (optional, defaults to NORMAL, KILL: terminate the SAP instance with OS commands - faster, at your own risk)
-#       OCF_RESKEY_ERS_InstanceName     (optional, InstanceName of the ERS instance in a Master/Slave configuration)
-#       OCF_RESKEY_ERS_START_PROFILE    (optional, START_PROFILE of the ERS instance in a Master/Slave configuration)
+#	OCF_RESKEY_MONITOR_SERVICES     (optional, default is to monitor critical services only)
+#	OCF_RESKEY_SHUTDOWN_METHOD      (optional, defaults to NORMAL, KILL: terminate the SAP instance with OS commands - faster, at your own risk)
+#	OCF_RESKEY_ERS_InstanceName     (optional, InstanceName of the ERS instance in a Master/Slave configuration)
+#	OCF_RESKEY_ERS_START_PROFILE    (optional, START_PROFILE of the ERS instance in a Master/Slave configuration)
 #	OCF_RESKEY_PRE_START_USEREXIT	(optional, lists a script which can be executed before the resource is started)
 #	OCF_RESKEY_POST_START_USEREXIT	(optional, lists a script which can be executed after the resource is started)
 #	OCF_RESKEY_PRE_STOP_USEREXIT	(optional, lists a script which can be executed before the resource is stopped)
@@ -49,7 +49,7 @@ SH=/bin/sh
 sapinstance_usage() {
   methods=`sapinstance_methods`
   methods=`echo $methods | tr ' ' '|'`
-  cat <<-!
+  cat <<-EOF
 	usage: $0 ($methods)
 
 	$0 manages a SAP Instance as an HA resource.
@@ -58,13 +58,13 @@ sapinstance_usage() {
 	The 'stop' operation stops the instance
 	The 'status' operation reports whether the instance is running
 	The 'monitor' operation reports whether the instance seems to be working
-        The 'promote' operation starts the primary instance in a Master/Slave configuration
-        The 'demote' operation stops the primary instance and starts the ERS instance
-        The 'notify' operation always returns SUCCESS
+	The 'promote' operation starts the primary instance in a Master/Slave configuration
+	The 'demote' operation stops the primary instance and starts the ERS instance
+	The 'notify' operation always returns SUCCESS
 	The 'validate-all' operation reports whether the parameters are valid
 	The 'methods' operation reports on the methods $0 supports
 
-	!
+	EOF
 }
 
 sapinstance_meta_data() {
@@ -74,14 +74,14 @@ sapinstance_meta_data() {
 <resource-agent name="SAPInstance">
 <version>2.14</version>
 
-<shortdesc lang="en">Manages a SAP instance as an HA resource.</shortdesc>
 <longdesc lang="en">
 Usually a SAP system consists of one database and at least one or more SAP instances (sometimes called application servers). One SAP Instance is defined by having exactly one instance profile. The instance profiles can usually be found in the directory /sapmnt/SID/profile. Each instance must be configured as it's own resource in the cluster configuration.
 The resource agent supports the following SAP versions:
-- SAP WebAS ABAP Release 6.20 - 7.30
-- SAP WebAS Java Release 6.40 - 7.30
-- SAP WebAS ABAP + Java Add-In Release 6.20 - 7.30 (Java is not monitored by the cluster in that case)
+- SAP WebAS ABAP Release 6.20 - 7.40
+- SAP WebAS Java Release 6.40 - 7.40
+- SAP WebAS ABAP + Java Add-In Release 6.20 - 7.40 (Java is not monitored by the cluster in that case)
 When using a SAP Kernel 6.40 please check and implement the actions from the section "Manual postprocessing" from SAP note 995116 (http://sdn.sap.com).
+Other versions may also work with this agent, but have not been verified.
 
 All operations of the SAPInstance resource agent are done by using the startup framework called SAP Management Console or sapstartsrv that was introduced with SAP kernel release 6.40. Find more information about the SAP Management Console in SAP note 1014480. Using this framework defines a clear interface for the Heartbeat cluster, how it sees the SAP system. The options for monitoring the SAP system are also much better than other methods like just watching the ps command for running pr [...]
 
@@ -94,6 +94,7 @@ sapstartsrv knows 4 status colours:
 The SAPInstance resource agent will interpret GREEN and YELLOW as OK. That means that minor problems will not be reported to the Heartbeat cluster. This prevents the cluster from doing an unwanted failover.
 The statuses RED and GRAY are reported as NOT_RUNNING to the cluster. Depending on the status the cluster expects from the resource, it will do a restart, failover or just nothing.
 </longdesc>
+<shortdesc lang="en">Manages a SAP instance as an HA resource.</shortdesc>
 <parameters>
  <parameter name="InstanceName" unique="1" required="1">
   <longdesc lang="en">The full qualified SAP instance name. e.g. P01_DVEBMGS00_sapp01ci. Usually this is the name of the SAP instance profile.</longdesc>
@@ -116,7 +117,7 @@ The statuses RED and GRAY are reported as NOT_RUNNING to the cluster. Depending
   <content type="string" default="" />
  </parameter>
  <parameter name="START_WAITTIME" unique="0" required="0">
-  <longdesc lang="en">After that time in seconds a monitor operation is executed by the resource agent. Does the monitor return SUCCESS, the start ishandled as SUCCESS. This is useful to resolve timing problems with e.g. the J2EE-Addin instance.Usually the resource agent waits until all services are started and the SAP Management Console reports a GREEN status. A double stack installation (ABAP + Java AddIn) consists of an ABAP dispatcher and aJAVA instance. Normally the start of the JAV [...]
+  <longdesc lang="en">After that time in seconds a monitor operation is executed by the resource agent. Does the monitor return SUCCESS, the start ishandled as SUCCESS. This is useful to resolve timing problems with e.g. the J2EE-Addin instance.Usually the resource agent waits until all services are started and the SAP Management Console reports a GREEN status. A double stack installation (ABAP + Java AddIn) consists of an ABAP dispatcher and a JAVA instance. Normally the start of the JA [...]
 Actually the SAP MC reports a YELLOW status, if the JAVA instance of a double stack system fails. From the resource agent point of view YELLOW means:everything is OK. Setting START_WAITTIME to a lower value determines the resource agent to check the status of the instance during a start operation after that time. As it would wait normally for a GREEN status, now it reports SUCCESS to the cluster in case of a YELLOW status already after the specified time.
 
 That is only useful for double stack systems.
@@ -142,7 +143,7 @@ Those services are monitored within the SAPInstance resource agent:
 
 That names match the strings used in the output of the command 'sapcontrol -nr [Instance-Nr] -function GetProcessList'.
 The default should fit most cases where you want to manage a SAP Instance from the cluster. You may change this with this parameter, if you like to monitor more/less or other services that sapstartsrv supports.
-You may specify multiple services seperated by a | (pipe) sign in this parameter: disp+work|msg_server|enserver
+You may specify multiple services separated by a | (pipe) sign in this parameter: disp+work|msg_server|enserver
   </longdesc>
   <shortdesc lang="en">Services to monitor</shortdesc>
   <content type="string" default="disp+work|msg_server|enserver|enrepserver|jcontrol|jstart"/>
@@ -218,7 +219,7 @@ END
 # methods: What methods/operations do we support?
 #
 sapinstance_methods() {
-  cat <<-!
+  cat <<-EOF
 	start
 	stop
 	status
@@ -230,7 +231,7 @@ sapinstance_methods() {
 	methods
 	meta-data
 	usage
-	!
+	EOF
 }
 
 
@@ -388,7 +389,7 @@ check_sapstartsrv() {
     then
       runninginst=`echo "$output" | grep '^0 : ' | cut -d' ' -f3`
       if [ "$runninginst" != "$InstanceName" ]
-      then 
+      then
         ocf_log warn "sapstartsrv is running for instance $runninginst, that service will be killed"
         restart=1
       else
@@ -456,7 +457,7 @@ check_sapstartsrv() {
 # sapuserexit : Many SAP customers need some additional processes/tools to run their SAP systems.
 #               This specialties do not allow a totally generic SAP cluster resource agent.
 #               Someone should write a resource agent for each additional process you need, if it
-#               is required to monitor that process within the cluster manager. To enable 
+#               is required to monitor that process within the cluster manager. To enable
 #               you to extent this resource agent without developing a new one, this user exit
 #               was introduced.
 #
@@ -486,7 +487,7 @@ cleanup_instance() {
   pkill -9 -f -U $sidadm $InstanceName
   ocf_log info "Terminated instance using 'pkill -9 -f -U $sidadm $InstanceName'"
 
-  # it is necessary to call cleanipc as user sidadm if the system has 'vmcj/enable = ON' set - otherwise SHM-segments in /dev/shm/SAP_ES2* cannot beremoved
+  # it is necessary to call cleanipc as user sidadm if the system has 'vmcj/enable = ON' set - otherwise SHM-segments in /dev/shm/SAP_ES2* cannot be removed
   su - $sidadm -c "cleanipc $InstanceNr remove"
   ocf_log info "Tried to remove shared memory resources using 'cleanipc $InstanceNr remove' as user $sidadm"
 
@@ -661,7 +662,7 @@ sapinstance_monitor() {
       case $COLOR in
         GREEN|YELLOW)       STATE=$OCF_SUCCESS;;
         *)                  STATE=$OCF_NOT_RUNNING;;
-      esac 
+      esac
 
       SEARCH=`echo "$OCF_RESKEY_MONITOR_SERVICES" | sed 's/\+/\\\+/g' | sed 's/\./\\\./g'`
       if [ `echo "$SERVICE" | egrep -c "$SEARCH"` -eq 1 ]
@@ -686,7 +687,7 @@ sapinstance_monitor() {
       fi
     fi
   fi
- 
+
   return $rc
 }
 
@@ -709,7 +710,7 @@ sapinstance_status() {
 
 
 #
-# sapinstance_validate: Check the symantic of the input parameters 
+# sapinstance_validate: Check the semantics of the input parameters
 #
 sapinstance_validate() {
   local rc=$OCF_SUCCESS
@@ -852,9 +853,9 @@ sapinstance_notify() {
     # instance to score 10.
     ${HA_SBIN_DIR}/crm_master -v 100 -l reboot
   elif [ "${n_type}_${n_op}" = "pre_demote" ]; then
-    # if we are a slave and a demote event is anounced, make sure we have the highes wish to became master
-    # that is, when a slave resource was startet after the promote event of a already running master (e.g. node of slave was down)
-    # We also have to make sure to overrule the globaly set resource_stickiness or any fail-count factors => INFINITY
+    # if we are a slave and a demote event is announced, make sure we are highest on the list to become master
+    # that is, when a slave resource was started after the promote event of an already running master (e.g. node of slave was down)
+    # We also have to make sure to overrule the globally set resource_stickiness or any fail-count factors => INFINITY
     local n_uname="$OCF_RESKEY_CRM_meta_notify_demote_uname"
     if [ ${n_uname} != ${NODENAME} ]; then
       ${HA_SBIN_DIR}/crm_master -v INFINITY -l reboot
diff --git a/heartbeat/SendArp b/heartbeat/SendArp
index b67404f..dbcc7dc 100755
--- a/heartbeat/SendArp
+++ b/heartbeat/SendArp
@@ -9,7 +9,7 @@
 #       Based on IPaddr2: Copyright (C) 2003 Tuomo Soini <tis at foobar.fi>
 #
 # 	License:      GNU General Public License (GPL)
-# 	Support:      linux-ha at lists.linux-ha.org
+# 	Support:      users at clusterlabs.org
 #
 #	This script send out gratuitous Arp for an IP address
 #
@@ -72,7 +72,7 @@ sendarp_meta_data() {
 	cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="SendArp" version="1.0">
+<resource-agent name="SendArp">
 <version>1.0</version>
 
 <longdesc lang="en">
diff --git a/heartbeat/ServeRAID b/heartbeat/ServeRAID
index 4ab70fb..4308813 100755
--- a/heartbeat/ServeRAID
+++ b/heartbeat/ServeRAID
@@ -7,7 +7,7 @@
 #
 # Author:	Alan Robertson, Renzo Alejandro Granados
 #
-# Support:	linux-ha at lists.linux-ha.org
+# Support:	users at clusterlabs.org
 #
 # License:	GNU General Public License (GPL)
 #
@@ -74,7 +74,7 @@ srsuccess=0
 SCSI="scsi "
 
 usage() {
-  cat <<-!
+  cat <<-EOF
 	usage: $0 (start|stop|status|monitor|validate-all|meta-data)
 
 	You have to set the following environment virables before running $0 :
@@ -102,7 +102,7 @@ usage() {
 	You will need at least version 6.10 (~July 2003 release) of the ipssend
 	command for this script to work.
 
-	!
+	EOF
 }
 
 meta_data() {
@@ -320,7 +320,7 @@ ServeRAID_stop() {
   if
     ServeRAID_status "$@"
   then
-    ocf_log err "ServeRAID device $@ is still active!"
+    ocf_log err "ServeRAID device $* is still active!"
     return $OCF_ERR_GENERIC
   else
     return $OCF_SUCCESS
diff --git a/heartbeat/SphinxSearchDaemon b/heartbeat/SphinxSearchDaemon
index f110928..b507ea0 100755
--- a/heartbeat/SphinxSearchDaemon
+++ b/heartbeat/SphinxSearchDaemon
@@ -39,7 +39,7 @@ meta_data() {
 	cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="SphinxSearchDaemon" version="0.9">
+<resource-agent name="SphinxSearchDaemon">
 <version>1.0</version>
 
 <longdesc lang="en">
diff --git a/heartbeat/Squid b/heartbeat/Squid
index 70c7c3d..1f93f0a 100755
--- a/heartbeat/Squid
+++ b/heartbeat/Squid
@@ -83,7 +83,7 @@ This manages a Squid instance as an HA resource.
 This is a required parameter. This parameter specifies squid's
 executable file.
 </longdesc>
-<shortdesc>Executable file</shortdesc>
+<shortdesc lang="en">Executable file</shortdesc>
 <content type="string" default=""/>
 </parameter>
 
@@ -92,7 +92,7 @@ executable file.
 This is a required parameter. This parameter specifies a configuration file
 for a squid instance managed by this RA.
 </longdesc>
-<shortdesc>Configuration file</shortdesc>
+<shortdesc lang="en">Configuration file</shortdesc>
 <content type="string" default=""/>
 </parameter>
 
@@ -101,7 +101,7 @@ for a squid instance managed by this RA.
 This is a required parameter. This parameter specifies a process id file
 for a squid instance managed by this RA.
 </longdesc>
-<shortdesc>Pidfile</shortdesc>
+<shortdesc lang="en">Pidfile</shortdesc>
 <content type="string" default=""/>
 </parameter>
 
@@ -111,7 +111,7 @@ This is a required parameter. This parameter specifies a port number
 for a squid instance managed by this RA. If plural ports are used,
 you must specifiy the only one of them.
 </longdesc>
-<shortdesc>Port number</shortdesc>
+<shortdesc lang="en">Port number</shortdesc>
 <content type="integer" default=""/>
 </parameter>
 
@@ -121,7 +121,7 @@ On stop, a squid shutdown is invoked first. If the resource
 doesn't stop within this timeout, we resort to stopping
 processes by sending signals and finally KILLing them.
 </longdesc>
-<shortdesc>how long to wait for squid shutdown to stop the
+<shortdesc lang="en">how long to wait for squid shutdown to stop the
 instance before resorting to kill</shortdesc>
 <content type="integer" default="10"/>
 </parameter>
@@ -134,7 +134,7 @@ If 'x' is included, both of STDOUT and STDERR redirect to the logfile
 specified by "debug_log", and then the builtin shell option 'x' is turned on.
 It is similar about 'v'.
 </longdesc>
-<shortdesc>Debug mode</shortdesc>
+<shortdesc lang="en">Debug mode</shortdesc>
 <content type="string" default=""/>
 </parameter>
 
@@ -148,7 +148,7 @@ following rules: "/var/log/" as a directory part, the basename of
 the configuration file given by "syslog_ng_conf" as a basename part,
 ".log" as a suffix.
 </longdesc>
-<shortdesc>A destination of the debug log</shortdesc>
+<shortdesc lang="en">A destination of the debug log</shortdesc>
 <content type="string" default=""/>
 </parameter>
 
diff --git a/heartbeat/Stateful b/heartbeat/Stateful
index 1a90e27..2e2608f 100755
--- a/heartbeat/Stateful
+++ b/heartbeat/Stateful
@@ -38,7 +38,7 @@ meta_data() {
 	cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="Stateful" version="1.0">
+<resource-agent name="Stateful">
 <version>1.0</version>
 
 <longdesc lang="en">
diff --git a/heartbeat/SysInfo b/heartbeat/SysInfo
index 11df0e1..d33c868 100755
--- a/heartbeat/SysInfo
+++ b/heartbeat/SysInfo
@@ -4,7 +4,7 @@
 #	SysInfo OCF Resource Agent
 #	It records (in the CIB) various attributes of a node
 #
-# Copyright (c) 2004 SUSE LINUX AG, Lars Marowsky-Br�e
+# Copyright (c) 2004 SUSE LINUX AG, Lars Marowsky-Bree
 #                    All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -316,11 +316,10 @@ SysInfo_monitor() {
 	SysInfoStats
 	exit $OCF_SUCCESS
 
-    elif [ x$OCF_RESKEY_CRM_meta_globally_unique = xtrue  
-	    -o x$OCF_RESKEY_CRM_meta_globally_unique = xTrue
-	    -o x$OCF_RESKEY_CRM_meta_globally_unique = xyes
-	    -o x$OCF_RESKEY_CRM_meta_globally_unique = xYes
-	]; then
+    elif [ x$OCF_RESKEY_CRM_meta_globally_unique = xtrue ] ||
+	 [ x$OCF_RESKEY_CRM_meta_globally_unique = xTrue ] ||
+	 [ x$OCF_RESKEY_CRM_meta_globally_unique = xyes ] ||
+	 [ x$OCF_RESKEY_CRM_meta_globally_unique = xYes ]; then
 	SysInfoStats
 	exit $OCF_SUCCESS
     fi
diff --git a/heartbeat/VIPArip b/heartbeat/VIPArip
index 01c6c99..12804df 100755
--- a/heartbeat/VIPArip
+++ b/heartbeat/VIPArip
@@ -1,7 +1,7 @@
 #!/bin/sh
 #
 # 	License:	GNU General Public License (GPL) 
-# 	Support:	linux-ha at lists.linux-ha.org
+# 	Support:	users at clusterlabs.org
 #	Author: 	Huang Zhen <zhenhltc at cn.ibm.com>
 # 	Copyright (c) 	2006 International Business Machines
 #
diff --git a/heartbeat/VirtualDomain b/heartbeat/VirtualDomain
index a9ad237..0b614f5 100755
--- a/heartbeat/VirtualDomain
+++ b/heartbeat/VirtualDomain
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Support:	  linux-ha at lists.linux-ha.org
+# Support:	  users at clusterlabs.org
 # License:	  GNU General Public License (GPL)
 #
 #   Resource Agent for domains managed by the libvirt API.
@@ -171,7 +171,7 @@ Be sure to set the timeout of these operations to accommodate this delay.
 
 <parameter name="autoset_utilization_cpu" unique="0" required="0">
 <longdesc lang="en">
-If set true, the agent will detect the number of domainU's vCPUs from virsh, and put it 
+If set true, the agent will detect the number of domainU's vCPUs from virsh, and put it
 into the CPU utilization of the resource when the monitor is executed.
 </longdesc>
 <shortdesc lang="en">Enable auto-setting the CPU utilization of the resource</shortdesc>
@@ -180,7 +180,7 @@ into the CPU utilization of the resource when the monitor is executed.
 
 <parameter name="autoset_utilization_hv_memory" unique="0" required="0">
 <longdesc lang="en">
-If set true, the agent will detect the number of *Max memory* from virsh, and put it 
+If set true, the agent will detect the number of *Max memory* from virsh, and put it
 into the hv_memory utilization of the resource when the monitor is executed.
 </longdesc>
 <shortdesc lang="en">Enable auto-setting the hv_memory utilization of the resource</shortdesc>
@@ -206,8 +206,8 @@ This parameter instructs the RA to save the configuration back to the xml file p
 
 <parameter name="sync_config_on_stop" unique="0" required="0">
 <longdesc lang="en">
-Setting this automatically enables save_config_on_stop. 
-When enabled this parameter instructs the RA to 
+Setting this automatically enables save_config_on_stop.
+When enabled this parameter instructs the RA to
 call csync2 -x to synchronize the file to all nodes.
 csync2 must be properly set up for this to work.
 </longdesc>
@@ -217,11 +217,11 @@ csync2 must be properly set up for this to work.
 
 <parameter name="snapshot">
 <longdesc lang="en">
-Path to the snapshot directory where the virtual machine image will be stored.  When this 
+Path to the snapshot directory where the virtual machine image will be stored.  When this
 parameter is set, the virtual machine's RAM state will be saved to a file in the snapshot
 directory when stopped.  If on start a state file is present for the domain, the domain
 will be restored to the same state it was in right before it stopped last.  This option
-is incompatible with the 'force_stop' option. 
+is incompatible with the 'force_stop' option.
 </longdesc>
 <shortdesc lang="en">
 Restore state on start/stop
@@ -280,12 +280,6 @@ update_utilization() {
 get_emulator()
 {
 	local emulator=""
-	# An emulator is not required, so only report message in debug mode
-	local loglevel="debug"
-
-	if ocf_is_probe; then
-		loglevel="notice"
-	fi
 
 	emulator=$(virsh $VIRSH_OPTIONS dumpxml $DOMAIN_NAME 2>/dev/null | sed -n -e 's/^.*<emulator>\(.*\)<\/emulator>.*$/\1/p')
 	if [ -z "$emulator" ] && [ -e "$EMULATOR_STATE" ]; then
@@ -297,8 +291,6 @@ get_emulator()
 
 	if [ -n "$emulator" ]; then
 		basename $emulator
-	else 
-		ocf_log $loglevel "Unable to determine emulator for $DOMAIN_NAME"
 	fi
 }
 
@@ -317,6 +309,12 @@ pid_status()
 {
 	local rc=$OCF_ERR_GENERIC
 	local emulator=$(get_emulator)
+	# An emulator is not required, so only report message in debug mode
+	local loglevel="debug"
+
+	if ocf_is_probe; then
+		loglevel="notice"
+	fi
 
 	case "$emulator" in
 		qemu-kvm|qemu-dm|qemu-system-*)
@@ -349,6 +347,8 @@ pid_status()
 				if [ $? -eq 0 ]; then
 					rc=$OCF_SUCCESS
 				fi
+			else 
+				ocf_log $loglevel "Unable to determine emulator for $DOMAIN_NAME"
 			fi
 			;;
 	esac
@@ -492,7 +492,7 @@ VirtualDomain_start() {
 	while ! VirtualDomain_monitor; do
 		sleep 1
 	done
-	
+
 	return $OCF_SUCCESS
 }
 
@@ -525,7 +525,7 @@ force_stop()
 sync_config(){
 	ocf_log info "Syncing $DOMAIN_NAME config file with csync2 -x ${OCF_RESKEY_config}"
 	if ! csync2 -x ${OCF_RESKEY_config}; then
-		ocf_log warn "Syncing ${OCF_RESKEY_config} failed."; 
+		ocf_log warn "Syncing ${OCF_RESKEY_config} failed.";
 	fi
 }
 
@@ -538,10 +538,10 @@ save_config(){
 				ocf_log info "Saving domain $DOMAIN_NAME to ${OCF_RESKEY_config}. Please make sure it's present on all nodes or sync_config_on_stop is on."
 				if cat ${CFGTMP} > ${OCF_RESKEY_config} ; then
 					ocf_log info "Saved $DOMAIN_NAME domain's configuration to ${OCF_RESKEY_config}."
-					if ocf_is_true "$OCF_RESKEY_sync_config_on_stop"; then	
+					if ocf_is_true "$OCF_RESKEY_sync_config_on_stop"; then
 						sync_config
 					fi
-				else	
+				else
 					ocf_log warn "Moving ${CFGTMP} to ${OCF_RESKEY_config} failed."
 				fi
 			else
@@ -583,7 +583,7 @@ VirtualDomain_stop() {
 			fi
 
 			# save config if needed
-			if ocf_is_true "$OCF_RESKEY_save_config_on_stop"; then	
+			if ocf_is_true "$OCF_RESKEY_save_config_on_stop"; then
 				save_config
 			fi
 
@@ -695,7 +695,7 @@ VirtualDomain_migrate_to() {
 		remoteuri=$(echo ${OCF_RESKEY_hypervisor} | sed -e "s,\(.*\)://[^/:]*\(:\?[0-9]*\)/\(.*\),\1${transport_suffix}://${target_node}\2/\3,")
 
 		# save config if needed
-		if ocf_is_true "$OCF_RESKEY_save_config_on_stop"; then	
+		if ocf_is_true "$OCF_RESKEY_save_config_on_stop"; then
 			save_config
 		fi
 
@@ -741,7 +741,7 @@ VirtualDomain_migrate_from() {
 	done
 	ocf_log info "$DOMAIN_NAME: live migration from ${OCF_RESKEY_CRM_meta_migrate_source} succeeded."
 	# save config if needed
-	if ocf_is_true "$OCF_RESKEY_save_config_on_stop"; then	
+	if ocf_is_true "$OCF_RESKEY_save_config_on_stop"; then
 		save_config
 	fi
 	return $OCF_SUCCESS
@@ -773,9 +773,9 @@ VirtualDomain_monitor() {
 
 	update_emulator_cache
 	update_utilization
-   # Save configuration on monitor as well, so we will have a better chance of 
+   # Save configuration on monitor as well, so we will have a better chance of
 	# having fresh and up to date config files on all nodes.
-	if ocf_is_true "$OCF_RESKEY_save_config_on_stop"; then	
+	if ocf_is_true "$OCF_RESKEY_save_config_on_stop"; then
 		save_config
 	fi
 
diff --git a/heartbeat/WAS b/heartbeat/WAS
index a46cdd9..3c74693 100755
--- a/heartbeat/WAS
+++ b/heartbeat/WAS
@@ -7,7 +7,7 @@
 #
 #
 # Author:	Alan Robertson
-# Support:	linux-ha at lists.linux-ha.org
+# Support:	users at clusterlabs.org
 # License:	GNU General Public License (GPL)
 # Copyright:	(C) 2002 - 2005 International Business Machines, Inc.
 #
diff --git a/heartbeat/WAS6 b/heartbeat/WAS6
index 560ae60..b3e7e22 100755
--- a/heartbeat/WAS6
+++ b/heartbeat/WAS6
@@ -5,7 +5,7 @@
 #
 #
 # Author:       Ru Xiang Min
-# Support:      linux-ha at lists.linux-ha.org
+# Support:      users at clusterlabs.org
 # License:      GNU General Public License (GPL)
 # Copyright:    (C) 2006 International Business Machines China, Ltd., Inc.
 #
diff --git a/heartbeat/Xen b/heartbeat/Xen
index e273f6e..92291ee 100755
--- a/heartbeat/Xen
+++ b/heartbeat/Xen
@@ -1,7 +1,7 @@
 #!/bin/sh
 #
 #
-# Support:      linux-ha at lists.linux-ha.org
+# Support:      users at clusterlabs.org
 # License:      GNU General Public License (GPL)
 #
 #	Resource Agent for the Xen Hypervisor.
diff --git a/heartbeat/Xinetd b/heartbeat/Xinetd
index b6a7b56..78d021e 100755
--- a/heartbeat/Xinetd
+++ b/heartbeat/Xinetd
@@ -11,7 +11,7 @@
 # Description:	given parameters of a service name and start|stop|status,
 #		will enable, disable or report on a specified xinetd service
 # Config:	all services must have a descriptor file in /etc/xinetd.d
-# Support:	linux-ha at lists.linux-ha.org
+# Support:	users at clusterlabs.org
 # License:	GNU General Public License (GPL)
 #
 #	  OCF parameters are as below:
diff --git a/heartbeat/apache b/heartbeat/apache
index 09d5ded..9f02fb5 100755
--- a/heartbeat/apache
+++ b/heartbeat/apache
@@ -9,7 +9,7 @@
 # Author:	Alan Robertson
 #		Sun Jiang Dong
 #
-# Support:	linux-ha at lists.linux-ha.org
+# Support:	users at clusterlabs.org
 #
 # License:	GNU General Public License (GPL)
 #
@@ -65,6 +65,7 @@ HTTPDOPTS="-DSTATUS"
 DEFAULT_IBMCONFIG=/opt/IBMHTTPServer/conf/httpd.conf
 DEFAULT_SUSECONFIG="/etc/apache2/httpd.conf"
 DEFAULT_RHELCONFIG="/etc/httpd/conf/httpd.conf"
+DEFAULT_DEBIANCONFIG="/etc/apache2/apache2.conf"
 #
 # You can also set
 #	HTTPD
@@ -144,6 +145,8 @@ silent_status() {
 validate_default_config() {
 	if [ -e /etc/SuSE-release ]; then
 		validate_default_suse_config
+	elif [ -e /etc/debian_version ]; then
+		validate_default_debian_config
 	else
 		return 0
 	fi
@@ -173,6 +176,24 @@ validate_default_suse_config() {
 	return 0
 }
 
+# Debian's Default configuration uses a lock directory /var/lock/apache2
+# which is only generated using the lsb init script issues configtest. To
+# ensure these default directories are present it's useful to run a configtest
+# prior to the resource startup which will create the needed directories
+#
+# To support multiple apache instances the debian scripts and configs
+# obey apache2/envvars. (copy /etc/apache2 -> /etc/apache2-instance)
+# adjust (SUFFIX) envvars and set OCF_RESKEY_envfiles
+validate_default_debian_config() {
+	if find /etc/apache2* -name apache2.conf | grep -q "$CONFIGFILE"
+	then
+		export APACHE_CONFDIR=$(dirname $CONFIGFILE)
+		[ -x "/usr/sbin/a2enmod" ] && ocf_run -q /usr/sbin/a2enmod status
+		ocf_run -q /usr/sbin/apache2ctl configtest || return 1
+	fi
+	return 0
+}
+
 apache_start() {
 	if
 		silent_status
@@ -182,8 +203,6 @@ apache_start() {
 	fi
 
 	validate_default_config || return $OCF_ERR_CONFIGURED
-	# https://bugs.launchpad.net/ubuntu/+source/apache2/+bug/603211
-	[ -d /var/run/apache2 ] || mkdir /var/run/apache2
 
 	if [ -z $PIDFILE_DIRECTIVE ]; then
 		ocf_run $HTTPD $HTTPDOPTS $OPTIONS -f $CONFIGFILE
@@ -302,7 +321,7 @@ apache_stop() {
 }
 
 apache_monitor_10() {
-	if [ "$TESTCONFFILE" ]; then
+	if [ -f "$TESTCONFFILE" ] && [ -r "$TESTCONFFILE" ]; then
 		readtestconf < $TESTCONFFILE
 	else
 		test_url="$TESTURL"
@@ -354,7 +373,7 @@ attempt_index_monitor_request() {
 	if [ $? -ne 0 ]; then
 		return $OCF_ERR_GENERIC
 	fi
-	ocf_log info "Successfully retrieved http header at $indexpage" 
+	ocf_log debug "Successfully retrieved http header at $indexpage"
 	return 0
 }
 
@@ -397,6 +416,8 @@ detect_default_config()
 {
 	if [ -f $DEFAULT_SUSECONFIG ]; then
 		echo $DEFAULT_SUSECONFIG
+	elif [ -f $DEFAULT_DEBIANCONFIG ]; then
+		echo $DEFAULT_DEBIANCONFIG
 	else
 		echo $DEFAULT_RHELCONFIG
 	fi
@@ -593,6 +614,27 @@ apache_validate_all() {
 		ocf_exit_reason "Configuration file $CONFIGFILE not found!"
 		return $OCF_ERR_INSTALLED
 	fi
+
+	# validate testconffile/testurl before apache_monitor_10()
+	if [ -n "$TESTCONFFILE" ]; then
+		if [ ! -f "$TESTCONFFILE" ] || [ ! -r "$TESTCONFFILE" ]; then
+			ocf_exit_reason "Configuration file $TESTCONFFILE not found, or not readable."
+			return $OCF_ERR_INSTALLED
+		fi
+	else
+		if [ -n "$TESTURL" ]; then
+			# remove leading or trailing spaces/tabs
+			local temp=$(printf "$TESTURL" | sed -e 's/^[ \t]*//g' -e 's/[ \t]*$//g')
+
+			if [ -z "$temp" ]; then
+				ocf_exit_reason "testurl: \"$TESTURL\" seems to be an empty string?"
+				return $OCF_ERR_CONFIGURED
+			fi
+		fi
+
+		# FIXME: validate TESTREGEX10 will be needed if empty regex is not allow.
+	fi
+
 	ocf_mkstatedir root 755 `dirname $PidFile` || return $OCF_ERR_INSTALLED
 	return $OCF_SUCCESS
 }
diff --git a/heartbeat/apache-conf.sh b/heartbeat/apache-conf.sh
index a3c8930..2918217 100644
--- a/heartbeat/apache-conf.sh
+++ b/heartbeat/apache-conf.sh
@@ -5,7 +5,7 @@
 # Author:	Alan Robertson
 #		Sun Jiang Dong
 #
-# Support:	linux-ha at lists.linux-ha.org
+# Support:	users at clusterlabs.org
 #
 # License:	GNU General Public License (GPL)
 #
@@ -80,7 +80,7 @@ apachecat() {
 get_apache_params() {
 	configfile=$1
 	shift 1
-	vars=`echo $@ | sed 's/ /,/g'`
+	vars=$(echo "$@" | sed 's/ /,/g')
 
 	eval `
 	apachecat $configfile | awk -v vars="$vars" '
diff --git a/heartbeat/asterisk b/heartbeat/asterisk
index e6318fc..c6586a3 100755
--- a/heartbeat/asterisk
+++ b/heartbeat/asterisk
@@ -8,7 +8,7 @@
 # Authors:      Martin Gerhard Loschwitz
 #               Florian Haas
 #
-# Support:      linux-ha at lists.linux-ha.org
+# Support:      users at clusterlabs.org
 # License:      GNU General Public License (GPL)
 #
 # (c) 2011      hastexo Professional Services GmbH
diff --git a/heartbeat/awseip b/heartbeat/awseip
new file mode 100755
index 0000000..471954e
--- /dev/null
+++ b/heartbeat/awseip
@@ -0,0 +1,250 @@
+#!/bin/sh
+#
+#
+#    Manage Elastic IP with Pacemaker
+#
+#
+# Copyright 2016 guessi <guessi at gmail.com>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#
+#  Prerequisites:
+#
+#  - preconfigured AWS CLI running environment (AccessKey, SecretAccessKey, etc.)
+#  - a reserved secondary private IP address for EC2 instances high availablity
+#  - IAM user role with the following permissions:
+#    * DescribeInstances
+#    * AssociateAddress
+#    * DisassociateAddress
+#
+
+#######################################################################
+# Initialization:
+
+: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
+. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
+
+#######################################################################
+
+#
+# Defaults
+#
+OCF_RESKEY_awscli_default="/usr/bin/awscli"
+OCF_RESKEY_api_delay_default="1"
+
+: ${OCF_RESKEY_awscli=${OCF_RESKEY_awscli_default}}
+: ${OCF_RESKEY_api_delay=${OCF_RESKEY_api_delay_default}}
+
+meta_data() {
+    cat <<END
+<?xml version="1.0"?>
+<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
+<resource-agent name="awseip">
+<version>1.0</version>
+
+<longdesc lang="en">
+description
+</longdesc>
+<shortdesc lang="en"></shortdesc>
+
+<parameters>
+
+<parameter name="awscli" unique="0">
+<longdesc lang="en">
+command line tools for aws services
+</longdesc>
+<shortdesc lang="en">aws cli tools</shortdesc>
+<content type="string" default="${OCF_RESKEY_awscli_default}" />
+</parameter>
+
+<parameter name="elastic_ip" unique="1" required="1">
+<longdesc lang="en">
+reserved elastic ip for ec2 instance
+</longdesc>
+<shortdesc lang="en">reserved elastic ip for ec2 instance</shortdesc>
+<content type="string" default="" />
+</parameter>
+
+<parameter name="allocation_id" unique="1" required="0">
+<longdesc lang="en">
+reserved allocation id for ec2 instance
+</longdesc>
+<shortdesc lang="en">reserved allocation id for ec2 instance</shortdesc>
+<content type="string" default="" />
+</parameter>
+
+<parameter name="private_ip_address" unique="1" required="0">
+<longdesc lang="en">
+predefined private ip address for ec2 instance
+</longdesc>
+<shortdesc lang="en">predefined private ip address for ec2 instance</shortdesc>
+<content type="string" default="" />
+</parameter>
+
+<parameter name="api_delay" unique="0">
+<longdesc lang="en">
+a short delay between API calls, to avoid sending API too quick
+</longdesc>
+<shortdesc lang="en">a short delay between API calls</shortdesc>
+<content type="integer" default="${OCF_RESKEY_api_delay_default}" />
+</parameter>
+
+</parameters>
+
+<actions>
+<action name="start"        timeout="10" />
+<action name="stop"         timeout="10" />
+<action name="monitor"      timeout="10" interval="20" depth="0" />
+<action name="reload"       timeout="10" />
+<action name="migrate_to"   timeout="10" />
+<action name="migrate_from" timeout="10" />
+<action name="meta-data"    timeout="5" />
+<action name="validate"     timeout="10" />
+<action name="validate-all" timeout="10" />
+</actions>
+</resource-agent>
+END
+}
+
+#######################################################################
+
+awseip_usage() {
+    cat <<END
+usage: $0 {start|stop|monitor|migrate_to|migrate_from|validate|validate-all|meta-data}
+
+Expects to have a fully populated OCF RA-compliant environment set.
+END
+}
+
+awseip_start() {
+    awseip_monitor && return $OCF_SUCCESS
+
+    if [ -n "${ALLOCATION_ID}" ] && [ -n "${PRIVATE_IP_ADDRESS}" ]; then
+        $AWSCLI ec2 associate-address  \
+            --instance-id ${INSTANCE_ID} \
+            --network-interface-id ${NETWORK_ID} \
+            --allocation-id ${ALLOCATION_ID} \
+            --private-ip-address ${PRIVATE_IP_ADDRESS}
+        RET=$?
+    else
+        $AWSCLI ec2 associate-address  \
+            --instance-id ${INSTANCE_ID} \
+            --public-ip ${ELASTIC_IP}
+        RET=$?
+    fi
+
+    # delay to avoid sending request too fast
+    sleep ${OCF_RESKEY_api_delay}
+
+    if [ $RET -ne 0 ]; then
+        return $OCF_NOT_RUNNING
+    fi
+
+    ocf_log info "elastic_ip have been successfully bring up (${ELASTIC_IP})"
+    return $OCF_SUCCESS
+}
+
+awseip_stop() {
+    awseip_monitor || return $OCF_SUCCESS
+
+    $AWSCLI ec2 disassociate-address  \
+        --public-ip ${ELASTIC_IP}
+    RET=$?
+
+    # delay to avoid sending request too fast
+    sleep ${OCF_RESKEY_api_delay}
+
+    if [ $RET -ne 0 ]; then
+        return $OCF_NOT_RUNNING
+    fi
+
+    ocf_log info "elastic_ip have been successfully bring down (${ELASTIC_IP})"
+    return $OCF_SUCCESS
+}
+
+awseip_monitor() {
+    $AWSCLI ec2 describe-instances --instance-id "${INSTANCE_ID}" | grep -q "${ELASTIC_IP}"
+    RET=$?
+
+    if [ $RET -ne 0 ]; then
+        return $OCF_NOT_RUNNING
+    fi
+    return $OCF_SUCCESS
+}
+
+awseip_validate() {
+    check_binary ${AWSCLI}
+
+    if [ -z "${INSTANCE_ID}" ]; then
+        ocf_log info "instant_id could not been found, is this EC2 instance?"
+        return $OCF_GENERIC
+    fi
+
+    return $OCF_SUCCESS
+}
+
+case $__OCF_ACTION in
+    meta-data)
+        meta_data
+        exit $OCF_SUCCESS
+        ;;
+esac 
+
+: ${OCF_RESKEY_awscli="/usr/bin/aws"}
+AWSCLI="${OCF_RESKEY_awscli}"
+ELASTIC_IP="${OCF_RESKEY_elastic_ip}"
+ALLOCATION_ID="${OCF_RESKEY_allocation_id}"
+PRIVATE_IP_ADDRESS="${OCF_RESKEY_private_ip_address}"
+INSTANCE_ID="$(curl -s http://169.254.169.254/latest/meta-data/instance-id)"
+NETWORK_ID="$($AWSCLI ec2 describe-instances --instance-id ${INSTANCE_ID} | grep -m 1 'eni' | awk -F'"' '{print$4}')"
+
+case $__OCF_ACTION in
+    start)
+        awseip_start
+        ;;
+    stop)
+        awseip_stop
+        ;;
+    monitor)
+        awseip_monitor
+        ;;
+    migrate_to)
+        ocf_log info "Migrating ${OCF_RESOURCE_INSTANCE} to ${OCF_RESKEY_CRM_meta_migrate_target}."
+        awseip_stop
+        ;;
+    migrate_from)
+        ocf_log info "Migrating ${OCF_RESOURCE_INSTANCE} from ${OCF_RESKEY_CRM_meta_migrate_source}."
+        awseip_start
+        ;;
+    reload)
+        ocf_log info "Reloading ${OCF_RESOURCE_INSTANCE} ..."
+        ;;
+    validate|validate-all)
+        awseip_validate
+        ;;
+    usage|help)
+        awseip_usage
+        exit $OCF_SUCCESS
+        ;;
+    *)
+        awseip_usage
+        exit $OCF_ERR_UNIMPLEMENTED
+        ;;
+esac
+
+rc=$?
+ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc"
+exit $rc
diff --git a/heartbeat/awsvip b/heartbeat/awsvip
new file mode 100755
index 0000000..f8da8d3
--- /dev/null
+++ b/heartbeat/awsvip
@@ -0,0 +1,225 @@
+#!/bin/sh
+#
+#
+#    Manage Secondary Private IP with Pacemaker
+#
+#
+# Copyright 2016 guessi <guessi at gmail.com>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#
+#  Prerequisites:
+#
+#  - preconfigured AWS CLI running environment (AccessKey, SecretAccessKey, etc.)
+#  - a reserved secondary private IP address for EC2 instances high availablity
+#  - IAM user role with the following permissions:
+#    * DescribeInstances
+#    * AssignPrivateIpAddresses
+#    * UnassignPrivateIpAddresses
+#
+
+#######################################################################
+# Initialization:
+
+: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
+. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
+
+#######################################################################
+
+#
+# Defaults
+#
+OCF_RESKEY_awscli_default="/usr/bin/awscli"
+OCF_RESKEY_api_delay_default="1"
+
+: ${OCF_RESKEY_awscli=${OCF_RESKEY_awscli_default}}
+: ${OCF_RESKEY_api_delay=${OCF_RESKEY_api_delay_default}}
+
+meta_data() {
+    cat <<END
+<?xml version="1.0"?>
+<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
+<resource-agent name="awsvip">
+<version>1.0</version>
+
+<longdesc lang="en">
+description
+</longdesc>
+<shortdesc lang="en"></shortdesc>
+
+<parameters>
+
+<parameter name="awscli" unique="0">
+<longdesc lang="en">
+command line tools for aws services
+</longdesc>
+<shortdesc lang="en">aws cli tools</shortdesc>
+<content type="string" default="${OCF_RESKEY_awscli_default}" />
+</parameter>
+
+<parameter name="secondary_private_ip" unique="1" required="1">
+<longdesc lang="en">
+reserved secondary private ip for ec2 instance
+</longdesc>
+<shortdesc lang="en">reserved secondary private ip for ec2 instance</shortdesc>
+<content type="string" default="" />
+</parameter>
+
+<parameter name="api_delay" unique="0">
+<longdesc lang="en">
+a short delay between API calls, to avoid sending API too quick
+</longdesc>
+<shortdesc lang="en">a short delay between API calls</shortdesc>
+<content type="integer" default="${OCF_RESKEY_api_delay_default}" />
+</parameter>
+
+</parameters>
+
+<actions>
+<action name="start"        timeout="10" />
+<action name="stop"         timeout="10" />
+<action name="monitor"      timeout="10" interval="20" depth="0" />
+<action name="reload"       timeout="10" />
+<action name="migrate_to"   timeout="10" />
+<action name="migrate_from" timeout="10" />
+<action name="meta-data"    timeout="5" />
+<action name="validate"     timeout="10" />
+<action name="validate-all" timeout="10" />
+</actions>
+</resource-agent>
+END
+}
+
+#######################################################################
+
+awsvip_usage() {
+    cat <<END
+usage: $0 {start|stop|monitor|migrate_to|migrate_from|validate|validate-all|meta-data}
+
+Expects to have a fully populated OCF RA-compliant environment set.
+END
+}
+
+awsvip_start() {
+    awsvip_monitor && return $OCF_SUCCESS
+
+    $AWSCLI ec2 assign-private-ip-addresses \
+        --network-interface-id ${NETWORK_ID} \
+        --private-ip-addresses ${SECONDARY_PRIVATE_IP} \
+        --allow-reassignment
+    RET=$?
+
+    # delay to avoid sending request too fast
+    sleep ${OCF_RESKEY_api_delay}
+
+    if [ $RET -ne 0 ]; then
+        return $OCF_NOT_RUNNING
+    fi
+
+    ocf_log info "secondary_private_ip have been successfully bring up (${SECONDARY_PRIVATE_IP})"
+    return $OCF_SUCCESS
+}
+
+awsvip_stop() {
+    awsvip_monitor || return $OCF_SUCCESS
+
+    $AWSCLI ec2 unassign-private-ip-addresses \
+        --network-interface-id ${NETWORK_ID} \
+        --private-ip-addresses ${SECONDARY_PRIVATE_IP}
+    RET=$?
+
+    # delay to avoid sending request too fast
+    sleep ${OCF_RESKEY_api_delay}
+
+    if [ $RET -ne 0 ]; then
+        return $OCF_NOT_RUNNING
+    fi
+
+    ocf_log info "secondary_private_ip have been successfully bring down (${SECONDARY_PRIVATE_IP})"
+    return $OCF_SUCCESS
+}
+
+awsvip_monitor() {
+    $AWSCLI ec2 describe-instances --instance-id "${INSTANCE_ID}" | grep -q "${SECONDARY_PRIVATE_IP}"
+    RET=$?
+
+    if [ $RET -ne 0 ]; then
+        return $OCF_NOT_RUNNING
+    fi
+    return $OCF_SUCCESS
+}
+
+awsvip_validate() {
+    check_binary ${AWSCLI}
+
+    if [ -z "${INSTANCE_ID}" ]; then
+        ocf_log info "instant_id could not been found, is this EC2 instance?"
+        return $OCF_GENERIC
+    fi
+
+    return $OCF_SUCCESS
+}
+
+case $__OCF_ACTION in
+    meta-data)
+        meta_data
+        exit $OCF_SUCCESS
+        ;;
+esac
+
+: ${OCF_RESKEY_awscli="/usr/bin/aws"}
+AWSCLI="${OCF_RESKEY_awscli}"
+SECONDARY_PRIVATE_IP="${OCF_RESKEY_secondary_private_ip}"
+INSTANCE_ID="$(curl -s http://169.254.169.254/latest/meta-data/instance-id)"
+NETWORK_ID="$($AWSCLI ec2 describe-instances --instance-id ${INSTANCE_ID} | grep -m 1 'eni' | awk -F'"' '{print$4}')"
+
+case $__OCF_ACTION in
+    start)
+        awsvip_start
+        ;;
+    stop)
+        awsvip_stop
+        ;;
+    monitor)
+        awsvip_monitor
+        ;;
+    migrate_to)
+        ocf_log info "Migrating ${OCF_RESOURCE_INSTANCE} to ${OCF_RESKEY_CRM_meta_migrate_target}."
+	awsvip_stop
+        ;;
+    migrate_from)
+        ocf_log info "Migrating ${OCF_RESOURCE_INSTANCE} from ${OCF_RESKEY_CRM_meta_migrate_source}."
+        awsvip_start
+        ;;
+    reload)
+        ocf_log info "Reloading ${OCF_RESOURCE_INSTANCE} ..."
+        ;;
+    validate|validate-all)
+        awsvip_validate
+        ;;
+    usage|help)
+        awsvip_usage
+        exit $OCF_SUCCESS
+        ;;
+    *)
+        awsvip_usage
+        exit $OCF_ERR_UNIMPLEMENTED
+        ;;
+esac
+
+rc=$?
+ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc"
+exit $rc
diff --git a/heartbeat/clvm b/heartbeat/clvm
index 9d63903..a778333 100755
--- a/heartbeat/clvm
+++ b/heartbeat/clvm
@@ -36,7 +36,7 @@ meta_data() {
 	cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="clvm" version="0.9">
+<resource-agent name="clvm">
 <version>1.0</version>
 
 <longdesc lang="en">
diff --git a/heartbeat/conntrackd b/heartbeat/conntrackd
index e81cda3..c09c3ad 100755
--- a/heartbeat/conntrackd
+++ b/heartbeat/conntrackd
@@ -90,20 +90,20 @@ For example "/packages/conntrackd-0.9.14/etc/conntrackd/conntrackd.conf"</longde
 END
 }
 
-meta_expect()
+meta_expect_eq()
 {
-        local what=$1 whatvar=OCF_RESKEY_CRM_meta_${1//-/_} op=$2 expect=$3
-        local val=${!whatvar}
-        if [[ -n $val ]]; then
-                # [, not [[, or it won't work ;)
-                [ $val $op $expect ] && return
-        fi
-        ocf_exit_reason "meta parameter misconfigured, expected $what $op $expect, but found ${val:-unset}."
-        exit $OCF_ERR_CONFIGURED
+	local what=$1 whatvar=OCF_RESKEY_CRM_meta_${1//-/_} expect=$2
+	local val=${!whatvar}
+	if [[ -n $val ]]; then
+		# [, not [[, or it won't work ;)
+		[ $val = $expect ] && return
+	fi
+	ocf_exit_reason "meta parameter misconfigured, expected $what $op $expect, but found ${val:-unset}."
+	exit $OCF_ERR_CONFIGURED
 }
 
 conntrackd_is_master() {
-	# You can't query conntrackd whether it is master or slave. It can be both at the same time. 
+	# You can't query conntrackd whether it is master or slave. It can be both at the same time.
 	# This RA creates a statefile during promote and enforces master-max=1 and clone-node-max=1
 	ha_pseudo_resource $statefile monitor
 }
@@ -119,7 +119,7 @@ conntrackd_monitor() {
 	local conntrack_socket=$(awk '/^[ \t]*UNIX[ \t]*{/,/^[ \t]*}/ { if ($1 == "Path") { print $2 } }' $OCF_RESKEY_config)
 	[ -S "$conntrack_socket" ] && rc=$OCF_SUCCESS
 	if [ "$rc" -eq "$OCF_SUCCESS" ]; then
-		# conntrackd is running 
+		# conntrackd is running
 		# now see if it acceppts queries
 		if ! $OCF_RESKEY_binary -C $OCF_RESKEY_config -s > /dev/null 2>&1; then
 			rc=$OCF_ERR_GENERIC
@@ -128,12 +128,12 @@ conntrackd_monitor() {
 		if conntrackd_is_master; then
 			rc=$OCF_RUNNING_MASTER
 			# Restore master setting on probes
-	                if [ $OCF_RESKEY_CRM_meta_interval -eq 0 ]; then
+			if [ $OCF_RESKEY_CRM_meta_interval -eq 0 ]; then
 				conntrackd_set_master_score $master_score
 			fi
 		else
 			# Restore master setting on probes
-	                if [ $OCF_RESKEY_CRM_meta_interval -eq 0 ]; then
+			if [ $OCF_RESKEY_CRM_meta_interval -eq 0 ]; then
 				conntrackd_set_master_score $slave_score
 			fi
 		fi
@@ -142,14 +142,14 @@ conntrackd_monitor() {
 }
 
 conntrackd_start() {
-        rc=$OCF_ERR_GENERIC
+	rc=$OCF_ERR_GENERIC
 
-        # Keep trying to start the resource;
-        # wait for the CRM to time us out if this fails
+	# Keep trying to start the resource;
+	# wait for the CRM to time us out if this fails
 	while :; do
 		conntrackd_monitor
 		status=$?
-		case "$status" in 
+		case "$status" in
 		$OCF_SUCCESS)
 			conntrackd_set_master_score $slave_score
 			# -n = request resync from the others
@@ -180,28 +180,28 @@ conntrackd_start() {
 }
 
 conntrackd_stop() {
-        rc=$OCF_ERR_GENERIC
-
-        # Keep trying to bring down the resource;
-        # wait for the CRM to time us out if this fails
-        while :; do
-                conntrackd_monitor
-                status=$?
-                case "$status" in
-                $OCF_SUCCESS|$OCF_ERR_GENERIC)
+	rc=$OCF_ERR_GENERIC
+
+	# Keep trying to bring down the resource;
+	# wait for the CRM to time us out if this fails
+	while :; do
+		conntrackd_monitor
+		status=$?
+		case "$status" in
+		$OCF_SUCCESS|$OCF_ERR_GENERIC)
 			ocf_log info "Stopping conntrackd"
-                        $OCF_RESKEY_binary -C $OCF_RESKEY_config -k
-                        ;;
-                $OCF_NOT_RUNNING)
-                        rc=$OCF_SUCCESS
-                        break
-                        ;;
-                $OCF_RUNNING_MASTER)
-                        ocf_log warn "conntrackd still master"
+			$OCF_RESKEY_binary -C $OCF_RESKEY_config -k
+			;;
+		$OCF_NOT_RUNNING)
+			rc=$OCF_SUCCESS
+			break
+			;;
+		$OCF_RUNNING_MASTER)
+			ocf_log warn "conntrackd still master"
 			;;
-                esac
-        done
-        return $rc
+		esac
+	done
+	return $rc
 
 }
 
@@ -211,10 +211,10 @@ conntrackd_validate_all() {
 		ocf_exit_reason "Config FILE $OCF_RESKEY_config does not exist"
 		return $OCF_ERR_INSTALLED
 	fi
-        meta_expect master-node-max = 1
-        meta_expect master-max = 1
-        meta_expect clone-node-max = 1
-	
+	meta_expect_eq master-node-max 1
+	meta_expect_eq master-max 1
+	meta_expect_eq clone-node-max 1
+
 	return $OCF_SUCCESS
 }
 
@@ -245,11 +245,11 @@ conntrackd_demote() {
 		# -n = request a resync from the others
 		for parm in t n; do
 			if ! $OCF_RESKEY_binary -C $OCF_RESKEY_config -$parm; then
-                        	ocf_exit_reason "$OCF_RESKEY_binary -C $OCF_RESKEY_config -$parm failed during demote."
-                        	rc=$OCF_ERR_GENERIC
-                        	break
-                	fi
-        	done
+				ocf_exit_reason "$OCF_RESKEY_binary -C $OCF_RESKEY_config -$parm failed during demote."
+				rc=$OCF_ERR_GENERIC
+				break
+			fi
+		done
 		ha_pseudo_resource $statefile stop
 		conntrackd_set_master_score $slave_score
 	fi
@@ -278,7 +278,7 @@ conntrackd_notify() {
 }
 
 conntrackd_usage() {
-        cat <<EOF
+	cat <<EOF
 usage: $0 {start|stop|promote|demote|monitor|validate-all|meta-data}
 Expects to have a fully populated OCF RA-compliant environment set.
 EOF
diff --git a/heartbeat/db2 b/heartbeat/db2
index fed2d86..c522699 100755
--- a/heartbeat/db2
+++ b/heartbeat/db2
@@ -442,6 +442,10 @@ db2_start() {
             # communicate our FAL to other nodes the might start concurrently
             db2_fal_attrib $db set $FIRST_ACTIVE_LOG
 
+            # ignore false positive:
+            # error: Can't use > in [ ]. Escape it or use [[..]]. [SC2073]
+            # see https://github.com/koalaman/shellcheck/issues/691
+            # shellcheck disable=SC2073
             if master_fal=$(db2_fal_attrib $db get) && [ "$master_fal" '>' $FIRST_ACTIVE_LOG ]
             then
                 ocf_log info "DB2 database $instance($db2node)/$db is Primary and outdated, starting as secondary"
diff --git a/heartbeat/dhcpd b/heartbeat/dhcpd
index 996a316..1596ddd 100755
--- a/heartbeat/dhcpd
+++ b/heartbeat/dhcpd
@@ -83,7 +83,7 @@ dhcpd_meta_data()  {
         cat <<EOF
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="dhcpd" version="0.1">
+<resource-agent name="dhcpd">
   <version>0.1</version>
   <longdesc lang="en">
 Manage an ISC DHCP server service in a chroot environment.
diff --git a/heartbeat/dnsupdate b/heartbeat/dnsupdate
index 2db2aa4..d834799 100755
--- a/heartbeat/dnsupdate
+++ b/heartbeat/dnsupdate
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 #
-# Support:      linux-ha at lists.linux-ha.org
+# Support:      users at clusterlabs.org
 # License:      GNU General Public License v2
 #
 # Copyright (c) 2014 SUSE Linux Products GmbH, Lars Marowsky-Brée
diff --git a/heartbeat/docker b/heartbeat/docker
index 5af1782..47f099e 100755
--- a/heartbeat/docker
+++ b/heartbeat/docker
@@ -40,7 +40,7 @@ meta_data()
 	cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="docker" version="0.9">
+<resource-agent name="docker">
 <version>1.0</version>
 
 <longdesc lang="en">
@@ -113,8 +113,15 @@ the health of the container. This command must return 0 to indicate that
 the container is healthy. A non-zero return code will indicate that the
 container has failed and should be recovered.
 
-The command is executed using nsenter. In the future 'docker exec' will
-be used once it is more widely supported.
+If 'docker exec' is supported, it is used to execute the command. If not,
+nsenter is used.
+
+Note: Using this method for monitoring processes inside a container
+is not recommended, as containerd tries to track processes running
+inside the container and does not deal well with many short-lived
+processes being spawned. Ensure that your container monitors its
+own processes and terminates on fatal error rather than invoking
+a command from the outside.
 </longdesc>
 <shortdesc lang="en">monitor command</shortdesc>
 <content type="string"/>
@@ -174,20 +181,24 @@ monitor_cmd_exec()
 		return $rc
 	fi
 
-	out=$(echo "$OCF_RESKEY_monitor_cmd" | nsenter --target $(docker inspect --format {{.State.Pid}} ${CONTAINER}) --mount --uts --ipc --net --pid 2>&1)
-	rc=$?
-	if [ $rc -ne 0 ]; then
-		ocf_log info "monitor cmd exit code = $rc"
-		ocf_log info "stdout/stderr: $out"
+	if docker exec --help >/dev/null 2>&1; then
+		out=$(docker exec ${CONTAINER} $OCF_RESKEY_monitor_cmd 2>&1)
+		rc=$?
+	else
+		out=$(echo "$OCF_RESKEY_monitor_cmd" | nsenter --target $(docker inspect --format {{.State.Pid}} ${CONTAINER}) --mount --uts --ipc --net --pid 2>&1)
+		rc=$?
+	fi
 
-		if [ $rc -eq 127 ]; then
-			ocf_exit_reason "monitor_cmd, ${OCF_RESKEY_monitor_cmd} , not found within container."
-			# there is no recovering from this, exit immediately
-			exit $OCF_ERR_ARGS
-		fi
+	if [ $rc -eq 127 ]; then
+		ocf_log err "monitor cmd failed (rc=$rc), output: $out"
+		ocf_exit_reason "monitor_cmd, ${OCF_RESKEY_monitor_cmd} , not found within container."
+		# there is no recovering from this, exit immediately
+		exit $OCF_ERR_ARGS
+	elif [ $rc -ne 0 ]; then
+		ocf_exit_reason "monitor cmd failed (rc=$rc), output: $out"
 		rc=$OCF_ERR_GENERIC
 	else
-		ocf_log info "monitor cmd passed: exit code = $rc"
+		ocf_log debug "monitor cmd passed: exit code = $rc"
 	fi
 
 	return $rc
@@ -390,8 +401,11 @@ docker_validate()
 	fi
 
 	if [ -n "$OCF_RESKEY_monitor_cmd" ]; then
-		ocf_log info "checking for nsenter, which is required when 'monitor_cmd' is specified"
-		check_binary nsenter
+		docker exec --help >/dev/null 2>&1
+		if [ ! $? ]; then
+			ocf_log info "checking for nsenter, which is required when 'monitor_cmd' is specified"
+			check_binary nsenter
+		fi
 	fi
 
 	image_exists
diff --git a/heartbeat/eDir88 b/heartbeat/eDir88
index 31b1a06..edb7592 100755
--- a/heartbeat/eDir88
+++ b/heartbeat/eDir88
@@ -65,7 +65,7 @@ eDir_meta_data() {
 cat <<-EOFB
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="eDir88" version="0.17">
+<resource-agent name="eDir88">
 <version>1.0</version>
 
 <longdesc lang="en">
@@ -246,7 +246,7 @@ eDir_status() {
 
     counter=${#IFACE2[@]}
 
-    for IFACE in ${IFACE2[@]}
+    for IFACE in "${IFACE2[@]}"
     do
         ocf_log debug "Checking ndsd instance for $IFACE"
         NDSD_SOCKS=$(netstat -ntlp | grep -ce "$IFACE.*ndsd")
@@ -410,7 +410,7 @@ eDir_validate() {
 # Start of main logic
 #
 
-ocf_log debug "$0 started with arguments \"$@\""
+ocf_log debug "$0 started with arguments \"$*\""
 
 NDSBASE=/opt/novell/eDirectory
 NDSNLDAP=$NDSBASE/sbin/nldap
diff --git a/heartbeat/ethmonitor b/heartbeat/ethmonitor
index 6563af7..7f5579f 100755
--- a/heartbeat/ethmonitor
+++ b/heartbeat/ethmonitor
@@ -3,7 +3,7 @@
 #	   OCF Resource Agent compliant script.
 #	   Monitor the vitality of a local network interface.
 #
-# 	Based on the work by Robert Euhus and Lars Marowsky-Br�e.
+# 	Based on the work by Robert Euhus and Lars Marowsky-Bree.
 #
 #	Transfered from Ipaddr2 into ethmonitor by Alexander Krauth
 #
diff --git a/heartbeat/exportfs b/heartbeat/exportfs
index 4b88fa1..c6ea920 100755
--- a/heartbeat/exportfs
+++ b/heartbeat/exportfs
@@ -266,7 +266,11 @@ is_exported() {
 
 exportfs_monitor ()
 {
-	if forall is_exported "${OCF_RESKEY_clientspec}"; then
+	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
 		if [ ${OCF_RESKEY_rmtab_backup} != "none" ]; then
 			forall backup_rmtab
 		fi
@@ -311,6 +315,8 @@ exportfs_start ()
 		return $OCF_SUCCESS
 	fi
 	ocf_log info "Exporting file system(s) ..."
+
+	ha_pseudo_resource "${OCF_RESOURCE_INSTANCE}" start
 	forall export_one
 
 	# Restore the rmtab to ensure smooth NFS-over-TCP failover
@@ -391,6 +397,8 @@ exportfs_stop ()
 
 	if [ $rc -eq 0 ]; then
 		cleanup_export_cache
+		ha_pseudo_resource "${OCF_RESOURCE_INSTANCE}" stop
+
 		ocf_log info "Un-exported file system(s)"
 		return $OCF_SUCCESS
 	else
diff --git a/heartbeat/findif.sh b/heartbeat/findif.sh
index ecd7843..a643da1 100644
--- a/heartbeat/findif.sh
+++ b/heartbeat/findif.sh
@@ -10,7 +10,7 @@ ipcheck_ipv6() {
 }
 ifcheck() {
   local ifname="$1"
-  $IP2UTIL link show dev $ifname 2>&1 >/dev/null
+  $IP2UTIL link show dev $ifname 2>&1
 }
 prefixcheck() {
   local prefix=$1
diff --git a/heartbeat/fio b/heartbeat/fio
index 6d2371f..8b11229 100755
--- a/heartbeat/fio
+++ b/heartbeat/fio
@@ -37,7 +37,7 @@ meta_data() {
 	cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="fio" version="0.9">
+<resource-agent name="fio">
 <version>1.0</version>
 
 <longdesc lang="en">
diff --git a/heartbeat/galera b/heartbeat/galera
index b65b7c2..fe2aa8a 100755
--- a/heartbeat/galera
+++ b/heartbeat/galera
@@ -76,6 +76,8 @@
 # in this file
 if [ -f "/etc/sysconfig/clustercheck" ]; then
     . /etc/sysconfig/clustercheck
+elif [ -f "/etc/default/clustercheck" ]; then
+    . /etc/default/clustercheck
 fi
 
 #######################################################################
@@ -279,20 +281,20 @@ is_bootstrap()
 
 }
 
-set_heuristic_recovered()
+set_no_grastate()
 {
-    ${HA_SBIN_DIR}/crm_attribute -N $NODENAME -l reboot --name "${INSTANCE_ATTR_NAME}-heuristic-recovered" -v "true"
+    ${HA_SBIN_DIR}/crm_attribute -N $NODENAME -l reboot --name "${INSTANCE_ATTR_NAME}-no-grastate" -v "true"
 }
 
-clear_heuristic_recovered()
+clear_no_grastate()
 {
-    ${HA_SBIN_DIR}/crm_attribute -N $NODENAME -l reboot --name "${INSTANCE_ATTR_NAME}-heuristic-recovered" -D
+    ${HA_SBIN_DIR}/crm_attribute -N $NODENAME -l reboot --name "${INSTANCE_ATTR_NAME}-no-grastate" -D
 }
 
-is_heuristic_recovered()
+is_no_grastate()
 {
     local node=$1
-    ${HA_SBIN_DIR}/crm_attribute -N $node -l reboot --name "${INSTANCE_ATTR_NAME}-heuristic-recovered" -Q 2>/dev/null
+    ${HA_SBIN_DIR}/crm_attribute -N $node -l reboot --name "${INSTANCE_ATTR_NAME}-no-grastate" -Q 2>/dev/null
 }
 
 clear_last_commit()
@@ -343,26 +345,39 @@ 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()
 {
-    local state=$(get_status_variable "wsrep_local_state")
-    local ready=$(get_status_variable "wsrep_ready")
+    # 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 [ -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
-    else
-        ocf_log info "local node syncing"
-        return $OCF_SUCCESS
+        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()
@@ -450,7 +465,7 @@ 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
-        if is_heuristic_recovered $node; then
+        if is_no_grastate $node; then
             nodes_recovered="$nodes_recovered $node"
         else
             nodes="$nodes $node"
@@ -488,6 +503,73 @@ 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
@@ -516,41 +598,55 @@ galera_start_local_node()
     clear_last_commit
 
     mysql_common_prepare_dirs
-    mysql_common_start "$extra_opts"
-    rc=$?
-    if [ $rc != $OCF_SUCCESS ]; then
-        return $rc
-    fi
 
-    mysql_common_status info
-    rc=$?
+    # 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
 
-    if [ $rc != $OCF_SUCCESS ]; then
-        ocf_exit_reason "Failed initial monitor action"
-        return $rc
-    fi
+        mysql_common_status info
+        rc=$?
 
-    is_readonly
-    if [ $? -eq 0 ]; then
-        ocf_exit_reason "Failure. Master instance started in read-only mode, check configuration."
-        return $OCF_ERR_GENERIC
-    fi
+        if [ $rc != $OCF_SUCCESS ]; then
+            ocf_exit_reason "Failed initial monitor action"
+            return $rc
+        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
+        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
         clear_bootstrap_node
-        # clear attribute heuristic-recovered. if last shutdown was
+        # 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_heuristic_recovered
+        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 heuristic-recovered will be cleared once the joiner
+        # attribute no-grastate will be cleared once the joiner
         # has finished syncing and is promoted to Master
     fi
 
@@ -566,43 +662,52 @@ detect_last_commit()
                         --socket=$OCF_RESKEY_socket \
                         --datadir=$OCF_RESKEY_datadir \
                         --user=$OCF_RESKEY_user"
+    local recovery_file_regex='s/.*WSREP\:.*position\s*recovery.*--log_error='\''\([^'\'']*\)'\''.*/\1/p'
     local recovered_position_regex='s/.*WSREP\:\s*[R|r]ecovered\s*position.*\:\(.*\)\s*$/\1/p'
 
     ocf_log info "attempting to detect last commit version by reading ${OCF_RESKEY_datadir}/grastate.dat"
     last_commit="$(cat ${OCF_RESKEY_datadir}/grastate.dat | sed -n 's/^seqno.\s*\(.*\)\s*$/\1/p')"
     if [ -z "$last_commit" ] || [ "$last_commit" = "-1" ]; then
         local tmp=$(mktemp)
-        local tmperr=$(mktemp)
+
+        # if we pass here because grastate.dat doesn't exist,
+        # try not to bootstrap from this node if possible
+        if [ ! -f ${OCF_RESKEY_datadir}/grastate.dat ]; then
+            set_no_grastate
+        fi
 
         ocf_log info "now attempting to detect last commit version using 'mysqld_safe --wsrep-recover'"
 
-        ${OCF_RESKEY_binary} $recover_args --wsrep-recover > $tmp 2> $tmperr
+        ${OCF_RESKEY_binary} $recover_args --wsrep-recover --log-error=$tmp 2>/dev/null
 
-        last_commit="$(cat $tmp | sed -n $recovered_position_regex)"
+        last_commit="$(cat $tmp | sed -n $recovered_position_regex | tail -1)"
         if [ -z "$last_commit" ]; then
             # Galera uses InnoDB's 2pc transactions internally. If
             # server was stopped in the middle of a replication, the
             # recovery may find a "prepared" XA transaction in the
             # redo log, and mysql won't recover automatically
 
-            cat $tmperr | grep -q -E '\[ERROR\]\s+Found\s+[0-9]+\s+prepared\s+transactions!' 2>/dev/null
-            if [ $? -eq 0 ]; then
-                # we can only rollback the transaction, but that's OK
-                # since the DB will get resynchronized anyway
-                ocf_log warn "local node <${NODENAME}> was not shutdown properly. Rollback stuck transaction with --tc-heuristic-recover"
-                ${OCF_RESKEY_binary} $recover_args --wsrep-recover \
-                                     --tc-heuristic-recover=rollback > $tmp 2>/dev/null
-
-                last_commit="$(cat $tmp | sed -n $recovered_position_regex)"
-                if [ ! -z "$last_commit" ]; then
-                    ocf_log warn "State recovered. force SST at next restart for full resynchronization"
-                    rm -f ${OCF_RESKEY_datadir}/grastate.dat
-                    # try not to use this node if bootstrap is needed
-                    set_heuristic_recovered
+            local recovery_file="$(cat $tmp | sed -n $recovery_file_regex)"
+            if [ -e $recovery_file ]; then
+                cat $recovery_file | grep -q -E '\[ERROR\]\s+Found\s+[0-9]+\s+prepared\s+transactions!' 2>/dev/null
+                if [ $? -eq 0 ]; then
+                    # we can only rollback the transaction, but that's OK
+                    # since the DB will get resynchronized anyway
+                    ocf_log warn "local node <${NODENAME}> was not shutdown properly. Rollback stuck transaction with --tc-heuristic-recover"
+                    ${OCF_RESKEY_binary} $recover_args --wsrep-recover \
+                                         --tc-heuristic-recover=rollback --log-error=$tmp 2>/dev/null
+
+                    last_commit="$(cat $tmp | sed -n $recovered_position_regex | tail -1)"
+                    if [ ! -z "$last_commit" ]; then
+                        ocf_log warn "State recovered. force SST at next restart for full resynchronization"
+                        rm -f ${OCF_RESKEY_datadir}/grastate.dat
+                        # try not to bootstrap from this node if possible
+                        set_no_grastate
+                    fi
                 fi
             fi
         fi
-        rm -f $tmp $tmperr
+        rm -f $tmp
     fi
 
     if [ ! -z "$last_commit" ]; then
@@ -637,8 +742,8 @@ galera_promote()
         # 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 recovery
-            clear_heuristic_recovered
+            # sync is done, clear info about last startup
+            clear_no_grastate
             return $OCF_SUCCESS
         else
             ocf_exit_reason "Attempted to promote local node while sync was still needed."
@@ -660,6 +765,14 @@ galera_demote()
     clear_bootstrap_node
     clear_last_commit
     clear_sync_needed
+    clear_no_grastate
+
+    # Clear master score here rather than letting pacemaker do so once
+    # demote finishes. This way a promote cannot take place right
+    # after this demote even if pacemaker is requested to do so. It
+    # will first have to run a start/monitor op, to reprobe the state
+    # of the other galera nodes and act accordingly.
+    clear_master_score
 
     # record last commit for next promotion
     detect_last_commit
@@ -677,7 +790,7 @@ galera_start()
         return $OCF_ERR_CONFIGURED
     fi
 
-    mysql_common_status info
+    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
@@ -712,7 +825,8 @@ galera_monitor()
         status_loglevel="info"
     fi
 
-    mysql_common_status $status_loglevel
+    # Check whether mysql is running or about to start after sync
+    galera_status $status_loglevel
     rc=$?
 
     if [ $rc -eq $OCF_NOT_RUNNING ]; then
@@ -741,7 +855,8 @@ galera_monitor()
         return $rc
     fi
 
-    # if we make it here, mysql is running. Check cluster status now.
+    # if we make it here, mysql is running or about to start after sync.
+    # Check cluster status now.
 
     echo $OCF_RESKEY_wsrep_cluster_address | grep -q $NODENAME
     if [ $? -ne 0 ]; then
@@ -749,18 +864,21 @@ galera_monitor()
         return $OCF_ERR_GENERIC
     fi
 
-    is_primary
+    check_sync_needed
     if [ $? -eq 0 ]; then
-        check_sync_needed
-        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=$?
-            fi
+        # 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=$?
+        fi
+    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
@@ -771,9 +889,6 @@ galera_monitor()
                 set_master_score
             fi
         fi
-    else
-        ocf_exit_reason "local node <${NODENAME}> is started, but not in primary mode. Unknown state."
-        rc=$OCF_ERR_GENERIC
     fi
 
     return $rc
@@ -790,6 +905,7 @@ galera_stop()
     clear_master_score
     clear_bootstrap_node
     clear_sync_needed
+    clear_no_grastate
     return $rc
 }
 
@@ -858,7 +974,7 @@ fi
 case "$1" in
   start)    galera_start;;
   stop)     galera_stop;;
-  status)   mysql_common_status err;;
+  status)   galera_status err;;
   monitor)  galera_monitor;;
   promote)  galera_promote;;
   demote)   galera_demote;;
diff --git a/heartbeat/garbd b/heartbeat/garbd
new file mode 100755
index 0000000..50563fb
--- /dev/null
+++ b/heartbeat/garbd
@@ -0,0 +1,417 @@
+#!/bin/sh
+#
+# Copyright (c) 2015 Damien Ciabrini <dciabrin at redhat.com>
+#                    All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of version 2 of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# Further, this software is distributed without any warranty that it is
+# free of the rightful claim of any third person regarding infringement
+# or the like.  Any license provided herein, whether implied or
+# otherwise, applies only to this software file.  Patent licenses, if
+# any, provided herein do not apply to combinations of this program with
+# other software, or any other product whatsoever.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
+#
+
+##
+# README.
+#
+# Resource agent for garbd, the Galera arbitrator
+#
+# You can use this agent if you run an even number of galera nodes,
+# and you want an additional node to avoid split-brain situations.
+#
+# garbd requires that a Galera cluster is running, so make sure to
+# add a proper ordering constraint to the cluster, e.g.:
+#
+#   pcs constraint order galera-master then garbd
+#
+# If you add garbd to the cluster while Galera is not running, you
+# might want to disable it before setting up ordering constraint, e.g.:
+#
+#   pcs resource create garbd garbd \
+#      wsrep_cluster_address=gcomm://node1:4567,node2:4567 \
+#      meta target-role=stopped
+#
+# Use location constraints to avoid running galera and garbd on
+# the same node, e.g.:
+#
+#   pcs constraint colocation add garbd with galera-master -INFINITY
+#   pcs constraint location garbd prefers node3=INFINITY
+#
+##
+
+#######################################################################
+# Initialization:
+
+: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
+. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
+
+#######################################################################
+# Set default paramenter values
+
+OCF_RESKEY_binary_default="/usr/sbin/garbd"
+OCF_RESKEY_log_default="/var/log/garbd.log"
+OCF_RESKEY_pid_default="/var/run/garbd.pid"
+OCF_RESKEY_user_default="mysql"
+if [ "X${HOSTOS}" = "XOpenBSD" ];then
+    OCF_RESKEY_group_default="_mysql"
+else
+    OCF_RESKEY_group_default="mysql"
+fi
+
+: ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}
+: ${OCF_RESKEY_log=${OCF_RESKEY_log_default}}
+: ${OCF_RESKEY_pid=${OCF_RESKEY_pid_default}}
+: ${OCF_RESKEY_user=${OCF_RESKEY_user_default}}
+: ${OCF_RESKEY_group=${OCF_RESKEY_group_default}}
+
+usage() {
+  cat <<UEND
+usage: $0 (start|stop|validate-all|meta-data|status|monitor)
+
+$0 manages a Galera arbitrator.
+
+The 'start' operation starts the arbitrator.
+The 'stop' operation stops the arbitrator.
+The 'status' operation reports whether the arbitrator is running
+The 'monitor' operation reports whether the arbitrator seems to be working
+The 'validate-all' operation reports whether the parameters are valid
+
+UEND
+}
+
+meta_data() {
+   cat <<END
+<?xml version="1.0"?>
+<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
+<resource-agent name="garbd">
+<version>1.0</version>
+
+<longdesc lang="en">
+Resource script for managing Galera arbitrator.
+</longdesc>
+<shortdesc lang="en">Manages a galera arbitrator instance</shortdesc>
+<parameters>
+
+<parameter name="binary" unique="0" required="0">
+<longdesc lang="en">
+Location of the Galera arbitrator binary
+</longdesc>
+<shortdesc lang="en">garbd server binary</shortdesc>
+<content type="string" default="${OCF_RESKEY_binary_default}" />
+</parameter>
+
+<parameter name="user" unique="0" required="0">
+<longdesc lang="en">
+User running the garbd process
+</longdesc>
+<shortdesc lang="en">garbd user</shortdesc>
+<content type="string" default="${OCF_RESKEY_user_default}" />
+</parameter>
+
+<parameter name="group" unique="0" required="0">
+<longdesc lang="en">
+Group running garbd (for logfile permissions)
+</longdesc>
+<shortdesc lang="en">garbd group</shortdesc>
+<content type="string" default="${OCF_RESKEY_group_default}"/>
+</parameter>
+
+<parameter name="log" unique="0" required="0">
+<longdesc lang="en">
+The logfile to be used for garbd.
+</longdesc>
+<shortdesc lang="en">Galera arbitrator log file</shortdesc>
+<content type="string" default="${OCF_RESKEY_log_default}"/>
+</parameter>
+
+<parameter name="pid" unique="0" required="0">
+<longdesc lang="en">
+The pidfile to be used for garbd.
+</longdesc>
+<shortdesc lang="en">Galera arbitrator pidfile</shortdesc>
+<content type="string" default="${OCF_RESKEY_pid_default}"/>
+</parameter>
+
+<parameter name="options" unique="0" required="0">
+<longdesc lang="en">
+Additional parameters which are passed to garbd on startup.
+</longdesc>
+<shortdesc lang="en">Additional parameters to pass to garbd</shortdesc>
+<content type="string" default=""/>
+</parameter>
+
+<parameter name="wsrep_cluster_address" unique="0" required="1">
+<longdesc lang="en">
+The galera cluster address. This takes the form of:
+gcomm://node:port,node:port,node:port
+
+Unlike Galera servers, port is mandatory for garbd.
+</longdesc>
+<shortdesc lang="en">Galera cluster address</shortdesc>
+<content type="string" default=""/>
+</parameter>
+
+<parameter name="wsrep_cluster_name" unique="0" required="1">
+<longdesc lang="en">
+The group name of the Galera cluster to connect to.
+</longdesc>
+<shortdesc lang="en">Galera cluster name</shortdesc>
+<content type="string" default=""/>
+</parameter>
+
+</parameters>
+
+<actions>
+<action name="start" timeout="20" />
+<action name="stop" timeout="20" />
+<action name="monitor" depth="0" timeout="20" interval="20" />
+<action name="validate-all" timeout="5" />
+<action name="meta-data" timeout="5" />
+</actions>
+</resource-agent>
+END
+}
+
+
+garbd_start()
+{
+    local rc
+    local pid
+    local start_wait
+    local garbd_params
+
+    garbd_status info
+    rc=$?
+    if [ $rc -eq $OCF_SUCCESS ]; then
+        ocf_exit_reason "garbd started outside of the cluster's control"
+        return $OCF_ERR_GENERIC;
+    fi
+
+    touch $OCF_RESKEY_log
+    chown $OCF_RESKEY_user:$OCF_RESKEY_group $OCF_RESKEY_log
+    chmod 0640 $OCF_RESKEY_log
+    [ -x /sbin/restorecon ] && /sbin/restorecon $OCF_RESKEY_log
+
+    garbd_params="--address=${OCF_RESKEY_wsrep_cluster_address} \
+                  --group ${OCF_RESKEY_wsrep_cluster_name} \
+                  --log ${OCF_RESKEY_log}"
+
+    if [ ! -z "${OCF_RESKEY_options}" ]; then
+        garbd_params="${garbd_params} --options=${OCF_RESKEY_options}"
+    fi
+
+    # garbd has no parameter to run as a specific user,
+    # so we need to start it by our own means
+    pid=$(su - -s /bin/sh $OCF_RESKEY_user -c "${OCF_RESKEY_binary} ${garbd_params} >/dev/null 2>&1 & echo \$!")
+
+    # garbd doesn't create a pidfile either, so we create our own
+    echo $pid > $OCF_RESKEY_pid
+    if [ $? -ne 0 ]; then
+        ocf_exit_reason "Cannot create pidfile for garbd at $OCF_RESKEY_pid (rc=$?), please check your installation"
+        return $OCF_ERR_GENERIC
+    fi
+
+    # Spin waiting for garbd to connect to the cluster.
+    # Let the CRM/LRM time us out if required.
+    start_wait=1
+    while [ $start_wait -eq 1 ]; do
+        garbd_monitor info
+        rc=$?
+        if [ $rc -eq $OCF_NOT_RUNNING ]; then
+            ocf_exit_reason "garbd failed to start (pid=$pid), check logs in ${OCF_RESKEY_log}"
+            return $OCF_ERR_GENERIC
+        elif [ $rc -eq $OCF_SUCCESS ]; then
+            start_wait=0
+        fi
+        sleep 2
+    done
+
+    ocf_log info "garbd connected to cluster \"${OCF_RESKEY_wsrep_cluster_name}\""
+    return $OCF_SUCCESS
+}
+
+garbd_status()
+{
+    local loglevel=$1
+    local rc
+    ocf_pidfile_status $OCF_RESKEY_pid
+    rc=$?
+
+    if [ $rc -eq 0 ]; then
+        return $OCF_SUCCESS
+    elif [ $rc -eq 2 ]; then
+        return $OCF_NOT_RUNNING
+    else
+        # clean up if pidfile is stale
+        if [ $rc -eq 1 ]; then
+            ocf_log $loglevel "garbd not running: removing old PID file"
+            rm -f $OCF_RESKEY_pid
+        fi
+        return $OCF_ERR_GENERIC
+    fi
+}
+
+garbd_monitor()
+{
+    local rc
+    local pid
+    local loglevel=$1
+
+    # Set loglevel to info during probe
+    if ocf_is_probe; then
+        loglevel="info"
+    fi
+
+    garbd_status $loglevel
+    rc=$?
+
+    # probe just wants to know if garbd is running or not
+    if ocf_is_probe && [ $rc -ne $OCF_SUCCESS ]; then
+        rc=$OCF_NOT_RUNNING
+    fi
+
+    # Consider garbd is working if it's connected to at least
+    # one node in the galera cluster.
+    # Note: a Galera node in Non-Primary state will be
+    # stopped by the galera RA. So we can assume that
+    # garbd will always be connected to the right partition
+    if [ $rc -eq $OCF_SUCCESS ]; then
+        pid=`cat $OCF_RESKEY_pid 2> /dev/null `
+        netstat -tnp 2>/dev/null | grep -s -q "ESTABLISHED.*${pid}/"
+        if [ $? -ne 0 ]; then
+            ocf_log $loglevel "garbd disconnected from cluster \"${OCF_RESKEY_wsrep_cluster_name}\""
+            rc=$OCF_ERR_GENERIC
+        fi
+    fi
+
+    return $rc
+}
+
+garbd_stop()
+{
+    local rc
+    local pid
+
+    if [ ! -f $OCF_RESKEY_pid ]; then
+        ocf_log info "garbd is not running"
+        return $OCF_SUCCESS
+    fi
+
+    pid=`cat $OCF_RESKEY_pid 2> /dev/null `
+
+    ocf_log info "stopping garbd"
+
+    # make sure the process is stopped
+    ocf_stop_processes TERM 10 $pid
+    rc=$?
+
+    if [ $rc -ne 0 ]; then
+        return $OCF_ERR_GENERIC
+    else
+        rm -f $OCF_RESKEY_pid
+        ocf_log info "garbd stopped"
+        return $OCF_SUCCESS
+    fi
+}
+
+garbd_validate()
+{
+    if ! have_binary "$OCF_RESKEY_binary"; then
+        ocf_exit_reason "Setup problem: couldn't find command: $OCF_RESKEY_binary"
+        return $OCF_ERR_INSTALLED;
+    fi
+
+    if ! have_binary "netstat"; then
+        ocf_exit_reason "Setup problem: couldn't find command: netstat"
+        return $OCF_ERR_INSTALLED;
+    fi
+
+    if [ -z "$OCF_RESKEY_wsrep_cluster_address" ]; then
+        ocf_exit_reason "garbd must be configured with a wsrep_cluster_address value."
+        return $OCF_ERR_CONFIGURED
+    fi
+
+    # unlike galera RA, ports must be set in cluster address for garbd
+    # https://github.com/codership/galera/issues/98
+    for node in $(echo "$OCF_RESKEY_wsrep_cluster_address" | sed 's/gcomm:\/\///g' | tr -d ' ' | tr -s ',' ' '); do
+        echo $node | grep -s -q ':[1-9][0-9]*$'
+        if [ $? -ne 0 ]; then
+            ocf_exit_reason "wsrep_cluster_address must specify ports (gcomm://node1:port,node2:port)."
+            return $OCF_ERR_CONFIGURED
+        fi
+    done
+
+    # Ensure that the encryption method is set if garbd is configured
+    # to use SSL.
+    echo $OCF_RESKEY_options | grep -s -q -i -E '\bsocket.ssl_(key|cert)='
+    if [ $? -eq 0 ]; then
+        echo $OCF_RESKEY_options | grep -s -q -i -E '\bsocket.ssl_cipher='
+        if [ $? -ne 0 ]; then
+            ocf_exit_reason "option socket.ssl_cipher must be set if SSL is enabled."
+            return $OCF_ERR_CONFIGURED
+        fi
+    fi
+
+    if [ -z "$OCF_RESKEY_wsrep_cluster_name" ]; then
+        ocf_exit_reason "garbd must be configured with a wsrep_cluster_name value."
+        return $OCF_ERR_CONFIGURED
+    fi
+
+    if ! getent passwd $OCF_RESKEY_user >/dev/null 2>&1; then
+        ocf_exit_reason "User $OCF_RESKEY_user doesn't exist"
+        return $OCF_ERR_INSTALLED
+    fi
+
+    if ! getent group $OCF_RESKEY_group >/dev/null 2>&1; then
+        ocf_exit_reason "Group $OCF_RESKEY_group doesn't exist"
+        return $OCF_ERR_INSTALLED
+    fi
+
+    return $OCF_SUCCESS
+}
+
+case "$1" in
+  meta-data)    meta_data
+        exit $OCF_SUCCESS;;
+  usage|help)   usage
+        exit $OCF_SUCCESS;;
+esac
+
+garbd_validate
+rc=$?
+
+# trap configuration errors early, but don't block stop in such cases
+LSB_STATUS_STOPPED=3
+if [ $rc -ne 0 ]; then
+    case "$1" in
+        stop) exit $OCF_SUCCESS;;
+        status) exit $LSB_STATUS_STOPPED;;
+        *) exit $rc;;
+    esac
+fi
+
+# What kind of method was invoked?
+case "$1" in
+  start)    garbd_start;;
+  stop)     garbd_stop;;
+  status)   garbd_status err;;
+  monitor)  garbd_monitor err;;
+  promote)  garbd_promote;;
+  demote)   garbd_demote;;
+  validate-all) exit $OCF_SUCCESS;;
+
+ *)     usage
+        exit $OCF_ERR_UNIMPLEMENTED;;
+esac
diff --git a/heartbeat/http-mon.sh b/heartbeat/http-mon.sh
index 46a4820..ce13ccd 100644
--- a/heartbeat/http-mon.sh
+++ b/heartbeat/http-mon.sh
@@ -5,7 +5,7 @@
 # Author:	Alan Robertson
 #		Sun Jiang Dong
 #
-# Support:	linux-ha at lists.linux-ha.org
+# Support:	users at clusterlabs.org
 #
 # License:	GNU General Public License (GPL)
 #
diff --git a/heartbeat/iSCSILogicalUnit b/heartbeat/iSCSILogicalUnit
index 0b1670f..0a07c5f 100755
--- a/heartbeat/iSCSILogicalUnit
+++ b/heartbeat/iSCSILogicalUnit
@@ -72,6 +72,7 @@ OCF_RESKEY_lio_iblock=${OCF_RESKEY_lio_iblock:-$OCF_RESKEY_lio_iblock_default}
 #
 # OCF_RESKEY_tgt_bstype
 # OCF_RESKEY_tgt_bsoflags
+# OCF_RESKEY_tgt_bsopts
 # OCF_RESKEY_tgt_device_type
 
 #######################################################################
@@ -80,7 +81,7 @@ meta_data() {
 	cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="iSCSILogicalUnit" version="0.9">
+<resource-agent name="iSCSILogicalUnit">
 <version>0.9</version>
 
 <longdesc lang="en">
@@ -179,6 +180,15 @@ See tgtadm(8).
 <content type="string" />
 </parameter>
 
+<parameter name="tgt_bsopts" required="0" unique="0">
+<longdesc lang="en">
+TGT specific backing store options.
+See tgtadm(8).
+</longdesc>
+<shortdesc lang="en">TGT backing store options</shortdesc>
+<content type="string" />
+</parameter>
+
 <parameter name="tgt_device_type" required="0" unique="0">
 <longdesc lang="en">
 TGT specific device type.
@@ -303,6 +313,7 @@ iSCSILogicalUnit_start() {
 		tgt_args=""
 		[[ $OCF_RESKEY_tgt_bstype ]]	&& tgt_args="$tgt_args --bstype=$OCF_RESKEY_tgt_bstype"
 		[[ $OCF_RESKEY_tgt_bsoflags ]]	&& tgt_args="$tgt_args --bsoflags=$OCF_RESKEY_tgt_bsoflags"
+		[[ $OCF_RESKEY_tgt_bsopts ]]	&& tgt_args="$tgt_args --bsopts=$OCF_RESKEY_tgt_bsopts"
 		[[ $OCF_RESKEY_tgt_device_type ]]	&& tgt_args="$tgt_args --device-type=$OCF_RESKEY_tgt_device_type"
 
 		ocf_run tgtadm --lld iscsi --op new --mode logicalunit \
@@ -452,8 +463,10 @@ iSCSILogicalUnit_stop() {
 }
 
 iSCSILogicalUnit_monitor() {
-	# If our backing device (or file) doesn't even exist, we're not running
-	[ -e ${OCF_RESKEY_path} ] || return $OCF_NOT_RUNNING
+	if [ x"${OCF_RESKEY_tgt_bstype}" != x"rbd" ]; then
+		# If our backing device (or file) doesn't even exist, we're not running
+		[ -e ${OCF_RESKEY_path} ] || return $OCF_NOT_RUNNING
+	fi
 
 	case $OCF_RESKEY_implementation in
 	iet)
@@ -581,16 +594,16 @@ iSCSILogicalUnit_validate() {
 	iet)
 		# IET does not support setting the vendor and product ID
 		# (it always uses "IET" and "VIRTUAL-DISK")
-		unsupported_params="vendor_id product_id allowed_initiators lio_iblock tgt_bstype tgt_bsoflags tgt_device_type"
+		unsupported_params="vendor_id product_id allowed_initiators lio_iblock tgt_bstype tgt_bsoflags tgt_bsopts tgt_device_type"
 		;;
 	tgt)
 		unsupported_params="allowed_initiators lio_iblock"
 		;;
 	lio)
-		unsupported_params="scsi_id vendor_id product_id tgt_bstype tgt_bsoflags tgt_device_type"
+		unsupported_params="scsi_id vendor_id product_id tgt_bstype tgt_bsoflags tgt_bsopts tgt_device_type"
 		;;
 	lio-t)
-		unsupported_params="scsi_id vendor_id product_id tgt_bstype tgt_bsoflags tgt_device_type lio_iblock"
+		unsupported_params="scsi_id vendor_id product_id tgt_bstype tgt_bsoflags tgt_bsopts tgt_device_type lio_iblock"
 		;;
 	esac
 
diff --git a/heartbeat/iSCSITarget b/heartbeat/iSCSITarget
index b71a21f..08a7656 100755
--- a/heartbeat/iSCSITarget
+++ b/heartbeat/iSCSITarget
@@ -56,7 +56,7 @@ meta_data() {
 	cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="iSCSITarget" version="0.9">
+<resource-agent name="iSCSITarget">
 <version>0.9</version>
 
 <longdesc lang="en">
@@ -105,6 +105,15 @@ listens on ${OCF_RESKEY_portal_default}.
 <content type="string" default="${OCF_RESKEY_portals_default}"/>
 </parameter>
 
+<parameter name="iser_portals" required="0" unique="0">
+<longdesc lang="en">
+iSCSI iSER network portal addresses. Not supported by all
+implementations.
+</longdesc>
+<shortdesc lang="en">iSCSI iSER enabled portal addresses</shortdesc>
+<content type="string"/>
+</parameter>
+
 <parameter name="allowed_initiators" required="0" unique="0">
 <longdesc lang="en">
 Allowed initiators. A space-separated list of initiators allowed to
@@ -347,6 +356,17 @@ iSCSITarget_start() {
 				ocf_log warn "Unsupported iSCSI target parameter ${name}: will be ignored."
 			fi
 		done
+		
+		# allow iSER enabled portal
+		for iser_portal in ${OCF_RESKEY_iser_portals}; do
+                       configfs_path="/sys/kernel/config/target/iscsi/${OCF_RESKEY_iqn}/tpgt_1/np/${iser_portal}\:*/iser"
+                       if [ -f ${configfs_path} ]; then
+                                 echo "1" > ${configfs_path} || exit $OCF_ERR_GENERIC
+                       else
+                                 ocf_log warn "Unable to set iSER on: $iser_portal"
+                       fi
+                done
+		
 		# lio does per-initiator filtering by default. To disable
 		# this, we need to switch the target to "permissive mode".
 		if [ -n "${OCF_RESKEY_allowed_initiators}" ]; then
diff --git a/heartbeat/ids b/heartbeat/ids
index 740f450..f232933 100755
--- a/heartbeat/ids
+++ b/heartbeat/ids
@@ -13,7 +13,7 @@
 # Author:			Lars D. Forseth, <lars.forseth at de.ibm.com> or <lars at forseth.de>
 # Created:			May 25th 2007
 # Last Modified:	July 30th 2007
-# Support:			linux-ha at lists.linux-ha.org
+# Support:			users at clusterlabs.org
 # License:			GNU General Public License (GPL), Version 2 or later
 # Copyright:		(c) 2002 - 2007 International Business Machines, Inc.
 #
diff --git a/heartbeat/jboss b/heartbeat/jboss
index 48a51ca..ca8e20b 100755
--- a/heartbeat/jboss
+++ b/heartbeat/jboss
@@ -345,7 +345,7 @@ The version of JBoss. Default is 5.
 The usage of JBoss was greatly changed as of JBoss 6.
 Specify "6" when you use JBoss 6.
 </longdesc>
-<shortdesc>The version of JBoss</shortdesc>
+<shortdesc lang="en">The version of JBoss</shortdesc>
 <content type="integer" default="5" />
 </parameter>
 
@@ -354,7 +354,7 @@ Specify "6" when you use JBoss 6.
 The name of the resource. Defaults to the name of the resource
 instance.
 </longdesc>
-<shortdesc>The name of the resource</shortdesc>
+<shortdesc lang="en">The name of the resource</shortdesc>
 <content type="string" default="${OCF_RESOURCE_INSTANCE}" />
 </parameter>
 
@@ -362,7 +362,7 @@ instance.
 <longdesc lang="en">
 A destination of the log of jboss run and shutdown script.
 </longdesc>
-<shortdesc>jboss log path</shortdesc>
+<shortdesc lang="en">jboss log path</shortdesc>
 <content type="string" default="" />
 </parameter>
 
@@ -374,7 +374,7 @@ signal is used to terminate the jboss process. You should set the
 timeout for the stop operation to a value bigger than the sum of
 the timeout parameters. See also kill_timeout.
 </longdesc>
-<shortdesc>shutdown timeout</shortdesc>
+<shortdesc lang="en">shutdown timeout</shortdesc>
 <content type="integer" default="5" />
 </parameter>
 
@@ -385,7 +385,7 @@ it TERM and QUIT signals, intermittently and once a second. After
 this timeout expires, if the process is still live, we use the
 KILL signal. See also shutdown_timeout.
 </longdesc>
-<shortdesc>stop by signal timeout</shortdesc>
+<shortdesc lang="en">stop by signal timeout</shortdesc>
 <content type="integer" default="10" />
 </parameter>
 
@@ -393,7 +393,7 @@ KILL signal. See also shutdown_timeout.
 <longdesc lang="en">
 A user name to start a JBoss.
 </longdesc>
-<shortdesc>A user name to start a resource.</shortdesc>
+<shortdesc lang="en">A user name to start a resource.</shortdesc>
 <content type="string" default="root"/>
 </parameter>
 
@@ -401,7 +401,7 @@ A user name to start a JBoss.
 <longdesc lang="en">
 URL to test in the monitor operation.
 </longdesc>
-<shortdesc>URL to test in the monitor operation.</shortdesc>
+<shortdesc lang="en">URL to test in the monitor operation.</shortdesc>
 <content type="string" default="${OCF_RESKEY_statusurl_default}" />
 </parameter>
 
@@ -410,7 +410,7 @@ URL to test in the monitor operation.
 Home directory of Java. Defaults to the environment variable
 JAVA_HOME. If it is not set, then define this parameter.
 </longdesc>
-<shortdesc>Home directory of Java.</shortdesc>
+<shortdesc lang="en">Home directory of Java.</shortdesc>
 <content type="string" default="$JAVA_HOME"/>
 </parameter>
 
@@ -418,7 +418,7 @@ JAVA_HOME. If it is not set, then define this parameter.
 <longdesc lang="en">
 Java options.
 </longdesc>
-<shortdesc>Java options.</shortdesc>
+<shortdesc lang="en">Java options.</shortdesc>
 <content type="string" default=""/>
 </parameter>
 
@@ -426,7 +426,7 @@ Java options.
 <longdesc lang="en">
 Home directory of Jboss.
 </longdesc>
-<shortdesc>Home directory of Jboss.</shortdesc>
+<shortdesc lang="en">Home directory of Jboss.</shortdesc>
 <content type="string" default=""/>
 </parameter>
 
@@ -434,7 +434,7 @@ Home directory of Jboss.
 <longdesc lang="en">
 Base directory of JBoss. This parameter is not used in JBoss5.
 </longdesc>
-<shortdesc>Base directory of JBoss.</shortdesc>
+<shortdesc lang="en">Base directory of JBoss.</shortdesc>
 <content type="string" default="${OCF_RESKEY_jboss_base_dir_default}" />
 </parameter>
 
@@ -442,7 +442,7 @@ Base directory of JBoss. This parameter is not used in JBoss5.
 <longdesc lang="en">
 With this string heartbeat matches for the right process to kill.
 </longdesc>
-<shortdesc>pkill/pgrep search string</shortdesc>
+<shortdesc lang="en">pkill/pgrep search string</shortdesc>
 <content type="string" default="${OCF_RESKEY_pstring_default}" />
 </parameter>
 
@@ -450,7 +450,7 @@ With this string heartbeat matches for the right process to kill.
 <longdesc lang="en">
 JBoss start command.
 </longdesc>
-<shortdesc>JBoss start command.</shortdesc>
+<shortdesc lang="en">JBoss start command.</shortdesc>
 <content type="string" default="${OCF_RESKEY_run_command_default}" />
 </parameter>
 
@@ -458,7 +458,7 @@ JBoss start command.
 <longdesc lang="en">
 Start options to start Jboss with, defaults are from the Jboss-Doku.
 </longdesc>
-<shortdesc>options for jboss run.sh</shortdesc>
+<shortdesc lang="en">options for jboss run.sh</shortdesc>
 <content type="string" default="${OCF_RESKEY_run_opts_default}" />
 </parameter>
 
@@ -466,7 +466,7 @@ Start options to start Jboss with, defaults are from the Jboss-Doku.
 <longdesc lang="en">
 Stop options to stop Jboss with.
 </longdesc>
-<shortdesc>options for jboss shutdown.sh</shortdesc>
+<shortdesc lang="en">options for jboss shutdown.sh</shortdesc>
 <content type="string" default="-s 127.0.0.1:1099" />
 </parameter>
 
@@ -474,7 +474,7 @@ Stop options to stop Jboss with.
 <longdesc lang="en">
 Rotate console log flag.
 </longdesc>
-<shortdesc>Rotate console log flag</shortdesc>
+<shortdesc lang="en">Rotate console log flag</shortdesc>
 <content type="boolean" default="false" />
 </parameter>
 
@@ -482,7 +482,7 @@ Rotate console log flag.
 <longdesc lang="en">
 Console log rotation value (default is 86400 seconds).
 </longdesc>
-<shortdesc>Console log rotation value (default is 86400 seconds)</shortdesc>
+<shortdesc lang="en">Console log rotation value (default is 86400 seconds)</shortdesc>
 <content type="integer" default="86400" />
 </parameter>
 
@@ -490,7 +490,7 @@ Console log rotation value (default is 86400 seconds).
 <longdesc lang="en">
 Rotate console log suffix.
 </longdesc>
-<shortdesc>Rotate console log suffix</shortdesc>
+<shortdesc lang="en">Rotate console log suffix</shortdesc>
 <content type="integer" default=".%F" />
 </parameter>
 
diff --git a/heartbeat/kamailio b/heartbeat/kamailio
index e200d8c..0968ac6 100755
--- a/heartbeat/kamailio
+++ b/heartbeat/kamailio
@@ -80,7 +80,7 @@ meta_data() {
 	cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="kamailio" version="1.0">
+<resource-agent name="kamailio">
 <version>1.0</version>
 
 <longdesc lang="en">
diff --git a/heartbeat/lxc b/heartbeat/lxc
index dca5fe4..b582cb2 100755
--- a/heartbeat/lxc
+++ b/heartbeat/lxc
@@ -1,7 +1,8 @@
 #!/bin/bash
-# Should now conform to guidelines: http://www.linux-ha.org/doc/dev-guides/ra-dev-guide.html
+# Should now conform to guidelines:
+# https://github.com/ClusterLabs/resource-agents/blob/master/doc/dev-guides/ra-dev-guide.asc
 #
-#	LXC (Linux Containers) OCF RA. 
+#	LXC (Linux Containers) OCF RA.
 #	Used to cluster enable the start, stop and monitoring of a LXC container.
 #
 # Copyright (c) 2011 AkurIT.com.au, Darren Thompson
@@ -54,7 +55,7 @@ meta_data() {
 cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="lxc" version="0.1">
+<resource-agent name="lxc">
 <version>0.1</version>
 <longdesc lang="en">Allows LXC containers to be managed by the cluster.
 If the container is running "init" it will also perform an orderly shutdown.
diff --git a/heartbeat/metadata.rng b/heartbeat/metadata.rng
new file mode 100644
index 0000000..ac534db
--- /dev/null
+++ b/heartbeat/metadata.rng
@@ -0,0 +1,91 @@
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+
+<start><element name="resource-agent">
+	<attribute name="name" />
+	<element name="version"> <text /> </element>
+	<element name="longdesc"> <attribute name="lang" /> <text /> </element>
+	<element name="shortdesc"> <attribute name="lang" /> <text /> </element>
+
+	<element name="parameters"> <oneOrMore>
+		<element name="parameter">
+			<attribute name="name" />
+			<optional>
+			<attribute name="unique"> <ref name="boolean-values" /> </attribute>
+			</optional>
+			<optional>
+				<attribute name="required"> <ref name="boolean-values" /> </attribute>
+			</optional>
+
+			<element name="longdesc">
+				<attribute name="lang" />
+				<text />
+			</element>
+
+			<element name="shortdesc">
+				<attribute name="lang" />
+				<text />
+			</element>
+
+			<element name="content">
+				<choice>
+					<attribute name="type">
+						<choice>
+							<value>boolean</value>
+							<value>string</value>
+							<value>second</value>
+							<value>integer</value>
+						</choice>
+					</attribute>
+					<group>
+						<attribute name="type">
+							<value>select</value>
+						</attribute>
+						<zeroOrMore>
+							<element name="option">
+								<attribute name="value" />
+							</element>
+						</zeroOrMore>
+					</group>
+				</choice>
+				<optional>
+					<attribute name="default"> <text /> </attribute>
+				</optional>
+			</element>
+		</element>
+	</oneOrMore> </element>
+
+	<element name="actions"> <oneOrMore>
+		<element name="action">
+			<attribute name="name" />
+			<optional>
+				<attribute name="depth" />
+			</optional>
+			<attribute name="timeout" />
+			<optional>
+				<attribute name="interval" />
+			</optional>
+			<optional>
+				<attribute name="start-delay" />
+			</optional>
+			<optional>
+				<attribute name="role"> <ref name="role-values" /> </attribute>
+			</optional>
+		</element>
+	</oneOrMore> </element>
+</element></start>
+
+<define name="boolean-values">
+	<choice>
+		<value>0</value>
+		<value>1</value>
+	</choice>
+</define>
+
+<define name="role-values">
+	<choice>
+		<value>Master</value>
+		<value>Slave</value>
+	</choice>
+</define>
+
+</grammar>
diff --git a/heartbeat/mysql b/heartbeat/mysql
index e2d54dd..e76213b 100755
--- a/heartbeat/mysql
+++ b/heartbeat/mysql
@@ -13,7 +13,7 @@
 #           Marian Marinov, Florian Haas: add replication capability
 #           Yves Trudeau, Baron Schwartz: add VIP support and improve replication
 #
-# Support:  linux-ha at lists.linux-ha.org
+# Support:  users at clusterlabs.org
 # License:  GNU General Public License (GPL)
 #
 # (c) 2002-2005 International Business Machines, Inc.
@@ -549,6 +549,7 @@ set_master() {
 
     ocf_run $MYSQL $MYSQL_OPTIONS_REPL \
         -e "CHANGE MASTER TO MASTER_HOST='$new_master', \
+        MASTER_PORT=$OCF_RESKEY_replication_port, \
         MASTER_USER='$OCF_RESKEY_replication_user', \
         MASTER_PASSWORD='$OCF_RESKEY_replication_passwd' $master_params"
     rm -f $tmpfile
diff --git a/heartbeat/mysql-proxy b/heartbeat/mysql-proxy
index 024e97e..4cb0bc9 100755
--- a/heartbeat/mysql-proxy
+++ b/heartbeat/mysql-proxy
@@ -513,10 +513,10 @@ mysqlproxy_monitor_20()
             mysql_server_host=`echo $pa | cut -d : -f 1`
             mysql_server_port=`echo $pa | cut -d : -f 2`
 
-            if [ -n $mysql_server_host ]; then
+            if [ -n "$mysql_server_host" ]; then
                 mysql_server_parameter="$mysql_server_parameter --host=$mysql_server_host"
             fi
-            if [ -n $mysql_server_port ]; then
+            if [ -n "$mysql_server_port" ]; then
                 mysql_server_parameter="$mysql_server_parameter --port=$mysql_server_port"
             fi
         fi
diff --git a/heartbeat/nagios b/heartbeat/nagios
index e61306c..d2067bc 100755
--- a/heartbeat/nagios
+++ b/heartbeat/nagios
@@ -130,7 +130,6 @@ nagios_start() {
         return $rc
     fi
 
-
     # if resource is already running,no need to continue code after this.
     if nagios_monitor; then
         ocf_log info "Nagios is already running"
@@ -138,11 +137,12 @@ nagios_start() {
     fi
 
     # Remove ${OCF_RESKEY_pid} if it exists
-    rm -f ${OCF_RESKEY_pid}
+    rm -f "${OCF_RESKEY_pid}"
 
     ocf_run -q touch ${OCF_RESKEY_log} ${OCF_RESKEY_retention} ${OCF_RESKEY_pid}
     chown ${OCF_RESKEY_user}:${OCF_RESKEY_group} ${OCF_RESKEY_log} ${OCF_RESKEY_retention} ${OCF_RESKEY_pid}
-    rm -f ${OCF_RESKEY_command}
+    rm -f "${OCF_RESKEY_command}"
+
     [ -x /sbin/restorecon ] && /sbin/restorecon ${OCF_RESKEY_pid}
     ocf_run -q ${OCF_RESKEY_binary} -d ${OCF_RESKEY_config}
 
@@ -150,7 +150,7 @@ nagios_start() {
         sleep 1
     done
 
-    if [ $? -eq "0" ]; then
+    if [ $? -eq 0 ]; then
         ocf_log info "Nagios started"
         return ${OCF_SUCCESS}
     fi
@@ -160,7 +160,7 @@ nagios_start() {
 
 nagios_stop() {
     nagios_monitor
-    if [ "$?" -ne "$OCF_SUCCESS" ]; then
+    if [ $? -ne $OCF_SUCCESS ]; then
         # Currently not running. Nothing to do.
         ocf_log info "Resource is already stopped"
         rm -f ${OCF_RESKEY_pid}
@@ -174,7 +174,7 @@ nagios_stop() {
     while nagios_monitor; do
         sleep 1
     done
-    
+
     return $OCF_SUCCESS
 }
 
@@ -195,15 +195,15 @@ nagios_monitor(){
 }
 
 nagios_validate_all(){
-    check_binary ${OCF_RESKEY_binary}
-    
-    if [ ! -f ${OCF_RESKEY_config} ]; then
+    check_binary "${OCF_RESKEY_binary}"
+
+    if [ ! -f "${OCF_RESKEY_config}" ]; then
         ocf_exit_reason "Configuration file ${OCF_RESKEY_config} not found"
         return ${OCF_ERR_INSTALLED}
     fi
-    
-    ${OCF_RESKEY_binary} -v ${OCF_RESKEY_config} > /dev/null 2>&1;
-    if [ $? -ne "0" ]; then
+
+    ${OCF_RESKEY_binary} -v ${OCF_RESKEY_config} >/dev/null 2>&1
+    if [ $? -ne 0 ]; then
         ocf_exit_reason "Configuration check failed"
         return ${OCF_ERR_INSTALLED}
     fi
@@ -242,5 +242,5 @@ esac
 rc=$?
 
 exit $rc
-  
+
 # End of this script
diff --git a/heartbeat/nfsnotify b/heartbeat/nfsnotify
index b8dc1e4..6d4961f 100755
--- a/heartbeat/nfsnotify
+++ b/heartbeat/nfsnotify
@@ -50,7 +50,7 @@ meta_data() {
 	cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="nfsnotify" version="0.9">
+<resource-agent name="nfsnotify">
 <version>1.0</version>
 
 <longdesc lang="en">
diff --git a/heartbeat/nfsserver b/heartbeat/nfsserver
index 4b6767b..52d9bb2 100755
--- a/heartbeat/nfsserver
+++ b/heartbeat/nfsserver
@@ -16,11 +16,15 @@ if is_redhat_based; then
 	. ${OCF_FUNCTIONS_DIR}/nfsserver-redhat.sh
 fi
 
+DEFAULT_INIT_SCRIPT_LIST="/etc/init.d/nfsserver /etc/init.d/nfs /etc/init.d/nfs-kernel-server"
 DEFAULT_INIT_SCRIPT="/etc/init.d/nfsserver"
-if ! [ -f $DEFAULT_INIT_SCRIPT ]; then
-	# On some systems, the script is just called nfs
-	DEFAULT_INIT_SCRIPT="/etc/init.d/nfs"
-fi
+for script in $DEFAULT_INIT_SCRIPT_LIST
+do
+	if [ -f $script -a -x $script ]; then
+		DEFAULT_INIT_SCRIPT=$script
+		break
+	fi
+done
 
 DEFAULT_NOTIFY_CMD=`which sm-notify`
 DEFAULT_NOTIFY_CMD=${DEFAULT_NOTIFY_CMD:-"/sbin/sm-notify"}
@@ -266,12 +270,21 @@ set_exec_mode()
 nfs_exec()
 {
 	local cmd=$1
+	local svc=$2
 	set_exec_mode
 
 	case $EXEC_MODE in 
 		1) ${OCF_RESKEY_nfs_init_script} $cmd;;
-		2) systemctl $cmd nfs-server.service ;;
-		3) systemctl $cmd nfs-server.service ;;
+		2) if ! echo $svc | grep -q "\."; then
+			svc="${svc}.service"
+		   fi
+		   systemctl $cmd $svc
+		   ;;
+		3) if ! echo $svc | grep -q "\."; then
+			svc="${svc}.service"
+		   fi
+		   systemctl $cmd $svc
+		   ;;
 	esac
 }
 
@@ -281,9 +294,9 @@ v3locking_exec()
 	set_exec_mode
 
 	if [ $EXEC_MODE -eq 2 ]; then
-		systemctl $cmd nfs-lock.service
+		nfs_exec $cmd nfs-lock.service
 	elif [ $EXEC_MODE -eq 3 ]; then
-		systemctl $cmd rpc-statd.service
+		nfs_exec $cmd rpc-statd.service
 	else 
 		case $cmd in
 			start) locking_start;;
@@ -297,8 +310,44 @@ nfsserver_systemd_monitor()
 {
 	local threads_num
 	local rc
+	local fn
+
+	ocf_log debug "Status: rpcbind"
+	rpcinfo > /dev/null 2>&1
+	rc=$?
+	if [ "$rc" -ne "0" ]; then
+		ocf_exit_reason "rpcbind is not running"
+		return $OCF_NOT_RUNNING
+	fi
+
+	ocf_log debug "Status: nfs-mountd"
+	rpcinfo -t localhost 100005 > /dev/null 2>&1
+	rc=$?
+	if [ "$rc" -ne "0" ]; then
+		ocf_exit_reason "nfs-mountd is not running"
+		return $OCF_NOT_RUNNING
+	fi
+
+	ocf_log debug "Status: nfs-idmapd"
+	fn=`mktemp`
+	nfs_exec status nfs-idmapd > $fn 2>&1
+	rc=$?
+	ocf_log debug "$(cat $fn)"
+	rm -f $fn
+	if [ "$rc" -ne "0" ]; then
+		ocf_exit_reason "nfs-idmapd is not running"
+		return $OCF_NOT_RUNNING
+	fi
+
+	ocf_log debug "Status: rpc-statd"
+	rpcinfo -t localhost 100024 > /dev/null 2>&1
+	rc=$?
+	if [ "$rc" -ne "0" ]; then
+		ocf_exit_reason "rpc-statd is not running"
+		return $OCF_NOT_RUNNING
+	fi
 
-	nfs_exec is-active
+	nfs_exec is-active nfs-server
 	rc=$?
 
 	# Now systemctl is-active can't detect the failure of kernel process like nfsd.
@@ -323,10 +372,12 @@ nfsserver_systemd_monitor()
 
 nfsserver_monitor ()
 {
+	local fn
+
 	set_exec_mode
 	fn=`mktemp`
 	case $EXEC_MODE in
-               1) nfs_exec status > $fn 2>&1;;
+               1) nfs_exec status nfs-server > $fn 2>&1;;
             [23]) nfsserver_systemd_monitor > $fn 2>&1;;
 	esac
 	rc=$?
@@ -344,7 +395,7 @@ nfsserver_monitor ()
 			rc=$OCF_ERR_GENERIC
 		fi
 		return $rc
-	elif [ $rc -eq 3 ]; then
+	elif [ $rc -eq 3 ] || [ $rc -eq $OCF_NOT_RUNNING ]; then
 		return $OCF_NOT_RUNNING
 	else
 		return $OCF_ERR_GENERIC
@@ -555,6 +606,7 @@ notify_locks()
 nfsserver_start ()
 {
 	local rc;
+	local fn
 
 	if nfsserver_monitor; then
 		ocf_log debug "NFS server is already started"
@@ -582,6 +634,23 @@ nfsserver_start ()
 		modprobe nfsd
 	fi
 
+	# systemd
+	case $EXEC_MODE in
+            [23]) nfs_exec start rpcbind
+		  local i=1
+		  while : ; do
+			ocf_log info "Start: rpcbind i: $i"
+			rpcinfo > /dev/null 2>&1
+			rc=$?
+			if [ "$rc" -eq "0" ]; then
+				break;
+			fi
+			sleep 1
+			i=$((i + 1))
+		  done
+		  ;;
+	esac
+
 	# check to see if we need to start rpc.statd
 	v3locking_exec "status"
 	if [ $? -ne $OCF_SUCCESS ]; then
@@ -595,8 +664,54 @@ nfsserver_start ()
 		ocf_log info "rpc.statd already up"
 	fi
 
+	# systemd
+	case $EXEC_MODE in
+            [23]) nfs_exec start nfs-mountd
+		  local i=1
+		  while : ; do
+			ocf_log info "Start: nfs-mountd i: $i"
+			rpcinfo -t localhost 100005 > /dev/null 2>&1
+			rc=$?
+			if [ "$rc" -eq "0" ]; then
+				break;
+			fi
+			sleep 1
+			i=$((i + 1))
+		  done
+
+		  nfs_exec start nfs-idmapd
+		  local i=1
+		  while : ; do
+			ocf_log info "Start: nfs-idmapd i: $i"
+			fn=`mktemp`
+			nfs_exec status nfs-idmapd > $fn 2>&1
+			rc=$?
+			ocf_log debug "$(cat $fn)"
+			rm -f $fn
+			if [ "$rc" -eq "0" ]; then
+				break;
+			fi
+			sleep 1
+			i=$((i + 1))
+		  done
+
+		  nfs_exec start rpc-statd
+		  local i=1
+		  while : ; do
+			ocf_log info "Start: rpc-statd i: $i"
+			rpcinfo -t localhost 100024 > /dev/null 2>&1
+			rc=$?
+			if [ "$rc" -eq "0" ]; then
+				break;
+			fi
+			sleep 1
+			i=$((i + 1))
+		  done
+	esac
+
+
 	fn=`mktemp`
-	nfs_exec start > $fn 2>&1
+	nfs_exec start nfs-server > $fn 2>&1
 	rc=$?
 	ocf_log debug "$(cat $fn)"
 	rm -f $fn
@@ -604,7 +719,13 @@ nfsserver_start ()
 	if [ $rc -ne 0 ]; then
 		ocf_exit_reason "Failed to start NFS server"
 		return $rc
-	fi	
+	fi
+
+	tfn="/proc/fs/nfsd/threads"
+	if [ ! -f "$tfn" ] || [ "$(cat $tfn)" -le "0" ]; then
+		ocf_exit_reason "Failed to start NFS server: /proc/fs/nfsd/threads"
+		return $OCF_ERR_GENERIC
+	fi
 
 	notify_locks
 
@@ -614,6 +735,8 @@ nfsserver_start ()
 
 nfsserver_stop ()
 {
+	local fn
+
 	ocf_log info "Stopping NFS server ..."
 
 	# backup the current sm state information to the ha folder before stopping.
@@ -622,24 +745,72 @@ nfsserver_stop ()
 	cp -rpf $STATD_PATH/sm $STATD_PATH/sm.bak /var/lib/nfs/state $STATD_PATH/sm.ha > /dev/null 2>&1
 
 	fn=`mktemp`
-	nfs_exec stop > $fn 2>&1
+	nfs_exec stop nfs-server > $fn 2>&1
 	rc=$?
 	ocf_log debug "$(cat $fn)"
 	rm -f $fn
 
+	if [ $rc -ne 0 ]; then
+		ocf_exit_reason "Failed to stop NFS server"
+		return $rc
+	fi
+
+	# systemd
+	case $EXEC_MODE in
+            [23]) ocf_log info "Stop: threads"
+		  tfn="/proc/fs/nfsd/threads"
+		  if [ -f "$tfn" ] && [ "$(cat $tfn)" -gt "0" ]; then
+			ocf_exit_reason "NFS server failed to stop: /proc/fs/nfsd/threads"
+			return $OCF_ERR_GENERIC
+		  fi
+
+		  nfs_exec stop rpc-statd > /dev/null 2>&1
+		  ocf_log info "Stop: rpc-statd"
+		  rpcinfo -t localhost 100024 > /dev/null 2>&1
+		  rc=$?
+		  if [ "$rc" -eq "0" ]; then
+			ocf_exit_reason "Failed to stop rpc-statd"
+			return $OCF_ERR_GENERIC
+		  fi
+
+		  nfs_exec stop nfs-idmapd > /dev/null 2>&1
+		  ocf_log info "Stop: nfs-idmapd"
+		  fn=`mktemp`
+		  nfs_exec status nfs-idmapd > $fn 2>&1
+		  rc=$?
+		  ocf_log debug "$(cat $fn)"
+		  rm -f $fn
+		  if [ "$rc" -eq "0" ]; then
+			ocf_exit_reason "Failed to stop nfs-idmapd"
+			return $OCF_ERR_GENERIC
+		  fi
+
+		  nfs_exec stop nfs-mountd > /dev/null 2>&1
+		  ocf_log info "Stop: nfs-mountd"
+		  rpcinfo -t localhost 100005 > /dev/null 2>&1
+		  rc=$?
+		  if [ "$rc" -eq "0" ]; then
+			ocf_exit_reason "Failed to stop nfs-mountd"
+			return $OCF_ERR_GENERIC
+		  fi
+	esac
+
+
 	v3locking_exec "stop"
 	if [ $? -ne 0 ]; then
 		ocf_exit_reason "Failed to stop NFS locking daemons"
 		rc=$OCF_ERR_GENERIC
 	fi
 
-	if [ $rc -eq 0 ]; then
-		unbind_tree 
-		ocf_log info "NFS server stopped"
-	else 
-		ocf_exit_reason "Failed to stop NFS server"
-	fi
-	return $rc
+	# systemd
+	case $EXEC_MODE in
+            [23]) nfs_exec stop rpc-gssd > /dev/null 2>&1
+		  ocf_log info "Stop: rpc-gssd"
+	esac
+
+	unbind_tree
+	ocf_log info "NFS server stopped"
+	return 0
 }
 
 nfsserver_validate ()
diff --git a/heartbeat/nginx b/heartbeat/nginx
index a7fb5d0..d28c5a1 100755
--- a/heartbeat/nginx
+++ b/heartbeat/nginx
@@ -10,7 +10,7 @@
 #		Dejan Muhamedagic
 #		This code is based significantly on the apache resource agent
 #
-# Support:	linux-ha at lists.linux-ha.org
+# Support:	users at clusterlabs.org
 #
 # License:	GNU General Public License (GPL)
 #
@@ -79,7 +79,7 @@ CMD=`basename $0`
 #	file for this web server.  Various appropriate defaults are
 #	assumed if no config file is specified.
 usage() {
-  cat <<-!
+  cat <<-EOF
 usage: $0 action
 
 action:
@@ -100,7 +100,7 @@ action:
 	meta-data	show meta data message
 
 	validate-all	validate the instance parameters
-	!
+	EOF
   exit $1
 }
 
@@ -273,7 +273,7 @@ nginxcat() {
 get_nginx_params() {
   configfile=$1
   shift 1
-  vars=`echo $@ | sed 's/ /,/g'`
+  vars=`echo "$@" | sed 's/ /,/g'`
 
   eval `
   nginxcat $configfile | awk -v vars="$vars" '
diff --git a/heartbeat/ocf-directories.in b/heartbeat/ocf-directories.in
index 6e0a9d5..8d70776 100644
--- a/heartbeat/ocf-directories.in
+++ b/heartbeat/ocf-directories.in
@@ -18,5 +18,5 @@ exec_prefix=@exec_prefix@
 : ${HA_RESOURCEDIR:=$HA_DIR/resource.d}
 : ${HA_DOCDIR:=@datadir@/doc/heartbeat}
 : ${__SCRIPT_NAME:=`basename $0`}
-: ${HA_VARRUN:=@localstatedir@/run/}
-: ${HA_VARLOCK:=@localstatedir@/lock/subsys/}
+: ${HA_VARRUN:=@localstatedir@/run}
+: ${HA_VARLOCK:=@localstatedir@/lock/subsys}
diff --git a/heartbeat/ocf-shellfuncs.in b/heartbeat/ocf-shellfuncs.in
index 8ff19af..fdd314a 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: e697f43c4e59a47bd0dc7c093b7d46174035c2dd
+# Build version: 18222e08b4a70df8ae561b3460dcdf8bce0f6c63
 
 # 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
@@ -151,6 +151,10 @@ __ocf_set_defaults() {
 		: ${OCF_RESOURCE_TYPE:=$__SCRIPT_NAME}
 	fi
 
+	if [ "x$__OCF_ACTION" = "xmeta-data" ]; then
+		: ${OCF_RESOURCE_INSTANCE:="RESOURCE_ID"}
+	fi
+
 	if [ -z "$OCF_RA_VERSION_MAJOR" ]; then
 		: We are being invoked as an init script.
 		: Fill in some things with reasonable values.
@@ -158,10 +162,6 @@ __ocf_set_defaults() {
 		return 0
         fi
 
-	if [ "x$__OCF_ACTION" = "xmeta-data" ]; then
-		OCF_RESOURCE_INSTANCE="undef"
-	fi	
-
 	if [ -z "$OCF_RESOURCE_INSTANCE" ]; then
 		ha_log "ERROR: Need to tell us our resource instance name."
 		exit $OCF_ERR_ARGS
@@ -613,8 +613,7 @@ dirname()
 # resource monitoring, and better resource tracking in general, this will
 # become essential.
 #
-# These scripts work because ${HA_RSCTMP} is cleaned out every time
-# heartbeat is started.
+# These scripts work because ${HA_RSCTMP} is cleaned on node reboot.
 #
 # We create "resource-string" tracking files under ${HA_RSCTMP} in a
 # very simple way:
@@ -779,7 +778,7 @@ ocf_mkstatedir()
 	[ $(id -u) = 0 ] || return 1
 
 	case $path in
-	$HA_VARRUN/*) : this path is ok ;;
+	${HA_VARRUN%/}/*) : this path is ok ;;
 	*) ocf_log err "cannot create $path (does not start with $HA_VARRUN)"
 		return 1
 	;;
diff --git a/heartbeat/ora-common.sh b/heartbeat/ora-common.sh
index 728caaf..b238d12 100644
--- a/heartbeat/ora-common.sh
+++ b/heartbeat/ora-common.sh
@@ -4,7 +4,7 @@
 #
 #
 # Author:      Dejan Muhamedagic
-# Support:     linux-ha at lists.linux-ha.org
+# Support:     users at clusterlabs.org
 # License:     GNU General Public License (GPL)
 # Copyright:   (C) 2012 Dejan Muhamedagic, SUSE/Attachmate
 #
diff --git a/heartbeat/oracle b/heartbeat/oracle
index 951221c..67e4385 100755
--- a/heartbeat/oracle
+++ b/heartbeat/oracle
@@ -8,7 +8,7 @@
 #
 #
 # Author:	Dejan Muhamedagic
-# Support:	linux-ha at lists.linux-ha.org
+# Support:	users at clusterlabs.org
 # License:	GNU General Public License (GPL)
 # Copyright:	(C) 2006 International Business Machines, Inc.
 #
@@ -291,7 +291,7 @@ dbasql() {
 	runsql "connect / as sysdba" $*
 }
 monsql() {
-	runsql "connect $MONUSR/\"$MONPWD\"" $*
+	runsql "connect \"$MONUSR\"/\"$MONPWD\"" $*
 }
 # use dbasql_one if the query should result in a single line output
 # at times people stuff commands in oracle .profile
@@ -371,7 +371,7 @@ show_mon_profile() {
 }
 mk_mon_profile() {
 	cat<<EOF
-create profile $MONPROFILE limit FAILED_LOGIN_ATTEMPTS UNLIMITED PASSWORD_LIFE_TIME UNLIMITED;
+create profile "$MONPROFILE" limit FAILED_LOGIN_ATTEMPTS UNLIMITED PASSWORD_LIFE_TIME UNLIMITED;
 EOF
 }
 show_mon_user() {
@@ -379,19 +379,19 @@ show_mon_user() {
 }
 mk_mon_user() {
 	cat<<EOF
-create user $MONUSR identified by "$MONPWD" profile $MONPROFILE;
-grant create session to $MONUSR;
-grant select on v_\$instance to $MONUSR;
+create user "$MONUSR" identified by "$MONPWD" profile "$MONPROFILE";
+grant create session to "$MONUSR";
+grant select on v_\$instance to "$MONUSR";
 EOF
 }
 show_mon_user_profile() {
 	echo "select PROFILE from dba_users where USERNAME='$MONUSR';"
 }
 set_mon_user_profile() {
-	echo "alter user $MONUSR profile $MONPROFILE;"
+	echo "alter user "$MONUSR" profile '$MONPROFILE';"
 }
 reset_mon_user_password() {
-	echo "alter user $MONUSR identified by $MONPWD;"
+	echo "alter user "$MONUSR" identified by "$MONPWD";"
 }
 check_mon_profile() {
 	local output
@@ -402,6 +402,9 @@ check_mon_profile() {
 	output=`dbasql mk_mon_profile show_mon_profile`
 	if echo "$output" | grep -iw "^$MONPROFILE" >/dev/null; then
 		return 0
+	elif echo "$output" | grep ORA-65140 >/dev/null 2>&1; then
+		ocf_exit_reason "monprofile must start with C## for container databases"
+		return $OCF_ERR_CONFIGURED
 	else
 		ocf_exit_reason "could not create $MONPROFILE oracle profile"
 		ocf_log err "sqlplus output: $output"
@@ -434,6 +437,9 @@ check_mon_user() {
 	output=`dbasql mk_mon_user show_mon_user`
 	if echo "$output" | grep -iw "^$MONUSR" >/dev/null; then
 		return 0
+	elif echo "$output" | grep ORA-65096 >/dev/null 2>&1; then
+		ocf_exit_reason "monuser must start with C## for container databases"
+		return $OCF_ERR_CONFIGURED
 	else
 		ocf_exit_reason "could not create $MONUSR oracle user"
 		ocf_log err "sqlplus output: $output"
@@ -611,6 +617,7 @@ oracle_start() {
 		if echo "$output" | grep ORA-01081 >/dev/null 2>&1; then
 			ocf_log info "ORA-01081 error found, trying to cleanup oracle (dbstart_mount output: $output)"
 			ora_cleanup
+			output=`dbasql dbstop_immediate`
 			output=`dbasql dbstart_mount`
 		fi
 	fi
@@ -751,10 +758,10 @@ PROCS_CLEANUP_TIME="30"
 
 MONUSR=${OCF_RESKEY_monuser:-$OCF_RESKEY_monuser_default}
 MONPWD=${OCF_RESKEY_monpassword:-$OCF_RESKEY_monpassword_default}
-MONPROFILE=${OCF_RESKEY_monprofile_default:-$OCF_RESKEY_monprofile_default}
+MONPROFILE=${OCF_RESKEY_monprofile:-$OCF_RESKEY_monprofile_default}
 
-MONUSR=$(echo $MONUSR | awk '{print toupper($0)}')
-MONPROFILE=$(echo $MONPROFILE | awk '{print toupper($0)}')
+MONUSR=$(echo "$MONUSR" | awk '{print toupper($0)}')
+MONPROFILE=$(echo "$MONPROFILE" | awk '{print toupper($0)}')
 OCF_REQUIRED_PARAMS="sid"
 OCF_REQUIRED_BINARIES="sqlplus"
 ocf_rarun $*
diff --git a/heartbeat/oralsnr b/heartbeat/oralsnr
index c47f121..83c5128 100755
--- a/heartbeat/oralsnr
+++ b/heartbeat/oralsnr
@@ -8,7 +8,7 @@
 #
 #
 # Author:	Dejan Muhamedagic
-# Support:	linux-ha at lists.linux-ha.org
+# Support:	users at clusterlabs.org
 # License:	GNU General Public License (GPL)
 # Copyright:	(C) 2006 International Business Machines, Inc.
 #
@@ -267,8 +267,8 @@ oralsnr_validate_all() {
 
 # used in ora-common.sh
 show_procs() {
-	ps -e -o pid,user,args |
-		grep '[t]nslsnr' | grep -i -w "$listener" | grep -w "$ORACLE_OWNER"
+	ps -U "$ORACLE_OWNER" -o pid,user,args |
+		grep '[t]nslsnr' | grep -i -w "$listener"
 }
 proc_pids() { show_procs | awk '{print $1}'; }
 PROCS_CLEANUP_TIME="10"
diff --git a/heartbeat/pgagent b/heartbeat/pgagent
new file mode 100755
index 0000000..cb51895
--- /dev/null
+++ b/heartbeat/pgagent
@@ -0,0 +1,139 @@
+#!/bin/sh
+#
+# High-Availability pgagent OCF resource agent
+#
+# Description:  Starts/stops pgagent
+# Author:       Oleg Selin
+# License:      GNU General Public License (GPL)
+#
+# OCF parameters:
+#  OCF_RESKEY_connection_string
+#  OCF_RESKEY_user
+#  OCF_RESKEY_options
+#
+#######################################################################
+# Initialization:
+: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
+. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
+
+OCF_RESKEY_executable_default="`which pgagent`"
+OCF_RESKEY_connection_string_default="user=postgres host=/var/run/postgresql"
+OCF_RESKEY_user_default="postgres"
+OCF_RESKEY_options_default="-r 1 -t 1"
+
+: ${OCF_RESKEY_executable="${OCF_RESKEY_executable_default}"}
+: ${OCF_RESKEY_connection_string="${OCF_RESKEY_connection_string_default}"}
+: ${OCF_RESKEY_user="${OCF_RESKEY_user_default}"}
+: ${OCF_RESKEY_options="${OCF_RESKEY_options_default}"}
+
+pgagent_validate_all() {
+        check_binary pgagent
+        ocf_log debug "executable: '$OCF_RESKEY_executable'"
+        ocf_log debug "connection string: '$OCF_RESKEY_connection_string'"
+        ocf_log debug "user: '$OCF_RESKEY_user'"
+        ocf_log debug "options: '$OCF_RESKEY_options'"
+        if [ -z "$OCF_RESKEY_connection_string" ]; then
+                ocf_log err "Connection string is not configured!"
+                exit $OCF_ERR_CONFIGURED
+        fi
+        if [ -z "$OCF_RESKEY_user" ]; then
+                ocf_log err "User is not configured!"
+                exit $OCF_ERR_CONFIGURED
+        fi
+        getent passwd $OCF_RESKEY_user >/dev/null 2>&1
+        if [ ! $? -eq 0 ]; then
+                ocf_log err "User $OCF_RESKEY_user doesn't exist";
+                return $OCF_ERR_CONFIGURED;
+        fi
+        return $OCF_SUCCESS
+}
+
+pgagent_start() {
+        pgagent_validate_all
+        nohup su - $OCF_RESKEY_user -c "'$OCF_RESKEY_executable' $OCF_RESKEY_options '$OCF_RESKEY_connection_string'" > /dev/null 2>&1 &
+        sleep 1
+        if pgagent_monitor; then
+                return $OCF_SUCCESS
+        fi
+        return $OCF_ERR_GENERIC
+}
+
+pgagent_stop() {
+        pgagent_validate_all
+        pid=`pgrep -f -x -U $OCF_RESKEY_user "$OCF_RESKEY_executable $OCF_RESKEY_options $OCF_RESKEY_connection_string"`
+        if [ -n "$pid" ]; then
+                ocf_run kill $pid || return $OCF_ERR_GENERIC
+        fi
+        return $OCF_SUCCESS
+}
+
+pgagent_monitor() {
+        if [ -z "$OCF_RESKEY_executable" ]; then
+                return $OCF_ERR_INSTALLED
+        fi
+        ocf_run pgrep -f -x -U "$OCF_RESKEY_user" "$OCF_RESKEY_executable $OCF_RESKEY_options $OCF_RESKEY_connection_string" || return $OCF_NOT_RUNNING
+        return $OCF_SUCCESS
+}
+
+meta_data() {
+        cat <<END
+<?xml version="1.0"?>
+<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
+<resource-agent name="pgagent">
+<version>1.0</version>
+<longdesc lang="en">This is a pgagent Resource Agent.</longdesc>
+<shortdesc lang="en">Controls pgagent</shortdesc>
+<parameters>
+<parameter name="connection_string">
+<longdesc lang="en">Connection string for pgagent.</longdesc>
+<shortdesc lang="en">pgagent connection string</shortdesc>
+<content type="string" default="$OCF_RESKEY_connection_string_default" />
+</parameter>
+<parameter name="user">
+<longdesc lang="en">User to run pgagent as.</longdesc>
+<shortdesc lang="en">User to run pgagent</shortdesc>
+<content type="string" default="$OCF_RESKEY_user_default" />
+</parameter>
+<parameter name="options">
+<longdesc lang="en">Options for pgagent.</longdesc>
+<shortdesc lang="en">pgagent run options, see pgagent --help for details</shortdesc>
+<content type="string" default="$OCF_RESKEY_options_default" />
+</parameter>
+</parameters>
+<actions>
+<action name="start" timeout="5" />
+<action name="stop" timeout="5" />
+<action name="monitor" timeout="20" interval="10" depth="0" />
+<action name="meta-data" timeout="5" />
+<action name="validate-all" timeout="5" />
+</actions>
+</resource-agent>
+END
+}
+
+pgagent_usage() {
+        cat <<END
+usage: $0 {start|stop|monitor|meta-data|validate-all}
+
+Expects to have a fully populated OCF RA-compliant environment set.
+END
+}
+
+case $__OCF_ACTION in
+start)          pgagent_start;;
+stop)           pgagent_stop;;
+monitor)        pgagent_monitor;;
+validate-all)   pgagent_validate_all;;
+usage|help)     pgagent_usage
+                exit $OCF_SUCCESS
+                ;;
+meta-data)      meta_data
+                exit $OCF_SUCCESS
+                ;;
+*)              pgagent_usage
+                exit $OCF_ERR_UNIMPLEMENTED
+                ;;
+esac
+rc=$?
+ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc"
+exit $rc
diff --git a/heartbeat/pgsql b/heartbeat/pgsql
index 320db69..b230647 100755
--- a/heartbeat/pgsql
+++ b/heartbeat/pgsql
@@ -53,7 +53,7 @@ OCF_RESKEY_start_opt_default=""
 OCF_RESKEY_ctl_opt_default=""
 OCF_RESKEY_pgdb_default=template1
 OCF_RESKEY_logfile_default=/dev/null
-OCF_RESKEY_stop_escalate_default=30
+OCF_RESKEY_stop_escalate_default=90
 OCF_RESKEY_monitor_user_default=""
 OCF_RESKEY_monitor_password_default=""
 OCF_RESKEY_monitor_sql_default="select now();"
@@ -71,7 +71,7 @@ OCF_RESKEY_restart_on_promote_default="false"
 OCF_RESKEY_tmpdir_default="/var/lib/pgsql/tmp"
 OCF_RESKEY_xlog_check_count_default="3"
 OCF_RESKEY_crm_attr_timeout_default="5"
-OCF_RESKEY_stop_escalate_in_slave_default=30
+OCF_RESKEY_stop_escalate_in_slave_default=90
 OCF_RESKEY_replication_slot_name_default=""
 
 : ${OCF_RESKEY_pgctl=${OCF_RESKEY_pgctl_default}}
@@ -273,7 +273,7 @@ If you use PostgreSQL 9.3 or higher and define unix_socket_directories in the po
 
 <parameter name="stop_escalate" unique="0" required="0">
 <longdesc lang="en">
-Number of shutdown retries (using -m fast) before resorting to -m immediate
+Number of seconds to wait for stop (using -m fast) before resorting to -m immediate
 </longdesc>
 <shortdesc lang="en">stop escalation</shortdesc>
 <content type="integer" default="${OCF_RESKEY_stop_escalate_default}" />
@@ -425,7 +425,7 @@ This is optional for replication.
 
 <parameter name="stop_escalate_in_slave" unique="0" required="0">
 <longdesc lang="en">
-Number of shutdown retries (using -m fast) before resorting to -m immediate
+Number of seconds to wait for stop (using -m fast) before resorting to -m immediate
 in slave state.
 This is optional for replication.
 </longdesc>
@@ -779,10 +779,16 @@ pgsql_real_stop() {
     if [ "$1" = "slave" ]; then
         stop_escalate="$OCF_RESKEY_stop_escalate_in_slave"
     fi
+    # adjust stop_escalate time when it is longer than the timeout
+    if [ -n "$OCF_RESKEY_CRM_meta_timeout" ] && \
+        [ "$stop_escalate" -ge $((OCF_RESKEY_CRM_meta_timeout/1000)) ]; then
+        stop_escalate=$(((OCF_RESKEY_CRM_meta_timeout/1000) - 10))
+        ocf_log info "stop_escalate(or stop_escalate_in_slave) time is adjusted to ${stop_escalate} based on the configured timeout."
+    fi
 
     # Stop PostgreSQL, do not wait for clients to disconnect
     if [ $stop_escalate -gt 0 ]; then
-            runasowner "$OCF_RESKEY_pgctl -D $OCF_RESKEY_pgdata stop -m fast"
+            runasowner "$OCF_RESKEY_pgctl -W -D $OCF_RESKEY_pgdata stop -m fast"
     fi
 
     # stop waiting
@@ -802,7 +808,7 @@ pgsql_real_stop() {
     then
         #PostgreSQL is still up. Use another shutdown mode.
         ocf_log info "PostgreSQL failed to stop after ${stop_escalate}s using -m fast. Trying -m immediate..."
-        runasowner "$OCF_RESKEY_pgctl -D $OCF_RESKEY_pgdata stop -m immediate"
+        runasowner "$OCF_RESKEY_pgctl -W -D $OCF_RESKEY_pgdata stop -m immediate"
     fi
 
     while :
@@ -1331,7 +1337,7 @@ create_replication_slot_name() {
             if [ "$target" != "$NODENAME" ]; then
                 # The Uppercase, "-" and "." don't allow to use in slot_name.
                 # If the NODENAME contains them, convert upper case to lower case and "_" and "." to "_".
-                target=`echo "$target" | tr '[A-Z.-]' '[a-z__]'`
+                target=`echo "$target" | tr 'A-Z.-' 'a-z__'`
                 replication_slot_name="$OCF_RESKEY_replication_slot_name"_"$target"
                 replication_slot_name_list_tmp="$replication_slot_name_list"
                 replication_slot_name_list="$replication_slot_name_list_tmp $replication_slot_name"
@@ -1523,7 +1529,7 @@ user_recovery_conf() {
         if [ $number_of_nodes -le 2 ]; then
             echo "primary_slot_name = '${OCF_RESKEY_replication_slot_name}'"
         else
-            nodename_tmp=`echo "$NODENAME" | tr '[A-Z.-]' '[a-z__]'`
+            nodename_tmp=`echo "$NODENAME" | tr 'A-Z.-' 'a-z__'`
             echo "primary_slot_name = '${OCF_RESKEY_replication_slot_name}_$nodename_tmp'"
         fi
     fi
@@ -1634,7 +1640,7 @@ change_master_score() {
             instance=`expr $instance + 1`
         done
     else
-        # If globally-unique=false and Pacemaker version is 1.1.8 or higher 
+        # If globally-unique=false and Pacemaker version is 1.1.8 or higher
         # Master/Slave resource has no instance number
         set_master_score $1 $2 ${RESOURCE_NAME} || return 1
     fi
@@ -1764,7 +1770,7 @@ pgsql_validate_all() {
 
     version=`cat $OCF_RESKEY_pgdata/PG_VERSION`
 
-    if ! check_binary2 "$OCF_RESKEY_pgctl" || 
+    if ! check_binary2 "$OCF_RESKEY_pgctl" ||
        ! check_binary2 "$OCF_RESKEY_psql"; then
         return $OCF_ERR_INSTALLED
     fi
@@ -1918,7 +1924,7 @@ check_socket_dir() {
         fi
 
         if ! chown $OCF_RESKEY_pgdba:`getent passwd \
-             $OCF_RESKEY_pgdba | cut -d ":" -f 4` "$OCF_RESKEY_socketdir" 
+             $OCF_RESKEY_pgdba | cut -d ":" -f 4` "$OCF_RESKEY_socketdir"
         then
             ocf_exit_reason "Can't change ownership for $OCF_RESKEY_socketdir"
             exit $OCF_ERR_PERM
@@ -2052,7 +2058,7 @@ if [ -n "$OCF_RESKEY_pglibs" ]; then
         export LD_LIBRARY_PATH=$OCF_RESKEY_pglibs
     fi
 fi
-   
+
 
 # What kind of method was invoked?
 case "$1" in
diff --git a/heartbeat/portblock b/heartbeat/portblock
index c480954..776ad17 100755
--- a/heartbeat/portblock
+++ b/heartbeat/portblock
@@ -161,9 +161,7 @@ The action (block/unblock) to be done on the protocol::portno.
 </parameter>
 
 <parameter name="reset_local_on_unblock_stop" unique="0" required="0">
-<content type="boolean" default="${OCF_RESKEY_reset_local_on_unblock_stop_default}" />
-<shortdesc lang="en">(try to) reset server TCP sessions when unblock stops</shortdesc>
-<longdesc>
+<longdesc lang="en">
 If for some reason the long lived server side TCP sessions won't be cleaned up
 by a reconfiguration/flush/stop of whatever services this portblock protects,
 they would linger in the connection table, even after the IP is gone
@@ -178,6 +176,8 @@ by injecting a temporary iptables rule to TCP-reset outgoing packets from the
 blocked ports, and additionally tickle them locally,
 just before it starts to DROP incoming packets on "unblock stop".
 </longdesc>
+<shortdesc lang="en">(try to) reset server TCP sessions when unblock stops</shortdesc>
+<content type="boolean" default="${OCF_RESKEY_reset_local_on_unblock_stop_default}" />
 </parameter>
 
 <parameter name="ip" unique="0" required="0">
@@ -242,7 +242,7 @@ active_grep_pat()
 chain_isactive()
 {
   PAT=`active_grep_pat "$1" "$2" "$3"`
-  $IPTABLES -n -L INPUT | grep "$PAT" >/dev/null
+  $IPTABLES $wait -n -L INPUT | grep "$PAT" >/dev/null
 }
 
 save_tcp_connections()
@@ -370,13 +370,13 @@ IptablesBLOCK()
     : OK -- chain already active
   else
     if $try_reset ; then
-      $IPTABLES -I OUTPUT -p "$1" -s "$3" -m multiport --sports "$2" -j REJECT --reject-with tcp-reset
+      $IPTABLES $wait -I OUTPUT -p "$1" -s "$3" -m multiport --sports "$2" -j REJECT --reject-with tcp-reset
       tickle_local
     fi
-    $IPTABLES -I INPUT -p "$1" -d "$3" -m multiport --dports "$2" -j DROP
+    $IPTABLES $wait -I INPUT -p "$1" -d "$3" -m multiport --dports "$2" -j DROP
     rc=$?
     if $try_reset ; then
-      $IPTABLES -D OUTPUT -p "$1" -s "$3" -m multiport --sports "$2" -j REJECT --reject-with tcp-reset
+      $IPTABLES $wait -D OUTPUT -p "$1" -s "$3" -m multiport --sports "$2" -j REJECT --reject-with tcp-reset
     fi
   fi
 
@@ -389,7 +389,7 @@ IptablesUNBLOCK()
   if
     chain_isactive "$1" "$2" "$3"
   then
-    $IPTABLES -D INPUT -p "$1" -d "$3" -m multiport --dports "$2" -j DROP
+    $IPTABLES $wait -D INPUT -p "$1" -d "$3" -m multiport --dports "$2" -j DROP
   else
     : Chain Not active
   fi
@@ -526,6 +526,15 @@ if [ -z "$OCF_RESKEY_action" ]; then
   exit $OCF_ERR_CONFIGURED
 fi 
 
+# iptables v1.4.20+ is required to use -w (wait)
+version=$(iptables -V | awk -F ' v' '{print $NF}')
+ocf_version_cmp "$version" "1.4.19.1"
+if [ "$?" -eq "2" ]; then
+    wait="-w"
+else
+    wait=""
+fi
+
 protocol=$OCF_RESKEY_protocol
 portno=$OCF_RESKEY_portno
 action=$OCF_RESKEY_action
diff --git a/heartbeat/postfix b/heartbeat/postfix
index 72fc371..703aa32 100755
--- a/heartbeat/postfix
+++ b/heartbeat/postfix
@@ -282,7 +282,7 @@ postfix_validate_all()
         # check directory permissions
         if ocf_is_true $status_support; then
             user=`postconf $OPTION_CONFIG_DIR -h mail_owner 2>/dev/null`
-            for dir in "$data_dir"; do
+            for dir in $data_dir; do
                 if ! su -s /bin/sh - $user -c "test -w $dir"; then
                     if ocf_is_probe; then
                         ocf_log info "Directory '$dir' is not writable by user '$user' during probe."
diff --git a/heartbeat/pound b/heartbeat/pound
index ab7dd31..837d591 100755
--- a/heartbeat/pound
+++ b/heartbeat/pound
@@ -46,7 +46,7 @@ meta_data() {
 	cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="pound" version="0.1">
+<resource-agent name="pound">
 <version>1.0</version>
 
 <longdesc lang="en">
diff --git a/heartbeat/rabbitmq-cluster b/heartbeat/rabbitmq-cluster
index cc45f09..ac394e0 100755
--- a/heartbeat/rabbitmq-cluster
+++ b/heartbeat/rabbitmq-cluster
@@ -39,13 +39,20 @@ RMQ_PID_FILE="/var/run/rabbitmq/rmq.pid"
 RMQ_LOG_DIR="/var/log/rabbitmq"
 NODENAME=$(ocf_local_nodename)
 
+# this attr represents the current active local rmq node name.
+# when rmq stops or the node is fenced, this attr disappears
 RMQ_CRM_ATTR_COOKIE="rmq-node-attr-${OCF_RESOURCE_INSTANCE}"
+# this attr represents the last known active local rmq node name
+# when rmp stops or the node is fenced, the attr stays forever so
+# we can continue to map an offline pcmk node to it's rmq node name
+# equivalent. 
+RMQ_CRM_ATTR_COOKIE_LAST_KNOWN="rmq-node-attr-last-known-${OCF_RESOURCE_INSTANCE}"
 
 meta_data() {
 	cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="rabbitmq-cluster" version="0.9">
+<resource-agent name="rabbitmq-cluster">
 <version>1.0</version>
 
 <longdesc lang="en">
@@ -79,7 +86,7 @@ END
 
 rmq_usage() {
 	cat <<END
-usage: $0 {start|stop|monitor|migrate_to|migrate_from|validate-all|meta-data}
+usage: $0 {start|stop|monitor|notify|validate-all|meta-data}
 
 Expects to have a fully populated OCF RA-compliant environment set.
 END
@@ -116,8 +123,13 @@ rmq_write_nodename()
 		exit $OCF_ERR_GENERIC
 	fi
 
-	# store the pcmknode to rmq node mapping as an attribute
+	# store the pcmknode to rmq node mapping as a transient attribute. This allows
+	# us to retrieve the join list with a simple xpath.
 	${HA_SBIN_DIR}/crm_attribute -N $NODENAME -l reboot --name "$RMQ_CRM_ATTR_COOKIE" -v "$node_name"
+
+	# the pcmknode to rmq node mapping as a permanent attribute as well. this lets
+	# us continue to map offline nodes to their equivalent rmq node name
+	${HA_SBIN_DIR}/crm_attribute -N $NODENAME -l forever --name "$RMQ_CRM_ATTR_COOKIE_LAST_KNOWN" -v "$node_name"
 }
 
 rmq_delete_nodename()
@@ -150,13 +162,13 @@ rmq_monitor() {
 		
 		return $OCF_SUCCESS
 	;;
-	2)
+	2|68|69|70|75|78)
 		ocf_log info "RabbitMQ server is not running"
 		rmq_delete_nodename
 		return $OCF_NOT_RUNNING
 	;;
 	*)
-		ocf_log err "Unexpected return code from '$RMQ_CTL cluster status' exit code: $rc"
+		ocf_log err "Unexpected return code from '$RMQ_CTL cluster_status' exit code: $rc"
 		rmq_delete_nodename
 		return $OCF_ERR_GENERIC
 	;;
@@ -191,7 +203,7 @@ rmq_init_and_wait()
 
 rmq_set_policy()
 {
-	$RMQ_CTL set_policy $@ > /dev/null 2>&1
+	$RMQ_CTL set_policy "$@" > /dev/null 2>&1
 }
 
 rmq_start_first()
@@ -226,6 +238,11 @@ rmq_start_first()
 	return $rc
 }
 
+rmq_is_clustered()
+{
+    $RMQ_CTL eval 'rabbit_mnesia:is_clustered().' | grep -q true
+}
+
 rmq_join_existing()
 {
 	local join_list="$1"
@@ -237,6 +254,11 @@ rmq_join_existing()
 		return $OCF_ERR_GENERIC
 	fi
 
+        if rmq_is_clustered; then
+            ocf_log info "Successfully re-joined existing rabbitmq cluster automatically"
+            return $OCF_SUCCESS
+        fi
+
 	# unconditionally join the cluster
 	$RMQ_CTL stop_app > /dev/null 2>&1
 	for node in $(echo "$join_list"); do
@@ -262,6 +284,56 @@ rmq_join_existing()
 	return $OCF_SUCCESS
 }
 
+rmq_forget_cluster_node_remotely() {
+	local running_cluster_nodes="$1"
+	local node_to_forget="$2"
+
+	ocf_log info "Forgetting $node_to_forget via nodes [ $(echo $running_cluster_nodes | tr '\n' ' ') ]."
+	for running_cluster_node in $running_cluster_nodes; do
+		rabbitmqctl -n $running_cluster_node forget_cluster_node $node_to_forget
+		if [ $? = 0 ]; then
+			ocf_log info "Succeeded forgetting $node_to_forget via $running_cluster_node."
+			return
+		else
+			ocf_log err "Failed to forget node $node_to_forget via $running_cluster_node."
+		fi
+	done
+}
+
+rmq_notify() {
+	node_list="${OCF_RESKEY_CRM_meta_notify_stop_uname}"
+	mode="${OCF_RESKEY_CRM_meta_notify_type}-${OCF_RESKEY_CRM_meta_notify_operation}"
+
+
+	# When notifications are on, this agent is going to "forget" nodes once they
+	# leave the cluster. This is thought to resolve some issues where rabbitmq
+	# blocks trying to sync with an offline node after a fencing action occurs.
+	if ! [ "${mode}" = "post-stop" ]; then
+		return $OCF_SUCCESS
+	fi
+
+	rmq_monitor
+	if [ $? -ne $OCF_SUCCESS ]; then
+		# only run forget when we are for sure active 
+		return $OCF_SUCCESS
+	fi
+
+	# forget each stopped rmq instance in the provided pcmk node in the list.
+	for node in $(echo "$node_list"); do
+		local rmq_node="$(${HA_SBIN_DIR}/crm_attribute -N $node -l forever --query --name $RMQ_CRM_ATTR_COOKIE_LAST_KNOWN -q)"
+		if [ -z "$rmq_node" ]; then
+			ocf_log warn "Unable to map pcmk node $node to a known rmq node."
+			continue	
+		fi
+		ocf_log notice "Forgetting stopped node $rmq_node"
+		$RMQ_CTL forget_cluster_node $rmq_node
+		if [ $? -ne 0 ]; then
+			ocf_log warn "Unable to forget offline node $rmq_node."
+		fi
+	done
+	return $OCF_SUCCESS
+}
+
 rmq_start() {
 	local join_list=""
 	local rc
@@ -285,11 +357,68 @@ rmq_start() {
 	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"
-		if [ $? -ne 0 ]; then
+		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
@@ -299,6 +428,30 @@ rmq_start() {
 }
 
 rmq_stop() {
+	# Backup users and users' permissions
+	BaseDataDir=`dirname $RMQ_DATA_DIR`
+	rabbitmqctl eval "
+		%% Run only if Mnesia is still available.
+		lists:any(fun({mnesia,_,_}) -> true; ({_,_,_}) -> false end, application:which_applications()) andalso
+		begin
+			[WildPattern] = ets:select(mnesia_gvar, [ { {{rabbit_user, wild_pattern}, '\\\$1'}, [], ['\\\$1'] } ]),
+
+			Users = case WildPattern of
+				%% Version < 3.6.0
+				{internal_user,'_','_','_'} ->
+					mnesia:dirty_select(rabbit_user, [{ {internal_user, '\\\$1', '_', '_'}, [{'/=', '\\\$1', <<\"guest\">>}], ['\\\$_'] } ]);
+				%% Version >= 3.6.0
+				{internal_user,'_','_','_','_'} ->
+					mnesia:dirty_select(rabbit_user, [{ {internal_user, '\\\$1', '_', '_', '_'}, [{'/=', '\\\$1', <<\"guest\">>}], ['\\\$_'] } ])
+			end,
+
+			Users /= [] andalso file:write_file(\"$BaseDataDir/users.erl\", io_lib:fwrite(\"~p.~n\", [Users])),
+
+			UsersPerms = mnesia:dirty_select(rabbit_user_permission, [{{'\\\$1', {'\\\$2', '\\\$3','\\\$4'}, '\\\$5'}, [{'/=', '\\\$3', <<\"guest\">>}], ['\\\$_']}]),
+			UsersPerms /= [] andalso file:write_file(\"$BaseDataDir/users_perms.erl\", io_lib:fwrite(\"~p.~n\", [UsersPerms]))
+		end.
+	"
+
 	rmq_monitor
 	if [ $? -eq $OCF_NOT_RUNNING ]; then
 		return $OCF_SUCCESS
@@ -357,6 +510,7 @@ start)		rmq_start;;
 stop)		rmq_stop;;
 monitor)	rmq_monitor;;
 validate-all)	rmq_validate;;
+notify)		rmq_notify;;
 usage|help)	rmq_usage
 		exit $OCF_SUCCESS
 		;;
diff --git a/heartbeat/redis b/heartbeat/redis
index f85b2f7..1ea0025 100755
--- a/heartbeat/redis
+++ b/heartbeat/redis
@@ -229,7 +229,7 @@ function set_score()
 }
 
 function redis_client() {
-	ocf_log debug "redis_client: '$REDIS_CLIENT' -s '$REDIS_SOCKET' $@"
+	ocf_log debug "redis_client: '$REDIS_CLIENT' -s '$REDIS_SOCKET' $*"
 	if [ -n "$clientpasswd" ]; then
 		"$REDIS_CLIENT" -s "$REDIS_SOCKET" -a "$clientpasswd" "$@" | sed 's/\r//'
 	else 
@@ -324,6 +324,10 @@ function start() {
 
 	[[ ! -d "$REDIS_RUNDIR" ]] && mkdir -p "$REDIS_RUNDIR"
 	chown -R "$REDIS_USER" "$REDIS_RUNDIR"
+	if have_binary "restorecon"; then
+		restorecon -Rv "$REDIS_RUNDIR"
+	fi
+
 
 	# check for 0 byte database dump file. This is an unrecoverable start
 	# condition that we can avoid by deleting the 0 byte database file.
diff --git a/heartbeat/rsyslog b/heartbeat/rsyslog
index c538afb..a8ebc63 100755
--- a/heartbeat/rsyslog
+++ b/heartbeat/rsyslog
@@ -79,7 +79,7 @@ This script manages a rsyslog instance as an HA resource.
 This parameter specifies a configuration file 
 for a rsyslog instance managed by this RA.
 </longdesc>
-<shortdesc>Configuration file</shortdesc>
+<shortdesc lang="en">Configuration file</shortdesc>
 <content type="string" default=""/>
 </parameter>
 
@@ -87,7 +87,7 @@ for a rsyslog instance managed by this RA.
 <longdesc lang="en">
 This parameter specifies rsyslog's executable file.
 </longdesc>
-<shortdesc>rsyslog executable</shortdesc>
+<shortdesc lang="en">rsyslog executable</shortdesc>
 <content type="string" default="/sbin/rsyslogd"/>
 </parameter>
 
@@ -97,7 +97,7 @@ This parameter specifies startup options for a
 rsyslog instance managed by this RA. When no value is given, no startup 
 options is used. Don't use option '-F'. It causes a stuck of a start action.
 </longdesc>
-<shortdesc>Start options</shortdesc>
+<shortdesc lang="en">Start options</shortdesc>
 <content type="string" default=""/>
 </parameter>
 
diff --git a/heartbeat/sapdb.sh b/heartbeat/sapdb.sh
index 7edb4b8..836250a 100755
--- a/heartbeat/sapdb.sh
+++ b/heartbeat/sapdb.sh
@@ -15,7 +15,7 @@
 
 
 #
-# background_check_saphostexec : Run a request to saphostexec in a separat task, to be able to react on a hanging process
+# background_check_saphostexec : Run a request to saphostexec in a separate task, to be able to react to a hanging process
 #
 background_check_saphostexec() {
   timeout=600
@@ -35,7 +35,7 @@ background_check_saphostexec() {
     fi
   done
 
-  # child already has finished, now evaluate it's returncode 
+  # child has already finished, now evaluate its returncode
   wait $pid
 }
 
@@ -46,20 +46,20 @@ background_check_saphostexec() {
 cleanup_saphostexec() {
   pkill -9 -f "$SAPHOSTEXEC"
   pkill -9 -f "$SAPHOSTSRV"
-  oscolpid=`pgrep -f "$SAPHOSTOSCOL"`       # we check saposcol pid, because it
+  oscolpid=$(pgrep -f "$SAPHOSTOSCOL")      # we check saposcol pid, because it
                                             # might not run under control of
-					    # saphostexec
+                                            # saphostexec
 
   # cleanup saposcol shared memory, otherwise it will not start again
   if [ -n "$oscolpid" ];then
     kill -9 $oscolpid
-    oscolipc=`ipcs -m | grep "4dbe " | awk '{print $2}'`
+    oscolipc=$(ipcs -m | grep "4dbe " | awk '{print $2}')
     if [ -n "$oscolipc" ]; then
       ipcrm -m $oscolipc
     fi
   fi
 
-  # removing the unix domain socket file as it might have wrong permissions or 
+  # removing the unix domain socket file as it might have wrong permissions or
   # ownership - it will be recreated by saphostexec during next start
   [ -r /tmp/.sapstream1128 ] && rm -f /tmp/.sapstream1128
 }
@@ -70,7 +70,7 @@ cleanup_saphostexec() {
 #
 check_saphostexec() {
   chkrc=$OCF_SUCCESS
-  running=`pgrep -f "$SAPHOSTEXEC" | wc -l`
+  running=$(pgrep -f "$SAPHOSTEXEC" | wc -l)
 
   if [ $running -gt 0 ]; then
     if background_check_saphostexec; then
@@ -85,10 +85,10 @@ check_saphostexec() {
     ocf_log warn "saphostexec is not running on node `hostname`, it will be started now"
     cleanup_saphostexec
     output=`$SAPHOSTEXEC -restart 2>&1`
-    
+
     # now make sure the daemon has been started and is able to respond
     srvrc=1
-    while [ $srvrc -ne 0 -a `pgrep -f "$SAPHOSTEXEC" | wc -l` -gt 0 ]
+    while [ $srvrc -ne 0 ] && [ "$(pgrep -f "$SAPHOSTEXEC" | wc -l)" -gt 0 ]
     do
       sleep 1
       background_check_saphostexec
@@ -97,14 +97,14 @@ check_saphostexec() {
 
     if [ $srvrc -eq 0 ]
     then
-      ocf_log info "saphostexec on node `hostname` was restarted !"
+      ocf_log info "saphostexec on node $(hostname) was restarted !"
       chkrc=$OCF_SUCCESS
     else
-      ocf_log error "saphostexec on node `hostname` could not be started! - $output"
+      ocf_log error "saphostexec on node $(hostname) could not be started! - $output"
       chkrc=$OCF_ERR_GENERIC
     fi
   fi
-  
+
   return $chkrc
 }
 
@@ -116,7 +116,7 @@ sapdatabase_start() {
 
   check_saphostexec
   rc=$?
-  
+
   if [ $rc -eq $OCF_SUCCESS ]
   then
     sapuserexit PRE_START_USEREXIT "$OCF_RESKEY_PRE_START_USEREXIT"
@@ -131,7 +131,12 @@ sapdatabase_start() {
     then
       FORCE="-force"
     fi
-    output=`$SAPHOSTCTRL -function StartDatabase -dbname $SID -dbtype $DBTYPE $DBINST $FORCE -service`
+    DBOSUSER=""
+    if [ -n "$OCF_RESKEY_DBOSUSER" ]
+    then
+      DBOSUSER="-dbuser $OCF_RESKEY_DBOSUSER "
+    fi
+    output=`$SAPHOSTCTRL -function StartDatabase -dbname $SID -dbtype $DBTYPE $DBINST $DBOSUSER $FORCE -service`
 
     sapdatabase_monitor 1
     rc=$?
@@ -140,14 +145,14 @@ sapdatabase_start() {
     then
       ocf_log info "SAP database $SID started: $output"
       rc=$OCF_SUCCESS
-    
+
       sapuserexit POST_START_USEREXIT "$OCF_RESKEY_POST_START_USEREXIT"
     else
       ocf_log err "SAP database $SID start failed: $output"
       rc=$OCF_ERR_GENERIC
     fi
   fi
-  
+
   return $rc
 }
 
@@ -158,7 +163,7 @@ sapdatabase_stop() {
 
   check_saphostexec
   rc=$?
-  
+
   if [ $rc -eq $OCF_SUCCESS ]
   then
     sapuserexit PRE_STOP_USEREXIT "$OCF_RESKEY_PRE_STOP_USEREXIT"
@@ -168,7 +173,12 @@ sapdatabase_stop() {
     then
       DBINST="-dbinstance $OCF_RESKEY_DBINSTANCE "
     fi
-    output=`$SAPHOSTCTRL -function StopDatabase -dbname $SID -dbtype $DBTYPE $DBINST -force -service`
+    DBOSUSER=""
+    if [ -n "$OCF_RESKEY_DBOSUSER" ]
+    then
+      DBOSUSER="-dbuser $OCF_RESKEY_DBOSUSER "
+    fi
+    output=`$SAPHOSTCTRL -function StopDatabase -dbname $SID -dbtype $DBTYPE $DBINST $DBOSUSER -force -service`
 
     if [ $? -eq 0 ]
     then
@@ -181,7 +191,7 @@ sapdatabase_stop() {
   fi
 
   sapuserexit POST_STOP_USEREXIT "$OCF_RESKEY_POST_STOP_USEREXIT"
-  
+
   return $rc
 }
 
@@ -200,28 +210,32 @@ sapdatabase_monitor() {
   else
     check_saphostexec
     rc=$?
-  
+
     if [ $rc -eq $OCF_SUCCESS ]
     then
       count=0
-      
+
       DBINST=""
       if [ -n "$OCF_RESKEY_DBINSTANCE" ]
       then
         DBINST="-dbinstance $OCF_RESKEY_DBINSTANCE "
       fi
-      output=`$SAPHOSTCTRL -function GetDatabaseStatus -dbname $SID -dbtype $DBTYPE $DBINST`
+      if [ -n "$OCF_RESKEY_DBOSUSER" ]
+      then
+        DBOSUSER="-dbuser $OCF_RESKEY_DBOSUSER "
+      fi
+      output=`$SAPHOSTCTRL -function GetDatabaseStatus -dbname $SID -dbtype $DBTYPE $DBINST $DBOSUSER`
 
       # we have to parse the output, because the returncode doesn't tell anything about the instance status
       for SERVICE in `echo "$output" | grep -i 'Component[ ]*Name *[:=] [A-Za-z][A-Za-z0-9_]* (' | sed 's/^.*Component[ ]*Name *[:=] *\([A-Za-z][A-Za-z0-9_]*\).*$/\1/i'`
-      do 
-        COLOR=`echo "$output" | grep -i "Component[ ]*Name *[:=] *$SERVICE (" | sed 's/^.*Status *[:=] *\([A-Za-z][A-Za-z0-9_]*\).*$/\1/i'`
+      do
+        COLOR=`echo "$output" | grep -i "Component[ ]*Name *[:=] *$SERVICE (" | sed 's/^.*Status *[:=] *\([A-Za-z][A-Za-z0-9_]*\).*$/\1/i' | uniq`
         STATE=0
 
         case $COLOR in
           Running)       STATE=$OCF_SUCCESS;;
           *)             STATE=$OCF_NOT_RUNNING;;
-        esac 
+        esac
 
         SEARCH=`echo "$OCF_RESKEY_MONITOR_SERVICES" | sed 's/\+/\\\+/g' | sed 's/\./\\\./g'`
         if [ `echo "$SERVICE" | egrep -c "$SEARCH"` -eq 1 ]
@@ -240,7 +254,7 @@ sapdatabase_monitor() {
         ocf_log err "The resource does not run any services which this RA could monitor!"
         rc=$OCF_ERR_ARGS
       fi
-      
+
       if [ $rc -ne $OCF_SUCCESS ]
       then
         ocf_log err "The SAP database $SID is not running: $output"
@@ -255,30 +269,43 @@ sapdatabase_monitor() {
 # sapdatabase_status: Are there any database processes on this host ?
 #
 sapdatabase_status() {
+  sid=`echo $SID | tr '[:upper:]' '[:lower:]'`
+
+  SUSER=${OCF_RESKEY_DBOSUSER:-""}
+
   case $DBTYPE in
     ADA) SEARCH="$SID/db/pgm/kernel"
-         SUSER=`grep "^SdbOwner" /etc/opt/sdb | awk -F'=' '{print $2}'`
+         [ -z "$SUSER" ] && SUSER=`grep "^SdbOwner" /etc/opt/sdb | awk -F'=' '{print $2}'`
          SNUM=2
          ;;
-    ORA) SEARCH="ora_[a-z][a-z][a-z][a-z]_"
-         SUSER="ora`echo $SID | tr '[:upper:]' '[:lower:]'`"
-         SNUM=4
+    ORA) DBINST=${OCF_RESKEY_DBINSTANCE}
+          DBINST=${OCF_RESKEY_DBINSTANCE:-${SID}}
+          SEARCH="ora_[a-z][a-z][a-z][a-z]_$DBINST"
+
+          if [ -z "$SUSER" ]; then
+            id "oracle" > /dev/null 2> /dev/null && SUSER="oracle"
+            id "ora${sid}" > /dev/null 2> /dev/null && SUSER="${SUSER:+${SUSER},}ora${sid}"
+          fi
+
+          SNUM=4
          ;;
     DB6) SEARCH="db2[a-z][a-z][a-z]"
-         SUSER="db2`echo $SID | tr '[:upper:]' '[:lower:]'`"
+         [ -z "$SUSER" ] && SUSER="db2${sid}"
          SNUM=2
          ;;
     SYB) SEARCH="dataserver"
-         SUSER="syb`echo $SID | tr '[:upper:]' '[:lower:]'`"
+         [ -z "$SUSER" ] && SUSER="syb${sid}"
          SNUM=1
 		 ;;
     HDB) SEARCH="hdb[a-z]*server"
-         SUSER="`echo $SID | tr '[:upper:]' '[:lower:]'`adm"
+         [ -z "$SUSER" ] && SUSER="${sid}adm"
          SNUM=1
 		 ;;
   esac
 
-  cnt=`ps -u $SUSER -o args 2> /dev/null | grep -c $SEARCH`
+  [ -z "$SUSER" ] && return $OCF_ERR_INSTALLED
+
+  cnt=`ps -u $SUSER -o args 2> /dev/null | grep -v grep | grep -c $SEARCH`
   [ $cnt -ge $SNUM ] && return $OCF_SUCCESS
   return $OCF_NOT_RUNNING
 }
@@ -295,7 +322,7 @@ sapdatabase_recover() {
 
 
 #
-# sapdatabase_validate: Check the symantic of the input parameters 
+# sapdatabase_validate: Check the semantics of the input parameters
 #
 sapdatabase_validate() {
   rc=$OCF_SUCCESS
diff --git a/heartbeat/sg_persist b/heartbeat/sg_persist
index 1ce0a64..69866e6 100755
--- a/heartbeat/sg_persist
+++ b/heartbeat/sg_persist
@@ -83,7 +83,7 @@ Master reservs all devices from "devs" list with reservation "--prout-type" valu
 <longdesc lang="en">
 The name of the binary that manages the resource.
 </longdesc>
-<shortdesc>the binary name of the resource</shortdesc>
+<shortdesc lang="en">the binary name of the resource</shortdesc>
 <content type="string" default="$sg_persist_binary"/>
 </parameter>
 
@@ -184,14 +184,14 @@ sg_persist_init() {
     NOW=$(date +%s)
 
     RESOURCE="${OCF_RESOURCE_INSTANCE}"
-    MASTER_SCORE_VAR_NAME="master-${OCF_RESOURCE_INSTANCE}"
+    MASTER_SCORE_VAR_NAME="master-${OCF_RESOURCE_INSTANCE//:/-}"
     PENDING_VAR_NAME="pending-$MASTER_SCORE_VAR_NAME"
     
     #only works with corocync 
     CRM_NODE="${HA_SBIN_DIR}/crm_node"
     NODE_ID_DEC=$($CRM_NODE -i)
 
-    NODE=$($CRM_NODE -l | $GREP $NODE_ID_DEC)
+    NODE=$($CRM_NODE -l | $GREP -w ^$NODE_ID_DEC)
     NODE=${NODE#$NODE_ID_DEC }
     NODE=${NODE% *}
     
@@ -249,26 +249,27 @@ sg_persist_get_status() {
     for dev in ${EXISTING_DEVS[*]}
     do
         READ_KEYS=`$SG_PERSIST --in --read-keys $dev 2>&1`
+        [ $? -eq 0 ] || continue
+
+        WORKING_DEVS+=($dev)
+
+        echo "$READ_KEYS" | $GREP -qw $NODE_ID_HEX\$
+        [ $? -eq 0 ] || continue
+
+        REGISTERED_DEVS+=($dev)
+
+        READ_RESERVATION=`$SG_PERSIST --in --read-reservation $dev 2>&1`
+        [ $? -eq 0 ] || continue
+
+        echo "$READ_RESERVATION" | $GREP -qw $NODE_ID_HEX\$
         if [ $? -eq 0 ]; then
-            WORKING_DEVS+=($dev)
-            echo $READ_KEYS | $GREP $NODE_ID_HEX >/dev/null
-            if [ $? -eq 0 ]; then 
-                REGISTERED_DEVS+=($dev)
-
-                READ_RESERVATION=`$SG_PERSIST --in --read-reservation $dev 2>&1`
-                if [ $? -eq 0 ]; then
-                    echo $READ_RESERVATION | $GREP $NODE_ID_HEX >/dev/null
-                    if [ $? -eq 0 ]; then 
-                        RESERVED_DEVS+=($dev)
-                    fi
+            RESERVED_DEVS+=($dev)
+        fi
 
-                    reservation_key=`echo $READ_RESERVATION | $GREP -o 'Key=0x[0-9a-f]*' | $GREP -o '0x[0-9a-f]*'`
-                    if [ -n "$reservation_key" ]; then 
-                        DEVS_WITH_RESERVATION+=($dev)
-                        RESERVATION_KEYS+=($reservation_key)
-                    fi
-                fi
-            fi
+        reservation_key=`echo $READ_RESERVATION | $GREP -o 'Key=0x[0-9a-f]*' | $GREP -o '0x[0-9a-f]*'`
+        if [ -n "$reservation_key" ]; then
+            DEVS_WITH_RESERVATION+=($dev)
+            RESERVATION_KEYS+=($reservation_key)
         fi
     done
 
@@ -383,7 +384,7 @@ sg_persist_action_start() {
         if sg_persist_is_registered $dev ; then
             : OK
         else
-            ocf_run $SG_PERSIST --out --register --param-rk=0 --param-sark=$NODE_ID_HEX $dev
+            ocf_run $SG_PERSIST --out --no-inquiry --register --param-rk=0 --param-sark=$NODE_ID_HEX $dev
             if [ $? -ne $OCF_SUCCESS ]
             then
                 return $OCF_ERR_GENERIC
@@ -405,7 +406,7 @@ sg_persist_action_stop() {
 
         for dev in ${REGISTERED_DEVS[*]}
         do
-            ocf_run $SG_PERSIST --out --register --param-rk=$NODE_ID_HEX --param-sark=0 $dev
+            ocf_run $SG_PERSIST --out --no-inquiry --register --param-rk=$NODE_ID_HEX --param-sark=0 $dev
         done
     fi
 
@@ -531,12 +532,12 @@ sg_persist_action_promote() {
         case $RESERVATION_TYPE in
         1|3|5|6)        
             if [ -z "$reservation_key" ]; then
-                ocf_run $SG_PERSIST --out --reserve --param-rk=$NODE_ID_HEX --prout-type=$RESERVATION_TYPE $dev
+                ocf_run $SG_PERSIST --out --no-inquiry --reserve --param-rk=$NODE_ID_HEX --prout-type=$RESERVATION_TYPE $dev
                 if [ $? -ne $OCF_SUCCESS ]; then
                     return $OCF_ERR_GENERIC
                 fi
             else
-                ocf_run $SG_PERSIST --out --preempt --param-sark=$reservation_key --param-rk=$NODE_ID_HEX --prout-type=$RESERVATION_TYPE $dev
+                ocf_run $SG_PERSIST --out --no-inquiry --preempt --param-sark=$reservation_key --param-rk=$NODE_ID_HEX --prout-type=$RESERVATION_TYPE $dev
                 if [ $? -ne $OCF_SUCCESS ]; then
                     return $OCF_ERR_GENERIC
                 fi
@@ -545,7 +546,7 @@ sg_persist_action_promote() {
 
         7|8) 
             if [ -z "$reservation_key" ]; then
-                ocf_run $SG_PERSIST --out --reserve --param-rk=$NODE_ID_HEX --prout-type=$RESERVATION_TYPE $dev
+                ocf_run $SG_PERSIST --out --no-inquiry --reserve --param-rk=$NODE_ID_HEX --prout-type=$RESERVATION_TYPE $dev
                 if [ $? -ne $OCF_SUCCESS ]
                 then
                     return $OCF_ERR_GENERIC
@@ -576,7 +577,7 @@ sg_persist_action_demote() {
 
         for dev in ${RESERVED_DEVS[*]}
         do
-            ocf_run $SG_PERSIST --out --release --param-rk=$NODE_ID_HEX --prout-type=$RESERVATION_TYPE $dev
+            ocf_run $SG_PERSIST --out --no-inquiry --release --param-rk=$NODE_ID_HEX --prout-type=$RESERVATION_TYPE $dev
             if [ $? -ne  $OCF_SUCCESS ]; then
                return $OCF_ERR_GENERIC
             fi
@@ -591,7 +592,7 @@ sg_persist_action_demote() {
 
         for dev in ${REGISTERED_DEVS[*]}
         do
-            ocf_run $SG_PERSIST --out --register --param-rk=$NODE_ID_HEX --param-sark=0 $dev
+            ocf_run $SG_PERSIST --out --no-inquiry --register --param-rk=$NODE_ID_HEX --param-sark=0 $dev
             if [ $? -ne $OCF_SUCCESS ]; then
                return $OCF_ERR_GENERIC
             fi
diff --git a/heartbeat/shellfuncs.in b/heartbeat/shellfuncs.in
index 7786ec3..9991620 100644
--- a/heartbeat/shellfuncs.in
+++ b/heartbeat/shellfuncs.in
@@ -78,7 +78,7 @@ BSD_Status() {
   fi
 
   if 
-    [ -f $HA_VARLOCK/var/lock/subsys/${base}.pid ] 
+    [ -f $HA_VARLOCK/${base}.pid ] 
   then
     echo "${base} dead but lock file exists"
     return 2
diff --git a/heartbeat/slapd b/heartbeat/slapd
index 0baafd6..961924e 100755
--- a/heartbeat/slapd
+++ b/heartbeat/slapd
@@ -105,7 +105,7 @@ For example, "/usr/bin/ldapsearch".
 Full path to a slapd configuration directory or a slapd configuration file.
 For example, "/etc/ldap/slapd.d" or "/etc/ldap/slapd.conf".
 </longdesc>
-<shortdesc>Full path to configuration directory or file</shortdesc>
+<shortdesc lang="en">Full path to configuration directory or file</shortdesc>
 <content type="string" default=""/>
 </parameter>
 
@@ -139,7 +139,7 @@ Group name or id slapd will run with.
 LDAP (and other scheme) URLs slapd will serve.
 For example, "ldap://127.0.0.1:389 ldaps:/// ldapi:///"
 </longdesc>
-<shortdesc>LDAP (and other scheme) URLs to serve</shortdesc>
+<shortdesc lang="en">LDAP (and other scheme) URLs to serve</shortdesc>
 <content type="string" default="ldap:///"/>
 </parameter>
 
@@ -150,7 +150,7 @@ suffixes can be specified by providing a space seperated list. By providing one
 or more suffixes here, the ignore_suffix parameter is discarded. All suffixes
 will be monitored if left blank.
 </longdesc>
-<shortdesc>Suffix that will be monitored for availability.</shortdesc>
+<shortdesc lang="en">Suffix that will be monitored for availability.</shortdesc>
 <content type="string" default=""/>
 </parameter>
 
@@ -160,7 +160,7 @@ Suffix (database backend) that will not be monitored for availability. Multiple
 suffixes can be specified by providing a space seperated list. No suffix will
 be excluded if left blank.
 </longdesc>
-<shortdesc>Suffix that will not be monitored for availability.</shortdesc>
+<shortdesc lang="en">Suffix that will not be monitored for availability.</shortdesc>
 <content type="string" default=""/>
 </parameter>
 
@@ -169,7 +169,7 @@ be excluded if left blank.
 Distinguished Name used to bind to the LDAP directory for testing. Leave blank
 to bind to the LDAP directory anonymously.
 </longdesc>
-<shortdesc>Distinguished Name used to bind to the LDAP directory for testing.</shortdesc>
+<shortdesc lang="en">Distinguished Name used to bind to the LDAP directory for testing.</shortdesc>
 <content type="string" default=""/>
 </parameter>
 
@@ -177,7 +177,7 @@ to bind to the LDAP directory anonymously.
 <longdesc lang="en">
 Password used to bind to the LDAP directory for testing.
 </longdesc>
-<shortdesc>Password used to bind to the LDAP directory for testing.</shortdesc>
+<shortdesc lang="en">Password used to bind to the LDAP directory for testing.</shortdesc>
 <content type="string" default=""/>
 </parameter>
 
@@ -219,32 +219,6 @@ Maximum number of open files (for ulimit -n)
 END
 }
 
-terminate()
-{
-  local pid=$1
-  local signal=$2
-  local recheck=${3-0}
-  local rc
-  local waited=0
-
-  kill -$signal $pid >/dev/null 2>&1; rc=$?
-
-  while [ \( $rc -eq 0 \) -a \( $recheck -eq 0 -o $waited -lt $recheck \) ]; do
-    kill -0 $pid >/dev/null 2>&1; rc=$?
-    let "waited += 1"
-
-    if [ $rc -eq 0 ]; then
-      sleep 1
-    fi
-  done
-
-  if [ $rc -ne 0 ]; then
-    return 0
-  fi
-
-  return 1
-}
-
 watch_suffix()
 {
   local rc
@@ -289,18 +263,12 @@ slapd_pid()
 slapd_status()
 {
   local pid=$1
-  local state=$?
-
-  if [ $state -eq $OCF_SUCCESS ]; then
 
-    if ! kill -0 $pid >/dev/null 2>&1; then
-      return $OCF_NOT_RUNNING
-    else
-      return $OCF_SUCCESS
-    fi
+  if ! kill -0 $pid >/dev/null 2>&1; then
+    return $OCF_NOT_RUNNING
+  else
+    return $OCF_SUCCESS
   fi
-
-  return $state
 }
 
 slapd_start()
@@ -382,10 +350,10 @@ slapd_stop()
     return $state
   fi
 
-  terminate $pid TERM $OCF_RESKEY_stop_escalate; rc=$?
-  if [ $rc -ne 0  ]; then
-    ocf_exit_reason "slapd failed to stop. Escalating to KILL."
-    terminate $pid KILL; rc=$?
+  ocf_stop_processes TERM $OCF_RESKEY_stop_escalate $pid; rc=$?
+  if [ $rc -eq 1 ]; then
+    ocf_log err "cannot stop slapd."
+    return $OCF_ERR_GENERIC
   fi
 
   if [ -f "$pid_file" ]; then
diff --git a/heartbeat/symlink b/heartbeat/symlink
index 1e36a9c..dbf633e 100755
--- a/heartbeat/symlink
+++ b/heartbeat/symlink
@@ -123,7 +123,7 @@ symlink_monitor() {
             ocf_log debug "$OCF_RESKEY_link exists but is not a symbolic link, will be moved to ${OCF_RESKEY_link}${OCF_RESKEY_backup_suffix} on start"
             rc=$OCF_NOT_RUNNING
         fi
-    elif readlink -f "$OCF_RESKEY_link" | egrep -q "^${OCF_RESKEY_target}$"; then
+    elif readlink -m "$OCF_RESKEY_link" | egrep -q "^${OCF_RESKEY_target}$"; then
         ocf_log debug "$OCF_RESKEY_link exists and is a symbolic link to ${OCF_RESKEY_target}."
         rc=$OCF_SUCCESS
     else
diff --git a/heartbeat/syslog-ng b/heartbeat/syslog-ng
index 66ad9a5..ef42bf3 100755
--- a/heartbeat/syslog-ng
+++ b/heartbeat/syslog-ng
@@ -81,7 +81,7 @@ This script manages a syslog-ng instance as an HA resource.
 This parameter specifies a configuration file 
 for a syslog-ng instance managed by this RA.
 </longdesc>
-<shortdesc>Configuration file</shortdesc>
+<shortdesc lang="en">Configuration file</shortdesc>
 <content type="string" default=""/>
 </parameter>
 
@@ -89,7 +89,7 @@ for a syslog-ng instance managed by this RA.
 <longdesc lang="en">
 This parameter specifies syslog-ng's executable file.
 </longdesc>
-<shortdesc>syslog-ng executable</shortdesc>
+<shortdesc lang="en">syslog-ng executable</shortdesc>
 <content type="string" default="/sbin/syslog-ng"/>
 </parameter>
 
@@ -99,7 +99,7 @@ This parameter specifies startup options for a
 syslog-ng instance managed by this RA. When no value is given, no startup 
 options is used. Don't use option '-F'. It causes a stuck of a start action.
 </longdesc>
-<shortdesc>Start options</shortdesc>
+<shortdesc lang="en">Start options</shortdesc>
 <content type="string" default=""/>
 </parameter>
 
@@ -110,7 +110,7 @@ And then the confirmation of its completion is waited for
 the specified seconds by this parameter.
 The default value is 10.
 </longdesc>
-<shortdesc>Number of seconds to await to confirm a normal stop method</shortdesc>
+<shortdesc lang="en">Number of seconds to await to confirm a normal stop method</shortdesc>
 <content type="integer" default="10"/>
 </parameter>
 
diff --git a/heartbeat/tomcat b/heartbeat/tomcat
index 07a7ce4..857da78 100755
--- a/heartbeat/tomcat
+++ b/heartbeat/tomcat
@@ -56,11 +56,9 @@ else
   SU=su
 fi
 
-############################################################################
-# Usage
 usage() 
 {
-	cat <<-!
+	cat <<-EOF
 usage: $0 action
 
 action:
@@ -76,20 +74,20 @@ action:
         meta-data       show meta data message
 
         validate-all    validate the instance parameters
-!
+EOF
 }
 
-############################################################################
-# Check tomcat service availability
 isrunning_tomcat()
 {
 	$WGET --tries=20 -O /dev/null $RESOURCE_STATUSURL >/dev/null 2>&1
 }
 
-############################################################################
-# 
 isalive_tomcat()
 {
+	if ocf_is_true $SYSTEMD; then
+		systemctl is-active tomcat@${TOMCAT_NAME} > /dev/null 2>&1
+		return $?
+	fi
 	# As the server stops, the PID file disappears. To avoid race conditions, 
 	# we will have remembered the PID of a running instance on script entry.
 	local pid=$rememberedPID
@@ -112,7 +110,6 @@ isalive_tomcat()
 	false
 }
 
-############################################################################
 # Check rotatelogs process and restart if it is stopped
 monitor_rotatelogs()
 {
@@ -128,8 +125,6 @@ monitor_rotatelogs()
 	fi
 }
 
-############################################################################
-# Check tomcat process and service availability
 monitor_tomcat()
 {
 	isalive_tomcat ||
@@ -145,8 +140,6 @@ monitor_tomcat()
 	return $OCF_SUCCESS
 }
 
-############################################################################
-# Startup rotatelogs process
 start_rotatelogs()
 {
 	# -s is required because tomcat5.5's login shell is /bin/false
@@ -155,7 +148,6 @@ start_rotatelogs()
         	< "$CATALINA_OUT" > /dev/null 2>&1 &
 }
 
-############################################################################
 # Execute catalina.out log rotation
 rotate_catalina_out()
 {
@@ -183,10 +175,29 @@ rotate_catalina_out()
 	start_rotatelogs
 }
 
-############################################################################
-# Tomcat Command
+create_systemd_config()
+{
+cat<<-EOF > /etc/sysconfig/tomcat@${TOMCAT_NAME}
+JAVA_HOME=${JAVA_HOME}
+JAVA_OPTS="${JAVA_OPTS}"
+CATALINA_HOME=${CATALINA_HOME}
+CATALINA_BASE=${CATALINA_BASE}
+CATALINA_OUT=${CATALINA_OUT}
+CATALINA_OPTS="${CATALINA_OPTS}"
+CATALINA_TMPDIR="${CATALINA_TMPDIR}"
+JAVA_ENDORSED_DIRS="${JAVA_ENDORSED_DIRS}"
+LOGGING_CONFIG="${LOGGING_CONFIG}"
+LOGGING_MANAGER="${LOGGING_MANAGER}"
+TOMCAT_CFG=${TOMCAT_CFG}
+EOF
+}
+
+# shellcheck disable=SC2068
 tomcatCommand()
 {
+	if ocf_is_true $SYSTEMD; then
+		systemctl $@ tomcat@${TOMCAT_NAME}
+	else
 cat<<-END_TOMCAT_COMMAND
 	export JAVA_HOME=${JAVA_HOME}
 	export JAVA_OPTS="${JAVA_OPTS}"
@@ -202,14 +213,20 @@ cat<<-END_TOMCAT_COMMAND
 	export TOMCAT_CFG=${TOMCAT_CFG}
 	$TOMCAT_START_SCRIPT $@
 END_TOMCAT_COMMAND
+	fi
 }
+
+# shellcheck disable=SC2068
 attemptTomcatCommand()
 {
 	if [ -n "$REDIRECT_DEFAULT_CONFIG" ]; then
-		export TOMCAT_CFG=$(mktemp ${HA_RSCTMP}/tomcat-tmp-XXXXX.cfg)
+		TOMCAT_CFG=$(mktemp "${HA_RSCTMP}/tomcat-tmp-XXXXX.cfg")
+		export TOMCAT_CFG
 	fi
 
-	if [ "$RESOURCE_TOMCAT_USER" = root ]; then
+	if ocf_is_true $SYSTEMD; then
+		tomcatCommand $@
+	elif [ "$RESOURCE_TOMCAT_USER" = root ]; then
 		"$TOMCAT_START_SCRIPT" $@ >> "$TOMCAT_CONSOLE" 2>&1
 	else
 		tomcatCommand $@ | $SU - -s /bin/sh "$RESOURCE_TOMCAT_USER" >> "$TOMCAT_CONSOLE" 2>&1
@@ -220,11 +237,12 @@ attemptTomcatCommand()
 	fi
 }
 
-############################################################################
-# Start Tomcat
 start_tomcat()
 {
-	cd "$CATALINA_HOME/bin"
+	if ocf_is_true $SYSTEMD; then
+		create_systemd_config
+	fi
+	cd "$CATALINA_HOME/bin" || return $OCF_ERR_GENERIC
 
 	validate_all_tomcat || exit $?
 
@@ -246,7 +264,7 @@ start_tomcat()
 			return $OCF_ERR_GENERIC
 		fi
 	fi
-	
+
 	echo "`date "+%Y/%m/%d %T"`: start ===========================" >> "$TOMCAT_CONSOLE"
 
 	ocf_log debug "CATALINA_OPTS value = ${CATALINA_OPTS}"
@@ -264,15 +282,13 @@ start_tomcat()
 	return $OCF_SUCCESS
 }
 
-############################################################################
-# Stop Tomcat
 stop_tomcat()
 {
 	local stop_time
 	local RA_TIMEOUT=20
 	local TOMCAT_STOP_OPTS=""
 
-	if [ -n $OCF_RESKEY_CRM_meta_timeout ]; then
+	if [ -n "$OCF_RESKEY_CRM_meta_timeout" ]; then
 		RA_TIMEOUT=$((OCF_RESKEY_CRM_meta_timeout/1000))
 	fi
 
@@ -334,12 +350,12 @@ Resource script for Tomcat. It manages a Tomcat instance as a cluster resource.
 <parameters>
 
 <parameter name="tomcat_name" unique="1" >
-<longdesc lang="en"><![CDATA[
+<longdesc lang="en">
 The name of the resource, added as a Java parameter in JAVA_OPTS:
--Dname=<tomcat_name> to Tomcat process on start. Used to ensure
+-Dname=<tomcat_name> to Tomcat process on start. Used to ensure
 process is still running and must be unique.
-]]></longdesc>
-<shortdesc>The name of the resource</shortdesc>
+</longdesc>
+<shortdesc lang="en">The name of the resource</shortdesc>
 <content type="string" default="" />
 </parameter>
 
@@ -347,7 +363,7 @@ process is still running and must be unique.
 <longdesc lang="en">
 Log file, used during start and stop operations.
 </longdesc>
-<shortdesc>Log file</shortdesc>
+<shortdesc lang="en">Log file</shortdesc>
 <content type="string" default="" />
 </parameter>
 
@@ -355,7 +371,7 @@ Log file, used during start and stop operations.
 <longdesc lang="en">
 Time-out for stop operation. DEPRECATED
 </longdesc>
-<shortdesc>Time-out for the stop operation. DEPRECATED</shortdesc>
+<shortdesc lang="en">Time-out for the stop operation. DEPRECATED</shortdesc>
 <content type="integer" default="" />
 </parameter>
 
@@ -364,7 +380,7 @@ Time-out for stop operation. DEPRECATED
 Maximum number of times to retry stop operation before suspending
 and killing Tomcat. DEPRECATED. Does not retry.
 </longdesc>
-<shortdesc>Max retry count for stop operation. DEPRECATED</shortdesc>
+<shortdesc lang="en">Max retry count for stop operation. DEPRECATED</shortdesc>
 <content type="integer" default="" />
 </parameter>
 
@@ -372,7 +388,7 @@ and killing Tomcat. DEPRECATED. Does not retry.
 <longdesc lang="en">
 The user who starts Tomcat.
 </longdesc>
-<shortdesc>The user who starts Tomcat</shortdesc>
+<shortdesc lang="en">The user who starts Tomcat</shortdesc>
 <content type="string" default="root" />
 </parameter>
 
@@ -380,7 +396,7 @@ The user who starts Tomcat.
 <longdesc lang="en">
 URL for state confirmation.
 </longdesc>
-<shortdesc>URL for state confirmation</shortdesc>
+<shortdesc lang="en">URL for state confirmation</shortdesc>
 <content type="string" default="" />
 </parameter>
 
@@ -393,7 +409,7 @@ The default value is five seconds before the timeout value of stop operation.
 When it is over this value, it stops a process in kill commands.
 This parameter is only effective on Tomcat 6 or later.
 </longdesc>
-<shortdesc>The max time it should take for proper shutdown.</shortdesc>
+<shortdesc lang="en">The max time it should take for proper shutdown.</shortdesc>
 <content type="integer" default="" />
 </parameter>
 
@@ -401,7 +417,7 @@ This parameter is only effective on Tomcat 6 or later.
 <longdesc lang="en">
 Home directory of Java.
 </longdesc>
-<shortdesc>Home directory of Java</shortdesc>
+<shortdesc lang="en">Home directory of Java</shortdesc>
 <content type="string" default="" />
 </parameter>
 
@@ -409,7 +425,7 @@ Home directory of Java.
 <longdesc lang="en">
 Java JVM options used on start and stop.
 </longdesc>
-<shortdesc>Java options parsed to JVM, used on start and stop.</shortdesc>
+<shortdesc lang="en">Java options parsed to JVM, used on start and stop.</shortdesc>
 <content type="string" default="" />
 </parameter>
 
@@ -417,7 +433,7 @@ Java JVM options used on start and stop.
 <longdesc lang="en">
 Home directory of Tomcat.
 </longdesc>
-<shortdesc>Home directory of Tomcat</shortdesc>
+<shortdesc lang="en">Home directory of Tomcat</shortdesc>
 <content type="string" default="" />
 </parameter>
 
@@ -425,7 +441,7 @@ Home directory of Tomcat.
 <longdesc lang="en">
 Instance directory of Tomcat
 </longdesc>
-<shortdesc>Instance directory of Tomcat, defaults to catalina_home</shortdesc>
+<shortdesc lang="en">Instance directory of Tomcat, defaults to catalina_home</shortdesc>
 <content type="string" default="" />
 </parameter>
 
@@ -433,7 +449,7 @@ Instance directory of Tomcat
 <longdesc lang="en">
 Log file name of Tomcat
 </longdesc>
-<shortdesc>Log file name of Tomcat, defaults to catalina_base/logs/catalina.out</shortdesc>
+<shortdesc lang="en">Log file name of Tomcat, defaults to catalina_base/logs/catalina.out</shortdesc>
 <content type="string" default="" />
 </parameter>
 
@@ -441,15 +457,23 @@ Log file name of Tomcat
 <longdesc lang="en">
 A PID file name for Tomcat.
 </longdesc>
-<shortdesc>A PID file name for Tomcat</shortdesc>
+<shortdesc lang="en">A PID file name for Tomcat</shortdesc>
 <content type="string" default="" />
 </parameter>
 
+<parameter name="force_systemd" unique="0" required="0">
+<longdesc lang="en">
+Force use of systemd when available.
+</longdesc>
+<shortdesc lang="en">Force use of systemd when available</shortdesc>
+<content type="string" default="$OCF_RESKEY_force_systemd_default" />
+</parameter>
+
 <parameter name="tomcat_start_script" unique="0" required="0">
 <longdesc lang="en">
 Absolute path to the custom tomcat start script to use.
 </longdesc>
-<shortdesc>Tomcat start script location</shortdesc>
+<shortdesc lang="en">Tomcat start script location</shortdesc>
 <content type="string" default="$TOMCAT_START_SCRIPT" />
 </parameter>
 
@@ -457,7 +481,7 @@ Absolute path to the custom tomcat start script to use.
 <longdesc lang="en">
 Tomcat start options.
 </longdesc>
-<shortdesc>Tomcat start options</shortdesc>
+<shortdesc lang="en">Tomcat start options</shortdesc>
 <content type="string" default="" />
 </parameter>
 
@@ -465,7 +489,7 @@ Tomcat start options.
 <longdesc lang="en">
 Catalina options, for the start operation only.
 </longdesc>
-<shortdesc>Catalina options</shortdesc>
+<shortdesc lang="en">Catalina options</shortdesc>
 <content type="string" default="" />
 </parameter>
 
@@ -473,7 +497,7 @@ Catalina options, for the start operation only.
 <longdesc lang="en">
 Temporary directory of Tomcat
 </longdesc>
-<shortdesc>Temporary directory of Tomcat, defaults to none</shortdesc>
+<shortdesc lang="en">Temporary directory of Tomcat, defaults to none</shortdesc>
 <content type="string" default="" />
 </parameter>
 
@@ -481,7 +505,7 @@ Temporary directory of Tomcat
 <longdesc lang="en">
 Rotate catalina.out flag.
 </longdesc>
-<shortdesc>Rotate catalina.out flag</shortdesc>
+<shortdesc lang="en">Rotate catalina.out flag</shortdesc>
 <content type="boolean" default="NO" />
 </parameter>
 
@@ -489,7 +513,7 @@ Rotate catalina.out flag.
 <longdesc lang="en">
 catalina.out rotation interval (seconds).
 </longdesc>
-<shortdesc>catalina.out rotation interval (seconds)</shortdesc>
+<shortdesc lang="en">catalina.out rotation interval (seconds)</shortdesc>
 <content type="integer" default="" />
 </parameter>
 
@@ -497,7 +521,7 @@ catalina.out rotation interval (seconds).
 <longdesc lang="en">
 Java_endorsed_dirs of tomcat
 </longdesc>
-<shortdesc>Java_endorsed_dirs of Tomcat, defaults to none</shortdesc>
+<shortdesc lang="en">Java_endorsed_dirs of Tomcat, defaults to none</shortdesc>
 <content type="string" default="" />
 </parameter>
 
@@ -505,7 +529,7 @@ Java_endorsed_dirs of tomcat
 <longdesc lang="en">
 Logging_config of tomcat
 </longdesc>
-<shortdesc>Logging_config of Tomcat, defaults to none</shortdesc>
+<shortdesc lang="en">Logging_config of Tomcat, defaults to none</shortdesc>
 <content type="string" default="" />
 </parameter>
 
@@ -513,7 +537,7 @@ Logging_config of tomcat
 <longdesc lang="en">
 Logging_manager of tomcat
 </longdesc>
-<shortdesc>Logging_manager of Tomcat, defaults to none.</shortdesc>
+<shortdesc lang="en">Logging_manager of Tomcat, defaults to none.</shortdesc>
 <content type="string" default="" />
 </parameter>
 
@@ -540,7 +564,7 @@ validate_all_tomcat()
 
 	check_binary $WGET
 
-	if [ -z "${TOMCAT_START_SCRIPT}" ]; then
+	if ! ocf_is_true $OCF_RESKEY_force_systemd && [ -z "${TOMCAT_START_SCRIPT}" ]; then
 		ocf_exit_reason "No default tomcat start script detected. Please specify start script location using the 'tomcat_start_script' option"
 		rc=$OCF_ERR_CONFIGURED
 	fi
@@ -589,6 +613,7 @@ TOMCAT_NAME="${OCF_RESKEY_tomcat_name-tomcat}"
 TOMCAT_CONSOLE="${OCF_RESKEY_script_log-/var/log/$TOMCAT_NAME.log}"
 RESOURCE_TOMCAT_USER="${OCF_RESKEY_tomcat_user-root}"
 RESOURCE_STATUSURL="${OCF_RESKEY_statusurl-http://127.0.0.1:8080}"
+OCF_RESKEY_force_systemd_default=0
 
 JAVA_HOME="${OCF_RESKEY_java_home}"
 JAVA_OPTS="${OCF_RESKEY_java_opts}"
@@ -607,6 +632,7 @@ fi
 
 MAX_STOP_TIME="${OCF_RESKEY_max_stop_time}"
 
+: ${OCF_RESKEY_force_systemd=${OCF_RESKEY_force_systemd_default}}
 TOMCAT_START_OPTS="${OCF_RESKEY_tomcat_start_opts}"
 TOMCAT_START_SCRIPT="${OCF_RESKEY_tomcat_start_script}"
 CATALINA_OPTS="-Dname=$TOMCAT_NAME ${OCF_RESKEY_catalina_opts}"
@@ -618,7 +644,10 @@ LOGGING_CONFIG="${OCF_RESKEY_logging_config}"
 LOGGING_MANAGER="${OCF_RESKEY_logging_manager}"
 
 if [ -z "${TOMCAT_START_SCRIPT}" ]; then
-	if [ -e "$CATALINA_HOME/bin/catalina.sh" ]; then
+	if ocf_is_true $OCF_RESKEY_force_systemd && \
+	     ps -p 1 | grep -q systemd; then
+		SYSTEMD=1
+	elif [ -e "$CATALINA_HOME/bin/catalina.sh" ]; then
 		TOMCAT_START_SCRIPT="$CATALINA_HOME/bin/catalina.sh"
 	elif [ -e "/usr/sbin/tomcat" ]; then
 		REDIRECT_DEFAULT_CONFIG=1
diff --git a/heartbeat/varnish b/heartbeat/varnish
index d565832..84672c7 100755
--- a/heartbeat/varnish
+++ b/heartbeat/varnish
@@ -72,7 +72,7 @@ meta_data() {
 	cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="varnish" version="0.1">
+<resource-agent name="varnish">
 <version>1.0</version>
 
 <longdesc lang="en">
diff --git a/ldirectord/OCF/ldirectord.in b/ldirectord/OCF/ldirectord.in
index f7c639e..aea4626 100644
--- a/ldirectord/OCF/ldirectord.in
+++ b/ldirectord/OCF/ldirectord.in
@@ -6,9 +6,9 @@
 #   Tested on SuSE Linux Enterprise Server 10.
 #
 #   Should conform to the specification found at
-#    http://www.linux-ha.org/OCFResourceAgent
+#    https://github.com/ClusterLabs/resource-agents/blob/master/doc/dev-guides/ra-dev-guide.asc
 #   and
-#   http://www.opencf.org/cgi-bin/viewcvs.cgi/specs/ra/resource-agent-api.txt?rev=HEAD
+#    https://github.com/ClusterLabs/OCF-spec/blob/master/ra/resource-agent-api.md
 #
 #   ToDo: Add parameter to start several instances of ldirectord
 #   with different config files.
diff --git a/ldirectord/ldirectord.cf b/ldirectord/ldirectord.cf
index d1e8426..9452a5a 100644
--- a/ldirectord/ldirectord.cf
+++ b/ldirectord/ldirectord.cf
@@ -23,6 +23,8 @@ quiescent=no
 
 # Sample for an http virtual service
 virtual=192.168.6.240:80
+	servicename=Web Site
+	comment=Test load balanced web site
 	real=192.168.6.2:80 gate
 	real=192.168.6.3:80 gate
 	real=192.168.6.6:80 gate
diff --git a/ldirectord/ldirectord.in b/ldirectord/ldirectord.in
old mode 100644
new mode 100755
index ded8563..527f868
--- a/ldirectord/ldirectord.in
+++ b/ldirectord/ldirectord.in
@@ -602,7 +602,7 @@ B<login = ">I<username>B<">
 For FTP, IMAP, LDAP, MySQL, Oracle, POP and PostgreSQL, the username
 used to log in.
 
-For Radius the username is used for the attribute User-Name.
+For RADIUS the username is used for the attribute User-Name.
 
 For SIP, the username is used as both the to and from address for an
 OPTIONS query.
@@ -628,7 +628,7 @@ B<passwd = ">I<password>B<">
 Password to use to login to FTP, IMAP, LDAP, MySQL, Oracle, POP, PostgreSQL
 and SIP servers.
 
-For Radius the passwd is used for the attribute User-Password.
+For RADIUS the passwd is used for the attribute User-Password.
 
 Default:
 
@@ -652,7 +652,7 @@ against.  This is a required setting.
 
 B<secret = ">I<radiussecret>B<">
 
-Secret to use for Radius servers, this is the secret used to perform an
+Secret to use for RADIUS servers, this is the secret used to perform an
 Access-Request with the username (set by B<login> above) and passwd (set by
 B<passwd> above).
 
@@ -712,6 +712,17 @@ can be used only for UDP services. If this option is specified, all connections
 are created only to schedule one packet. Option is useful to schedule
 UDP packets from same client port to different real servers.
 
+B<servicename = >I<short name>
+
+A name for this service. This is for the sole purpose of making it easier
+to know which service is affected when e-mail notifications are sent out.
+It will be included in the e-mail subject and body.
+
+B<comment = >I<comment>
+
+Notes about this service to be included in e-mail notifications (for example,
+purpose of the service or relevant administrator to contact).
+
 =head1 IPv6
 
 Directives for IPv6 are virtual6, real6, fallback6.
@@ -1617,6 +1628,10 @@ sub read_config
 				} elsif  ($rcmd =~ /^smtp\s*=\s*(.*)/) {
 					$1 =~ /(^([0-9A-Za-z._+-]+))/ or &config_error($line, "invalid SMTP server address");
 					$vsrv{smtp} = $1;
+				} elsif  ($rcmd =~ /^servicename\s*=\s*(.*)/) {
+					$vsrv{servicename} = $1;
+				} elsif  ($rcmd =~ /^comment\s*=\s*(.*)/) {
+					$vsrv{comment} = $1;
 				} else {
 					&config_error($line, "Unknown command \"$linedata\"");
 				}
@@ -2590,6 +2605,10 @@ sub ld_start
 		}
 		purge_virtual($nv, "start");
 	}
+
+	# initial check of all real servers while we are still starting up so
+	# any e-mail notifications sent out are in 'starting' daemon status.
+	_ld_main_check_all();
 }
 
 sub ld_cmd_children
@@ -2662,24 +2681,8 @@ sub ld_main
 			check_signal();
 
 		} else {
-			my @real_checked;
-			foreach my $v (@VIRTUAL) {
-				my $real = $$v{real};
-				my $virtual_id = get_virtual_id_str($v);
+			_ld_main_check_all();
 
-				REAL: foreach my $r (@$real) {
-					my $real_id = get_real_id_str($r, $v);
-					check_signal();
-					foreach my $tmp_id (@real_checked) {
-						if($real_id eq $tmp_id) {
-							&ld_debug(3, "Already checked: real server=$real_id (virtual=$virtual_id)");
-							next REAL;
-						}
-					}
-					_check_real($v, $r);
-					push(@real_checked, $real_id);
-				}
-			}
 			check_signal();
 			if (!check_cfgfile()) {
 				sleep $CHECKINTERVAL;
@@ -2718,6 +2721,11 @@ sub run_child
 	my $real = $$v{real};
 	my $virtual_id = get_virtual_id_str($v);
 	my $checkinterval = $$v{checkinterval} || $CHECKINTERVAL;
+
+	# delete any entries in EMAILSTATUS as we can't trust what has been
+	# set in the parent in the past.
+	%EMAILSTATUS = ();
+
 	$0 = "ldirectord $virtual_id";
 	while (1) {
 		foreach my $r (@$real) {
@@ -2730,6 +2738,30 @@ sub run_child
 	}
 }
 
+# run checks for everything
+sub _ld_main_check_all
+{
+	my @real_checked;
+
+	foreach my $v (@VIRTUAL) {
+		my $real = $$v{real};
+		my $virtual_id = get_virtual_id_str($v);
+
+		REAL: foreach my $r (@$real) {
+			my $real_id = get_real_id_str($r, $v);
+			check_signal();
+			foreach my $tmp_id (@real_checked) {
+				if($real_id eq $tmp_id) {
+					&ld_debug(3, "Already checked: real server=$real_id (virtual=$virtual_id)");
+					next REAL;
+				}
+			}
+			_check_real($v, $r);
+			push(@real_checked, $real_id);
+		}
+	}
+}
+
 sub _check_real
 {
 	my $v = shift;
@@ -2850,6 +2882,8 @@ sub check_http
 {
 	use LWP::UserAgent;
 	use LWP::Debug;
+	use Net::HTTP;
+	use URI;
 	if($DEBUG > 2) {
 		LWP::Debug::level('+');
 	}
@@ -2862,9 +2896,12 @@ sub check_http
 		. "virtualhost=\"$virtualhost\"");
 
 	if (inet_pton(AF_INET6,&ld_strip_brackets($host))) {
-		no warnings 'once';
 		require Net::INET6Glue::INET_is_INET6;
-		# Workaround for Net-HTTP IPv6 Address URLs Broken
+	}
+
+	# Workaround for Net-HTTP IPv6 Address URLs Broken
+	if ($LWP::VERSION < 6.08 || $Net::HTTP::VERSION < 6.07 || $URI::VERSION < 1.64) {
+		no warnings 'once';
 		@LWP::Protocol::http::EXTRA_SOCK_OPTS = (PeerAddr => $host,
 							 PeerHost => &ld_strip_brackets($host),
 							 Host => &ld_strip_brackets($host));
@@ -2964,7 +3001,7 @@ sub check_pop
 	my ($v, $r, $ssl) = @_;
 	my $port = ld_checkport($v, $r);
 
-	&ld_debug(2, "Checking pop server=$$r{server} port=$port ssl=$ssl");
+	&ld_debug(2, "Checking POP3 server=$$r{server} port=$port ssl=$ssl");
 
 	my $pop = new Mail::POP3Client(USER => $$v{login},
 					PASSWORD => $$v{passwd},
@@ -2999,7 +3036,7 @@ sub check_imap
 	my ($v, $r) = @_;
 	my $port = ld_checkport($v, $r);
 
-	&ld_debug(2, "Checking imap server=$$r{server} port=$port");
+	&ld_debug(2, "Checking IMAP server=$$r{server} port=$port");
 
 	my $imap = Net::IMAP::Simple->new($$r{server},
 					port => $port,
@@ -3030,7 +3067,7 @@ sub check_imaps
 	my ($v, $r) = @_;
 	my $port = ld_checkport($v, $r);
 
-	&ld_debug(2, "Checking imaps server=$$r{server} port=$port");
+	&ld_debug(2, "Checking IMAPS server=$$r{server} port=$port");
 
 	my $imaps = Net::IMAP::Simple::SSL->new($$r{server},
 					port => $port,
@@ -3063,7 +3100,7 @@ sub check_ldap
 	my $result;
 	my $recstr = $$r{receive};
 
-	&ld_debug(2, "Checking ldap server=$$r{server} port=$port");
+	&ld_debug(2, "Checking LDAP server=$$r{server} port=$port");
 	eval {
 		local $SIG{'__DIE__'} = "DEFAULT";
 		local $SIG{'ALRM'} = sub { die "Timeout Alarm" };
@@ -3141,7 +3178,7 @@ sub check_nntp
 	my $port = ld_checkport($v, $r);
 	my $status = 1;
 
-	&ld_debug(2, "Checking nntp server=$$r{server} port=$port");
+	&ld_debug(2, "Checking NNTP server=$$r{server} port=$port");
 
 	unless ($sock = IO::Socket::INET6->new(PeerAddr => $$r{server},
 		PeerPort => $port, Proto => 'tcp',
@@ -3174,7 +3211,7 @@ sub check_radius
 
 	my ($v, $r) = @_;
 
-	&ld_debug(2, "Checking radius");
+	&ld_debug(2, "Checking RADIUS");
 
 	my $port = ld_checkport($v, $r);
 	my $radius;
@@ -3187,19 +3224,19 @@ sub check_radius
 		&ld_debug(2, "Starting Check");
 		alarm $$v{checktimeout};
 
-		&ld_debug(2, "Starting Radius");
+		&ld_debug(2, "Starting RADIUS");
 		$radius = new Authen::Radius(Host => "$$r{server}:$port",
 					     Secret=>$$v{secret},
 					     TimeOut=>$$v{negotiatetimeout},
 					     Errmode=>'die');
 		$result = $radius->check_pwd($$v{login}, $$v{passwd});
-		&ld_debug(2, "Finished Radius");
+		&ld_debug(2, "Finished RADIUS");
 		alarm 0; # Cancel the alarm
 	};
 	if ($result eq "") {
 		&service_set($v, $r, "down", {do_log => 1});
 		&ld_debug(3, "Deactivated service $$r{server}:$$r{port}: $@");
-		&ld_debug(3, "Radius Error: ".$radius->get_error);
+		&ld_debug(3, "RADIUS Error: ".$radius->get_error);
 		return $SERVICE_DOWN;
 	} else {
 		&service_set($v, $r, "up", {do_log => 1});
@@ -3429,7 +3466,7 @@ sub check_sip
 	my ($v, $r) = @_;
 	my $sip_d_port = ld_checkport($v, $r);
 
-	&ld_debug(2, "Checking sip server=$$r{server} port=$sip_d_port");
+	&ld_debug(2, "Checking SIP server=$$r{server} port=$sip_d_port");
 
 
 	eval {
@@ -3592,7 +3629,7 @@ sub check_ftp
 	my $debug = ($DEBUG > 2) ? 1 : 0;
 	my $port = ld_checkport($v, $r);
 
-	&ld_debug(2, "Checking ftp server=$$r{server} port=$port");
+	&ld_debug(2, "Checking FTP server=$$r{server} port=$port");
 	&ld_debug(4, "Timeout is $$v{negotiatetimeout}");
 
 	open(TMP,'+>', undef);
@@ -3657,7 +3694,7 @@ sub check_dns
 	
 	$server = &ld_strip_brackets($$r{server});
 
-	&ld_debug(2, "Checking dns: request=\"$request\" receive=\""
+	&ld_debug(2, "Checking DNS: request=\"$request\" receive=\""
 		. $$r{"receive"} . "\"\n");
 
 	eval {
@@ -4418,6 +4455,7 @@ sub ld_emailalert_send
 	my $id;
 	my $statusfilter;
 	my $smtp_server;
+	my $virtual_info;
 
 	$frequency = defined $v->{emailalertfreq} ?  $v->{emailalertfreq} :
 				$EMAILALERTFREQ;
@@ -4448,16 +4486,43 @@ sub ld_emailalert_send
 				$SMTP;
 
 	&ld_log("emailalert: $subject");
+
+	# get extra service details
+	$virtual_info = _ld_virtual_server_details($v);
+
+	# add service name into e-mail subject if it has been set
+	if ($v->{servicename}) {
+		$subject = "[" . $v->{servicename}  ."] $subject";
+	}
+
 	if (defined $smtp_server) {
-		$status = &ld_emailalert_net_smtp($smtp_server, $to_addr, $subject);
+		$status = &ld_emailalert_net_smtp($smtp_server, $to_addr, $subject, $virtual_info);
 	}
 	else {
-		$status = &ld_emailalert_mail_send($to_addr, $subject);
+		$status = &ld_emailalert_mail_send($to_addr, $subject, $virtual_info);
 	}
 
 	return($status);
 }
 
+# generate virtual server information to go in to alert e-mails
+sub _ld_virtual_server_details
+{
+	my ($v) = @_;
+	my $details;
+
+	if ($v->{servicename}) {
+		$details .= "Service name: " . $v->{servicename} . "\n"
+	}
+
+	if ($v->{comment}) {
+		$details .= "Comment: " . $v->{comment} . "\n";
+	}
+
+	return $details;
+}
+
+
 # ld_emailalert_net_smtp
 # Send email alerts via SMTP server
 # pre: smtp: SMTP server defined
@@ -4466,7 +4531,7 @@ sub ld_emailalert_send
 #	  1 on error
 sub ld_emailalert_net_smtp
 {
-	my ($smtp_server, $to_addr, $subject) = (@_);
+	my ($smtp_server, $to_addr, $subject, $extrabody) = (@_);
 	my $status = 0;
 
 	use Net::SMTP;
@@ -4492,6 +4557,7 @@ sub ld_emailalert_net_smtp
 				"Log-Message: $subject\n" .
 				"Daemon-Status: " .
 				&daemon_status_str() . "\n");
+		$smtp->datasend("\n$extrabody\n") if ($extrabody);
 		$smtp->dataend();
 		$smtp->quit;
 	} else {
@@ -4510,7 +4576,7 @@ sub ld_emailalert_net_smtp
 #	  1 on error
 sub ld_emailalert_mail_send
 {
-	my ($to_addr, $subject) = (@_);
+	my ($to_addr, $subject, $extrabody) = (@_);
 	my $emailmsg;
 	my $emailfh;
 	my $status = 0;
@@ -4523,6 +4589,7 @@ sub ld_emailalert_mail_send
 	print $emailfh "ldirectord host: " . hostname() . "\n" .
 		       "Log-Message: $subject\n" .
 		       "Daemon-Status: " . &daemon_status_str() . "\n";
+	print $emailfh "\n$extrabody\n" if ($extrabody);
 	unless ($emailfh->close) {
 		&ld_log("failed to send email message\n");
 		$status = 1;
diff --git a/make/release.mk b/make/release.mk
index f8cf5b2..4312d6b 100644
--- a/make/release.mk
+++ b/make/release.mk
@@ -35,7 +35,7 @@ endif
 tarballs: tag
 	./autogen.sh
 	./configure
-	make distcheck
+	DISTCHECK_CONFIGURE_FLAGS="--with-systemdsystemunitdir=no" make distcheck
 
 sha256: tarballs $(project)-$(version).sha256
 
diff --git a/resource-agents.spec.in b/resource-agents.spec.in
index fbdb7ef..40f6e5c 100644
--- a/resource-agents.spec.in
+++ b/resource-agents.spec.in
@@ -79,31 +79,35 @@ BuildRequires:  libxslt docbook_4 docbook-xsl-stylesheets
 %endif
 
 ## Runtime deps
-## These apply to rgmanager agents only to guarantee agents
-## are functional
-%if %{with rgmanager}
 # system tools shared by several agents
 Requires: /bin/bash /bin/grep /bin/sed /bin/gawk
-Requires: /bin/ps /usr/bin/pkill /bin/hostname
-Requires: /sbin/fuser
-Requires: /sbin/findfs /bin/mount
+Requires: /bin/ps /usr/bin/pkill /bin/hostname /bin/netstat
+Requires: /sbin/fuser /bin/mount
 
-# fs.sh
-Requires: /sbin/quotaon /sbin/quotacheck
+# Filesystem / fs.sh / netfs.sh
 Requires: /sbin/fsck
 Requires: /sbin/fsck.ext2 /sbin/fsck.ext3 /sbin/fsck.ext4
 Requires: /sbin/fsck.xfs
+Requires: /sbin/mount.nfs /sbin/mount.nfs4 /sbin/mount.cifs
 
-# ip.sh
-Requires: /sbin/ip /usr/sbin/ethtool
-Requires: /sbin/rdisc /usr/sbin/arping /bin/ping /bin/ping6
+# IPaddr2
+Requires: /sbin/ip
 
-# lvm.sh
+# LVM / lvm.sh
 Requires: /sbin/lvm
 
-# netfs.sh
-Requires: /sbin/mount.nfs /sbin/mount.nfs4 /sbin/mount.cifs
+# nfsserver / netfs.sh
 Requires: /usr/sbin/rpc.nfsd /sbin/rpc.statd /usr/sbin/rpc.mountd
+
+# rgmanager
+%if %{with rgmanager}
+# ip.sh
+Requires: /usr/sbin/ethtool
+Requires: /sbin/rdisc /usr/sbin/arping /bin/ping /bin/ping6
+
+#nfsexport.sh
+Requires: /sbin/findfs 
+Requires: /sbin/quotaon /sbin/quotacheck
 %endif
 
 %description
@@ -143,8 +147,8 @@ The Linux Director Daemon (ldirectord) was written by Jacob Rief.
 
 ldirectord is a stand alone daemon for monitoring the services on real
 servers. Currently, HTTP, HTTPS, and FTP services are supported.
-lditrecord is simple to install and works with the heartbeat code
-(http://www.linux-ha.org/).
+ldirectord is simple to install and works with Pacemaker
+(http://clusterlabs.org/).
 
 See 'ldirectord -h' and linux-ha/doc/ldirectord for more information.
 %endif
diff --git a/rgmanager/src/resources/clusterfs.sh b/rgmanager/src/resources/clusterfs.sh
index 07fd73b..ab2c292 100755
--- a/rgmanager/src/resources/clusterfs.sh
+++ b/rgmanager/src/resources/clusterfs.sh
@@ -301,6 +301,7 @@ do_pre_unmount() {
 	   [ "$OCF_RESKEY_nfslock" = "1" ]; then
 		ocf_log warning "Dropping node-wide NFS locks"
 		mkdir -p $mp/.clumanager/statd
+		chown rpcuser.rpcuser $mp/.clumanager/statd
 		pkill -KILL -x lockd
 		# Copy out the notify list; our 
 		# IPs are already torn down
diff --git a/rgmanager/src/resources/fs.sh.in b/rgmanager/src/resources/fs.sh.in
index 2924fa7..6d99f95 100644
--- a/rgmanager/src/resources/fs.sh.in
+++ b/rgmanager/src/resources/fs.sh.in
@@ -443,6 +443,7 @@ do_post_mount() {
 		if [ "$OCF_RESKEY_nfslock" = "yes" ] || \
 	   	   [ "$OCF_RESKEY_nfslock" = "1" ]; then
 			mkdir -p "$mp"/.clumanager/statd
+			chown rpcuser.rpcuser "$mp"/.clumanager/statd
 			notify_list_merge "$mp"/.clumanager/statd
 		fi
 	fi
@@ -457,6 +458,7 @@ do_force_unmount() {
 		ocf_log warning "Dropping node-wide NFS locks"
 		pkill -KILL -x lockd
 		mkdir -p "$mp"/.clumanager/statd
+		chown rpcuser.rpcuser "$mp"/.clumanager/statd
 		# Copy out the notify list; our
 		# IPs are already torn down
 		notify_list_store "$mp"/.clumanager/statd
diff --git a/rgmanager/src/resources/lvm_by_lv.sh b/rgmanager/src/resources/lvm_by_lv.sh
index 366eaec..ef70366 100755
--- a/rgmanager/src/resources/lvm_by_lv.sh
+++ b/rgmanager/src/resources/lvm_by_lv.sh
@@ -183,6 +183,8 @@ lv_activate_resilient()
 
 lv_status_clustered()
 {
+	declare lv_path="$OCF_RESKEY_vg_name/$OCF_RESKEY_lv_name"
+
 	#
 	# Check if device is active
 	#
diff --git a/rgmanager/src/resources/ra2rng.xsl b/rgmanager/src/resources/ra2rng.xsl
index e53595e..28aba68 100644
--- a/rgmanager/src/resources/ra2rng.xsl
+++ b/rgmanager/src/resources/ra2rng.xsl
@@ -288,13 +288,23 @@
                 <xsl:value-of select="$NL"/>
             </xsl:for-each>
 
-            <!-- optional (start) -->
+            <!-- interleave (start) -->
             <xsl:call-template name="tag-start">
-                <xsl:with-param name="name" select="'optional'"/>
+                <xsl:with-param name="name" select="'interleave'"/>
                 <xsl:with-param name="indent" select="concat($indent, $indent)"/>
             </xsl:call-template>
             <xsl:value-of select="$NL"/>
 
+                <!-- ref name="RESOURCEACTION" -->
+                <xsl:call-template name="tag-self">
+                    <xsl:with-param name="name" select="'ref'"/>
+                    <xsl:with-param name="attrs" select="concat(
+                        'name=', $Q, 'RESOURCEACTION', $Q)"/>
+                    <xsl:with-param name="indent" select="concat($indent, $indent,
+                                                                 $indent)"/>
+                </xsl:call-template>
+                <xsl:value-of select="$NL"/>
+
                 <!-- ref name="CHILDREN" -->
                 <xsl:call-template name="tag-self">
                     <xsl:with-param name="name" select="'ref'"/>
@@ -305,9 +315,9 @@
                 </xsl:call-template>
                 <xsl:value-of select="$NL"/>
 
-            <!-- optional (end) -->
+            <!-- interleave (end) -->
             <xsl:call-template name="tag-end">
-                <xsl:with-param name="name" select="'optional'"/>
+                <xsl:with-param name="name" select="'interleave'"/>
                 <xsl:with-param name="indent" select="concat($indent, $indent)"/>
             </xsl:call-template>
             <xsl:value-of select="$NL"/>
diff --git a/rgmanager/src/resources/resources.rng.mid b/rgmanager/src/resources/resources.rng.mid
index cc2dff3..63ee46d 100644
--- a/rgmanager/src/resources/resources.rng.mid
+++ b/rgmanager/src/resources/resources.rng.mid
@@ -1,3 +1,20 @@
+  <define name="RESOURCEACTION">
+   <zeroOrMore>
+    <element name="action" rha:description="Overrides resource action timings for a resource instance.">
+     <attribute name="name" rha:description="Name of resource action (start, stop, status, etc.)."/>
+     <optional>
+      <attribute name="depth" rha:description="Status check depth (resource agent dependent; * = all depths)."/>
+     </optional>
+     <optional>
+      <attribute name="interval" rha:description="Status check interval."/>
+     </optional>
+     <optional>
+      <attribute name="timeout" rha:description="Action timeout.  Meaningless unless __enforce_timeouts is set for this resource."/>
+     </optional>
+    </element>
+   </zeroOrMore>
+  </define>
+
   <define name="CHILDREN">
     <zeroOrMore>
-     <choice>
+      <choice>
diff --git a/rgmanager/src/resources/resources.rng.tail b/rgmanager/src/resources/resources.rng.tail
index 4434631..d726579 100644
--- a/rgmanager/src/resources/resources.rng.tail
+++ b/rgmanager/src/resources/resources.rng.tail
@@ -1,23 +1,6 @@
 
-      <ref name="RESOURCEACTION"/>
-     </choice>
+      </choice>
     </zeroOrMore>
   </define>
 
-  <define name="RESOURCEACTION">
-   <zeroOrMore>
-    <element name="action" rha:description="Overrides resource action timings for a resource instance.">
-     <attribute name="name" rha:description="Name of resource action (start, stop, status, etc.)."/>
-     <optional>
-      <attribute name="depth" rha:description="Status check depth (resource agent dependent; * = all depths)."/>
-     </optional>
-     <optional>
-      <attribute name="interval" rha:description="Status check interval."/>
-     </optional>
-     <optional>
-      <attribute name="timeout" rha:description="Action timeout.  Meaningless unless __enforce_timeouts is set for this resource."/>
-     </optional>
-    </element>
-   </zeroOrMore>
-  </define>
 <!-- End autogenerated resources definitions -->
diff --git a/tools/ocf-tester.in b/tools/ocf-tester.in
index ae2c4a9..10822a5 100755
--- a/tools/ocf-tester.in
+++ b/tools/ocf-tester.in
@@ -216,7 +216,7 @@ lrm_test_command() {
 test_permissions() {
     action=meta-data
     debug ${1:-"Testing permissions with uid nobody"}
-    su nobody -s /bin/sh $agent $action > /dev/null
+    su nobody -s /bin/sh -c "$agent $action" > /dev/null
 }
 
 test_metadata() {
diff --git a/tools/ocft/IPaddr2 b/tools/ocft/IPaddr2
index 1cf81bf..04698a0 100644
--- a/tools/ocft/IPaddr2
+++ b/tools/ocft/IPaddr2
@@ -128,10 +128,10 @@ CASE "check additional env: specify iflabel in 'OCF_RESKEY_nic'"
 	Include check_iflabel_removed
 
 # monitor should return OCF_ERR_GENERIC rather than OCF_ERR_CONFIGURED
-# when the specified OCF_RESKEY_nic is disappeard by a failure.
+# when the specified OCF_RESKEY_nic is vanished by a failure.
 # This has been changed as of 3.9.6.
-CASE "monitor failure when 'OCF_RESKEY_nic' is disappeared"
+CASE "monitor failure when 'OCF_RESKEY_nic' is vanished"
 	Include prepare
-	Env OCF_RESKEY_nic=ethDisappear
+	Env OCF_RESKEY_nic=ethVanished
 	Env OCF_RESKEY_CRM_meta_interval=10 # not in probe
 	AgentRun monitor OCF_ERR_GENERIC
diff --git a/tools/ocft/Makefile.am b/tools/ocft/Makefile.am
index 8191c11..69c59ee 100644
--- a/tools/ocft/Makefile.am
+++ b/tools/ocft/Makefile.am
@@ -17,7 +17,7 @@
 
 MAINTAINERCLEANFILES = Makefile.in
 
-EXTRA_DIST		= $(ocftcfgs_DATA) $(ocft_DATA)
+EXTRA_DIST		= $(ocftcfgs_DATA) $(ocft_DATA) $(ocft_SCRIPTS)
 
 sbin_SCRIPTS		= ocft
 
diff --git a/tools/ocft/README.in b/tools/ocft/README.in
index c837fcc..1c4ae12 100644
--- a/tools/ocft/README.in
+++ b/tools/ocft/README.in
@@ -2,11 +2,11 @@ INTRODUCTION & DESIGN
 ~~~~~~~~~~~~~~~~~~~~~
 
   - Ocft is a testing tool for resource agents. Instead of the policy of HA,
-    it mainly concerns whether resource agents run correct locally. It can 
-    design types of complicated environments to test the reliability of 
-    resource agents. Precisely, it is to display whether resource agents can 
-    return to correct or expected value. The advantage of the tool provides 
-    us with competence to design conditions which can be recorded or reproduced. 
+    it mainly concerns whether resource agents run correct locally. It can
+    design types of complicated environments to test the reliability of
+    resource agents. Precisely, it is to display whether resource agents can
+    return to correct or expected value. The advantage of the tool provides
+    us with competence to design conditions which can be recorded or reproduced.
     Hence it is useful to debuggers.
 
 * Components
@@ -14,29 +14,29 @@ INTRODUCTION & DESIGN
       - Turning configuration files of test case to executable scripts.
 
     ** Configuration file  (@datadir@/@PACKAGE_NAME@/ocft/configs/)
-      - Every configuration file directs only one resource agent and share the same 
+      - Every configuration file directs only one resource agent and share the same
         name with resource agent but contains more test cases.
 
     ** The testing script  (/var/lib/@PACKAGE_NAME@/ocft/cases/)
-      - After the generator reads configuration files and generates many testing 
+      - After the generator reads configuration files and generates many testing
         scripts and the script is underway, the test begins.
 
 * How to customize the environment of testing
-  - Ocft designs the running conditions through two ways, one is changing the 
-    environment variables of resource agents (it is the interface left by OCF itself), 
-    the other is modifying the OS environment of resource agents, such as altering 
+  - Ocft designs the running conditions through two ways, one is changing the
+    environment variables of resource agents (it is the interface left by OCF itself),
+    the other is modifying the OS environment of resource agents, such as altering
     the permission of some key file or IP address of the machine.
 
 * How to test
-  - Firstly, you need to sketch the all complex and uncommon environments against 
-    a certain resource agent and keep in mind what consequences may be caused by 
-    these uncommon environments. 
-    Secondly, write the designed conditions and foreknown consequences into 
-    configuration files, and then run the generator to translate the test case to 
-    executable scripts. 
-    Finally, you need running these scripts to observe the output and learn 
-    the running status of each test case, which will compares the predicated result 
-    with the actual one. If they differ, you will be able to find the bugs of the 
+  - Firstly, you need to sketch the all complex and uncommon environments against
+    a certain resource agent and keep in mind what consequences may be caused by
+    these uncommon environments.
+    Secondly, write the designed conditions and foreknown consequences into
+    configuration files, and then run the generator to translate the test case to
+    executable scripts.
+    Finally, you need running these scripts to observe the output and learn
+    the running status of each test case, which will compares the predicated result
+    with the actual one. If they differ, you will be able to find the bugs of the
     resource agent.
   - All of the output with test will be recorded into the log files, you can find them
     in /var/lib/@PACKAGE_NAME@/ocft/cases/logs.
@@ -45,7 +45,7 @@ INTRODUCTION & DESIGN
 HOW TO WRITE CONFIGURATION FILE
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-  - There are only 6 top level options that are all spelled by capital letters and "-". 
+  - There are only 6 top level options that are all spelled by capital letters and "-".
     Every top level option contains sub-options that they are initials.
 
 * 'CONFIG' (top level option)
@@ -63,17 +63,17 @@ HOW TO WRITE CONFIGURATION FILE
 
     ** 'InstallPackage' (sub-option)
       - Grammar: InstallPackage package [package2 [...]]
-      - It will test whether the system have installed the service of the resource agent. 
+      - It will test whether the system have installed the service of the resource agent.
         If not, it will download from Internet and have it installed automatically.
 
     ** 'HangTimeout' (sub-option)
       - Grammar: HangTimeout secs
-      - If you alter some key options, some resource agents will get puzzled and stop, 
-        which will influence the running of the following test case.  Hence timeout setting is 
+      - If you alter some key options, some resource agents will get puzzled and stop,
+        which will influence the running of the following test case.  Hence timeout setting is
         needed, if the resource agent stops timeout, the scripts will kill this resource agent.
 
 * 'VARIABLE' (top level option)
-  - Garmmar: 
+  - Grammar:
       VARIABLE
           VAR1=value1
           VAR2=value2
@@ -83,14 +83,14 @@ HOW TO WRITE CONFIGURATION FILE
     affect the activity of agent, but the variables in VARIABLE just be shared with top level option.
 
 * 'SETUP-AGENT' (top level option)
-  - Grammar: 
+  - Grammar:
       SETUP-AGENT
           bash scripts...
 	  ...
-  - Some of Agents may need to be initialized before testing, you can do it here with bash script. 
+  - Some of Agents may need to be initialized before testing, you can do it here with bash script.
 
 * 'CLEANUP-AGENT' (top level option)
-  - Garmmar:
+  - Grammar:
       CLEANUP-AGENT
           bash scripts...
           ...
@@ -98,50 +98,50 @@ HOW TO WRITE CONFIGURATION FILE
 
 * 'CASE' & 'CASE-BLOCK' (top level option)
   - Grammar: CASE "description" & CASE-BLOCK macro_name
-  - Usually, the conditions you designed are more than one and a few 'CASE "..."' will 
-    appear in configuration file. It is worth noting that the following sub-options 
+  - Usually, the conditions you designed are more than one and a few 'CASE "..."' will
+    appear in configuration file. It is worth noting that the following sub-options
     have 2 spellings:
-    One is general, where shell affects the local environment; the other is special, 
+    One is general, where shell affects the local environment; the other is special,
     where each options added "@ipaddr". It can remotely execute shell codes. In other words,
     it is to execute the shell codes from a remote host, which is meaningful when a resource
     agent needs 2 hosts. This remote shell is not a remote execution only through "ssh", but
     running a remote shell in the background while the test case is running. The remote shell
     runs in the background till the end and saves the results during the process. That is to
-    say, you can alternatively carry out local and remote shell code segments. 
-    The "CASE-BLOCK" option is a macro definer, the statements in "CASE-BLOCK" will be inserted 
+    say, you can alternatively carry out local and remote shell code segments.
+    The "CASE-BLOCK" option is a macro definer, the statements in "CASE-BLOCK" will be inserted
     into "CASE" if you "Include" the "macro_name".
 
     ** 'Env' (sub-option)
       - Grammar: Env VARIABLE=value
-      - It is to set up an environment variable of the resource agent. They usually appear to 
+      - It is to set up an environment variable of the resource agent. They usually appear to
         be OCF_RESKEY_xxx. One point is to be noted is there is no blank by both sides of "=".
 
     ** 'Unenv' (sub-option)
-      - Grammer: Unenv VARIABLE [VARIABLE2 [...]]
+      - Grammar: Unenv VARIABLE [VARIABLE2 [...]]
       - Remove the environment variable.
 
     ** 'Include' (sub-option)
-      - Garmmer: Include macro_name
-      - It will be replaced by statements in 'macro_name', of course, you should define the 
+      - Grammar: Include macro_name
+      - It will be replaced by statements in 'macro_name', of course, you should define the
         content of 'macro_name' with 'CASE-BLOCK' first.
 
     ** 'Bash' (sub-option)
       - Grammar: Bash bash_codes
-      - This option is to set up the environment of OS, where you can insert BASH code to 
-        customize the system randomly. Note, do not cause unrecoverable consequences to the 
+      - This option is to set up the environment of OS, where you can insert BASH code to
+        customize the system randomly. Note, do not cause unrecoverable consequences to the
         system.
 
     ** 'BashAtExit' (sub-option)
       - Grammar: BashAtExit bash_codes
-      - This option is to recover the OS environment in order to run another test case 
-        correctly. Of cause you can use 'Bash' option to recover it. However, if mistakes occur 
-        in the process, the script will quit directly instead of running your recovery codes. 
-        If it happens, you ought to use BashAtExit which can restore the system environment 
+      - This option is to recover the OS environment in order to run another test case
+        correctly. Of cause you can use 'Bash' option to recover it. However, if mistakes occur
+        in the process, the script will quit directly instead of running your recovery codes.
+        If it happens, you ought to use BashAtExit which can restore the system environment
         before you quit.
 
     ** 'AgentRun' (sub-option)
       - Grammar: AgentRun cmd [ret_value]
-      - This option is to run resource agent. "cmd" is the parameter of the resource agent, 
-        such as "start, status, stop ...". The second parameter is optional. It will compare the 
-        actual returned value with the expected value when the script has run recourse agent. 
+      - This option is to run resource agent. "cmd" is the parameter of the resource agent,
+        such as "start, status, stop ...". The second parameter is optional. It will compare the
+        actual returned value with the expected value when the script has run recourse agent.
         If differs, bugs will be found.
diff --git a/tools/ocft/runocft b/tools/ocft/runocft
index f66b6a4..d269a6b 100755
--- a/tools/ocft/runocft
+++ b/tools/ocft/runocft
@@ -1,3 +1,4 @@
+#!/bin/sh
 OCFTDIR=/usr/share/resource-agents/ocft
 CONFDIR=$OCFTDIR/configs
 
diff --git a/tools/tickle_tcp.c b/tools/tickle_tcp.c
index cf0bdcb..7c5a537 100644
--- a/tools/tickle_tcp.c
+++ b/tools/tickle_tcp.c
@@ -245,7 +245,7 @@ int send_tickle_ack(const sock_addr *dst,
 		ip4pkt.tcp.window   = htons(1234);
 		ip4pkt.tcp.check    = tcp_checksum((uint16_t *)&ip4pkt.tcp, sizeof(ip4pkt.tcp), &ip4pkt.ip);
 
-		s = socket(AF_INET, SOCK_RAW, htons(IPPROTO_RAW));
+		s = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
 		if (s == -1) {
 			fprintf(stderr, "Failed to open raw socket (%s)\n", strerror(errno));
 			return -1;

-- 
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