[Debian-ha-commits] [resource-agents] 01/07: New upstream version 4.1.1

Valentin Vidic vvidic-guest at moszumanska.debian.org
Wed Mar 14 19:38:04 UTC 2018


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

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

commit 2b25c2c1097a74dbe8129bb709679736f16df5c1
Author: Valentin Vidic <Valentin.Vidic at CARNet.hr>
Date:   Mon Mar 5 15:10:09 2018 +0100

    New upstream version 4.1.1
---
 .gitignore                             |   9 +-
 .travis.yml                            |   8 +
 ChangeLog                              |  32 ++
 configure.ac                           |   3 +-
 doc/dev-guides/ra-dev-guide.asc        |  21 +-
 doc/man/Makefile.am                    |   7 +
 heartbeat/AoEtarget                    |  12 +-
 heartbeat/AudibleAlarm                 |  14 +-
 heartbeat/CTDB                         |  30 +-
 heartbeat/ClusterMon                   |  10 +-
 heartbeat/Delay                        |  12 +-
 heartbeat/Dummy                        |  16 +-
 heartbeat/EvmsSCC                      |  12 +-
 heartbeat/Evmsd                        |   8 +-
 heartbeat/Filesystem                   |  20 +-
 heartbeat/ICP                          |  12 +-
 heartbeat/IPsrcaddr                    |  14 +-
 heartbeat/LVM                          |  16 +-
 heartbeat/LVM-activate                 |  93 ++--
 heartbeat/LinuxSCSI                    |  10 +-
 heartbeat/MailTo                       |  12 +-
 heartbeat/Makefile.am                  |  22 +-
 heartbeat/ManageRAID                   |  12 +-
 heartbeat/ManageVE                     |  16 +-
 heartbeat/NodeUtilization              |  20 +-
 heartbeat/README.mariadb.md            | 156 +++++++
 heartbeat/Raid1                        |  26 +-
 heartbeat/Route                        |  12 +-
 heartbeat/SAPDatabase                  |  14 +-
 heartbeat/SAPInstance                  |  22 +-
 heartbeat/SendArp                      |   4 +-
 heartbeat/ServeRAID                    |  14 +-
 heartbeat/SphinxSearchDaemon           |   4 +-
 heartbeat/Squid                        |   4 +-
 heartbeat/Stateful                     |   4 +-
 heartbeat/SysInfo                      |   2 +-
 heartbeat/VirtualDomain                |  32 +-
 heartbeat/WAS                          |  14 +-
 heartbeat/WAS6                         |  14 +-
 heartbeat/WinPopup                     |  12 +-
 heartbeat/Xen                          |  16 +-
 heartbeat/Xinetd                       |   8 +-
 heartbeat/anything                     |   6 +-
 heartbeat/apache                       |   6 +-
 heartbeat/asterisk                     |  12 +-
 heartbeat/aws-vpc-move-ip              |  12 +-
 heartbeat/aws-vpc-route53              |  10 +-
 heartbeat/awseip                       |  58 ++-
 heartbeat/awsvip                       |  46 +-
 heartbeat/azure-lb                     | 213 ++++++++++
 heartbeat/clvm                         |  12 +-
 heartbeat/conntrackd                   |  18 +-
 heartbeat/db2                          |  24 +-
 heartbeat/dhcpd                        |  12 +-
 heartbeat/dnsupdate                    |  12 +-
 heartbeat/docker                       |  10 +-
 heartbeat/eDir88                       |  10 +-
 heartbeat/exportfs                     |  10 +-
 heartbeat/fio                          |  10 +-
 heartbeat/galera                       |  32 +-
 heartbeat/garbd                        |  10 +-
 heartbeat/iSCSILogicalUnit             |  12 +-
 heartbeat/iSCSITarget                  |  12 +-
 heartbeat/ids                          |  16 +-
 heartbeat/ipsec                        |  10 +-
 heartbeat/iscsi                        |  14 +-
 heartbeat/jboss                        |   2 +-
 heartbeat/jira                         | 281 +++++++++++++
 heartbeat/kamailio                     |  14 +-
 heartbeat/lvmlockd                     |  32 +-
 heartbeat/lxc                          |  10 +-
 heartbeat/lxd-info                     | 148 +++++++
 heartbeat/machine-info                 | 149 +++++++
 heartbeat/{mysql => mariadb}           | 747 ++++++++++++++++-----------------
 heartbeat/minio                        |  10 +-
 heartbeat/{sg_persist => mpathpersist} | 292 ++++++-------
 heartbeat/mysql                        |  22 +-
 heartbeat/nagios                       |  12 +-
 heartbeat/named                        |  16 +-
 heartbeat/nfsnotify                    |  12 +-
 heartbeat/nfsserver                    |   8 +-
 heartbeat/nginx                        |   4 +-
 heartbeat/ocf-binaries.in              |   1 -
 heartbeat/ocf-shellfuncs.in            |  17 +-
 heartbeat/oraasm                       |  12 +-
 heartbeat/oracle                       |  17 +-
 heartbeat/oralsnr                      |  14 +-
 heartbeat/pgagent                      |  10 +-
 heartbeat/pgsql                        |  74 +++-
 heartbeat/pingd                        |   4 +-
 heartbeat/portblock                    |  12 +-
 heartbeat/pound                        |  12 +-
 heartbeat/rabbitmq-cluster             |  10 +-
 heartbeat/redis                        | 252 ++++++++---
 heartbeat/rkt                          |  14 +-
 heartbeat/rsyslog                      |   2 +-
 heartbeat/scsi2reservation             |  10 +-
 heartbeat/sg_persist                   |  18 +-
 heartbeat/symlink                      |  10 +-
 heartbeat/syslog-ng                    |   5 +-
 heartbeat/tomcat                       |   8 +-
 heartbeat/varnish                      |  12 +-
 heartbeat/vmware                       |  10 +-
 heartbeat/zabbixserver                 |  10 +-
 resource-agents.spec.in                |   2 +-
 rgmanager/src/resources/nfsserver.sh   |   2 +-
 tools/sfex_daemon.c                    |   6 +-
 107 files changed, 2482 insertions(+), 1207 deletions(-)

diff --git a/.gitignore b/.gitignore
index 59df506..bbff032 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,22 +37,29 @@ resource-agents-*
 .version
 
 # generated by ./autogen.sh && ./configure
+doc/man/*.7
+doc/man/*.xml
 heartbeat/ocf-binaries
 heartbeat/ocf-directories
 heartbeat/ocf-shellfuncs
+heartbeat/send_ua
 heartbeat/shellfuncs
 include/agent_config.h
 include/config.h
 include/config.h.in
 include/stamp-h1
 include/stamp-h2
+ldirectord/ldirectord
+ldirectord/ldirectord.8
 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/findif
 tools/ocf-tester
+tools/send_arp
+tools/tickle_tcp
 tools/ocft/README
 tools/ocft/README.zh_CN
 tools/ocft/caselib
diff --git a/.travis.yml b/.travis.yml
index 62ae29e..2be737b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,6 +7,14 @@ addons:
     #  - debian-sid
     packages:
       - libxml2-utils
+      - xsltproc
+      - docbook
+      - docbook-xml
+      - docbook-xsl
+      - docbook-defguide
+      - docbook-dsssl
+      - w3-recs
+      - opensp
       - shellcheck
 script:
   - ./ci/build.sh
diff --git a/ChangeLog b/ChangeLog
index 79aa6d7..4b5956f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,35 @@
+* Mon Mar  5 2018 resource-agents contributors
+- stable release 4.1.1
+- VirtualDomain: properly migrate VMs on node shutdown (bsc#1074014)
+- mpathpersist: fixed issue with reservation key parsing in status()
+- pgsql: create stats temp directory if it doesnt exist
+- pgsql: improved validation for replication mode
+
+* Mon Feb 26 2018 resource-agents contributors
+- release candidate 4.1.1 rc1
+- awseip/awsvip: improvements (incl multi NIC support)
+- Filesystem: add support for cvfs
+- redis: add support for tunneling replication traffic
+- Raid1: ignore transient devices after stopping a device
+- tomcat: fix invalid stop option
+- oracle: log warning when using using sysdba instead of "monuser"
+- crm_*: use new parameter names
+- syslog-ng: fix to make commercial version supported as well
+- lvmlockd: change lvm.conf to use lvmlockd
+- mariadb: new RA for MariaDB master/slave replication setup with GTID
+- mpathpersist: new RA
+- lxd-info/machine-info: new RAs
+- IPsrcaddr: only check for ifconfig on BSD/Solaris
+- CTDB: cope with deprecated "idmap backend" smb.conf option
+- CTDB: add new possible location for CTDB_SYSCONFIG
+- oracle: fix alter user syntax for set_mon_user_profile
+- db2: improve monitor and simplify STANDBY/.../DISCONNECTED
+- ocf-shellfuncs: fix fallback name for ocf_attribute_target()
+- CTDB: fix initial probe
+- jira: new RA
+- azure-lb: new RA
+- IPsrcaddr: match exact route to avoid failing
+
 * Tue Nov 28 2017 resource-agents contributors
 - stable release 4.1.0
 - ipsec: new RA
diff --git a/configure.ac b/configure.ac
index 703e28b..113503e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -470,7 +470,6 @@ dnl ===============================================
 PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin"
 export PATH
 
-AM_PATH_PYTHON
 AC_CHECK_PROGS(MAKE, gmake make)
 AC_PATH_PROGS(SSH, ssh, /usr/bin/ssh)
 AC_PATH_PROGS(SCP, scp, /usr/bin/scp)
@@ -910,7 +909,7 @@ dnl *****************
 AC_MSG_RESULT([])
 AC_MSG_RESULT([$PACKAGE configuration:])
 AC_MSG_RESULT([  Version                  = ${VERSION}])
-AC_MSG_RESULT([  Build Version            = 539ed604e3d6121d11fe4476d9d19e02699dd657])
+AC_MSG_RESULT([  Build Version            = 5a1edf2b9d514a6526cdc2ae7218b6e75be2583a])
 AC_MSG_RESULT([  Features                 =${PKG_FEATURES}])
 AC_MSG_RESULT([])
 AC_MSG_RESULT([  Prefix                   = ${prefix}])
diff --git a/doc/dev-guides/ra-dev-guide.asc b/doc/dev-guides/ra-dev-guide.asc
index 9fe9bfa..570855b 100644
--- a/doc/dev-guides/ra-dev-guide.asc
+++ b/doc/dev-guides/ra-dev-guide.asc
@@ -37,6 +37,15 @@ programming language. The API is not language specific. However, most
 resource agents are implemented as shell scripts, which is why this
 guide primarily uses example code written in shell language.
 
+=== Is there a naming convention?
+
+Yes! We have agreed to the following convention for resource agent
+names: Please name resource agents using lower case letters, with
+words separated by dashes (+example-agent-name+).
+
+Existing agents may or may not follow this convention, but it is the
+intention to make sure future agents follow this rule.
+
 == API definitions
 
 === Environment variables
@@ -124,7 +133,7 @@ metadata from an imaginary resource agent:
 --------------------------------------------------------------------------
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="foobar" version="0.1">
+<resource-agent name="foobar">
   <version>0.1</version>
   <longdesc lang="en">
 This is a fictitious example resource agent written for the
@@ -728,7 +737,7 @@ foobar_meta_data {
     cat <<EOF
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="foobar" version="0.1">
+<resource-agent name="foobar">
   <version>0.1</version>
   <longdesc lang="en">
 ...
@@ -1226,7 +1235,7 @@ in this example:
 
 [source,bash]
 --------------------------------------------------------------------------
-ocf_run "frobnicate --spam=eggs" || exit $OCF_ERR_GENERIC
+ocf_run frobnicate --spam=eggs || exit $OCF_ERR_GENERIC
 --------------------------------------------------------------------------
 
 With the command specified above, the resource agent will invoke
@@ -1244,7 +1253,7 @@ is nonzero.
 
 [source,bash]
 --------------------------------------------------------------------------
-ocf_run -q "frobnicate --spam=eggs" || exit $OCF_ERR_GENERIC
+ocf_run -q frobnicate --spam=eggs || exit $OCF_ERR_GENERIC
 --------------------------------------------------------------------------
 
 Finally, if the resource agent wants to log the output of a command
@@ -1253,7 +1262,7 @@ so by adding the +-info+ or +-warn+ option to +ocf_run+:
 
 [source,bash]
 --------------------------------------------------------------------------
-ocf_run -warn "frobnicate --spam=eggs"
+ocf_run -warn frobnicate --spam=eggs
 --------------------------------------------------------------------------
 
 === Locks: +ocf_take_lock+ and +ocf_release_lock_on_exit+
@@ -1307,7 +1316,7 @@ use the +ocf_is_true+ convenience function:
 [source,bash]
 --------------------------------------------------------------------------
 if ocf_is_true $OCF_RESKEY_superfrobnicate; then
-    ocf_run "frobnicate --super"
+    ocf_run frobnicate --super
 fi
 --------------------------------------------------------------------------
 
diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am
index 03cdc88..e18bd0a 100644
--- a/doc/man/Makefile.am
+++ b/doc/man/Makefile.am
@@ -100,6 +100,7 @@ man_MANS	       = ocf_heartbeat_AoEtarget.7 \
                           ocf_heartbeat_aws-vpc-route53.7 \
                           ocf_heartbeat_awseip.7 \
                           ocf_heartbeat_awsvip.7 \
+                          ocf_heartbeat_azure-lb.7 \
                           ocf_heartbeat_clvm.7 \
                           ocf_heartbeat_conntrackd.7 \
                           ocf_heartbeat_db2.7 \
@@ -120,9 +121,13 @@ man_MANS	       = ocf_heartbeat_AoEtarget.7 \
                           ocf_heartbeat_ids.7 \
                           ocf_heartbeat_iscsi.7 \
                           ocf_heartbeat_jboss.7 \
+                          ocf_heartbeat_jira.7 \
                           ocf_heartbeat_kamailio.7 \
                           ocf_heartbeat_lvmlockd.7 \
                           ocf_heartbeat_lxc.7 \
+                          ocf_heartbeat_lxd-info.7 \
+                          ocf_heartbeat_machine-info.7 \
+                          ocf_heartbeat_mariadb.7 \
                           ocf_heartbeat_mysql.7 \
                           ocf_heartbeat_mysql-proxy.7 \
                           ocf_heartbeat_nagios.7 \
@@ -133,6 +138,7 @@ man_MANS	       = ocf_heartbeat_AoEtarget.7 \
                           ocf_heartbeat_oraasm.7 \
                           ocf_heartbeat_oracle.7 \
                           ocf_heartbeat_oralsnr.7 \
+                          ocf_heartbeat_ovsmonitor.7 \
                           ocf_heartbeat_pgsql.7 \
                           ocf_heartbeat_pingd.7 \
                           ocf_heartbeat_portblock.7 \
@@ -147,6 +153,7 @@ man_MANS	       = ocf_heartbeat_AoEtarget.7 \
                           ocf_heartbeat_sfex.7 \
                           ocf_heartbeat_slapd.7 \
                           ocf_heartbeat_sg_persist.7 \
+			  ocf_heartbeat_mpathpersist.7 \
                           ocf_heartbeat_symlink.7 \
                           ocf_heartbeat_syslog-ng.7 \
                           ocf_heartbeat_tomcat.7 \
diff --git a/heartbeat/AoEtarget b/heartbeat/AoEtarget
index 176ecd0..f697181 100755
--- a/heartbeat/AoEtarget
+++ b/heartbeat/AoEtarget
@@ -101,12 +101,12 @@ Location of the vblade binary.
     </parameter>
   </parameters>
   <actions>
-    <action name="start" timeout="15"/>
-    <action name="stop" timeout="15"/>
-    <action name="monitor" timeout="15" interval="10" depth="0"/>
-    <action name="reload" timeout="15"/>
-    <action name="meta-data" timeout="5"/>
-    <action name="validate-all" timeout="15"/>
+    <action name="start" timeout="15s"/>
+    <action name="stop" timeout="15s"/>
+    <action name="monitor" timeout="15s" interval="10s" depth="0"/>
+    <action name="reload" timeout="15s"/>
+    <action name="meta-data" timeout="5s"/>
+    <action name="validate-all" timeout="15s"/>
   </actions>
 </resource-agent>
 EOF
diff --git a/heartbeat/AudibleAlarm b/heartbeat/AudibleAlarm
index d3c1149..19cb73e 100755
--- a/heartbeat/AudibleAlarm
+++ b/heartbeat/AudibleAlarm
@@ -57,13 +57,13 @@ The node list that should never sound the alarm.
 </parameters>
 
 <actions>
-<action name="start" timeout="10" />
-<action name="stop" timeout="10" />
-<action name="restart" timeout="10" />
-<action name="status" depth="0" timeout="10" interval="10" />
-<action name="monitor" depth="0" timeout="10" interval="10" />
-<action name="meta-data" timeout="5" />
-<action name="validate-all" timeout="5" />
+<action name="start" timeout="10s" />
+<action name="stop" timeout="10s" />
+<action name="restart" timeout="10s" />
+<action name="status" depth="0" timeout="10s" interval="10s" />
+<action name="monitor" depth="0" timeout="10s" interval="10s" />
+<action name="meta-data" timeout="5s" />
+<action name="validate-all" timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/CTDB b/heartbeat/CTDB
index 709dbc8..1456ea3 100755
--- a/heartbeat/CTDB
+++ b/heartbeat/CTDB
@@ -341,11 +341,11 @@ CTDB is managing Samba.
 </parameters>
 
 <actions>
-<action name="start"        timeout="90" />
-<action name="stop"         timeout="100" />
-<action name="monitor"      timeout="20" interval="10" depth="0" />
-<action name="meta-data"    timeout="5" />
-<action name="validate-all"   timeout="30" />
+<action name="start"        timeout="90s" />
+<action name="stop"         timeout="100s" />
+<action name="monitor"      timeout="20s" interval="10s" depth="0" />
+<action name="meta-data"    timeout="5s" />
+<action name="validate-all"   timeout="30s" />
 </actions>
 </resource-agent>
 END
@@ -361,6 +361,8 @@ elif [ -f /etc/default/ctdb ]; then
 	CTDB_SYSCONFIG=/etc/default/ctdb
 elif [ -f "$OCF_RESKEY_ctdb_config_dir/ctdb" ]; then
 	CTDB_SYSCONFIG=$OCF_RESKEY_ctdb_config_dir/ctdb
+elif [ -f "$OCF_RESKEY_ctdb_config_dir/ctdbd.conf" ]; then
+	CTDB_SYSCONFIG=$OCF_RESKEY_ctdb_config_dir/ctdbd.conf
 fi
 
 # Backup paths
@@ -438,7 +440,7 @@ init_smb_conf() {
 
 	# replace these things in smb.conf
 	local repl
-	repl='# CTDB-RA:|passdb backend|clustering|idmap backend|private dir|ctdbd socket'
+	repl='# CTDB-RA:|passdb backend|clustering|idmap backend|idmap config[[:space:]]*\*[[:space:]]*:[[:space:]]*backend|private dir|ctdbd socket'
 
 	local private_dir
 	[ -n "$OCF_RESKEY_smb_private_dir" ] && private_dir="\tprivate dir = $OCF_RESKEY_smb_private_dir\n"
@@ -458,6 +460,12 @@ init_smb_conf() {
 		fi
 	fi
 	# Preserve permissions of smb.conf
+	local idmap_config
+	if grep -Eqs '^[[:space:]]*idmap backend[[:space:]]*=' $OCF_RESKEY_smb_conf; then
+		idmap_config=old
+	else
+		idmap_config=new
+	fi
 	cp -a "$OCF_RESKEY_smb_conf" "$OCF_RESKEY_smb_conf.$$"
 	awk '
 		/^[[:space:]]*\[/ { global = 0 }
@@ -476,9 +484,15 @@ init_smb_conf() {
 \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.$$"
+	if [ "$idmap_config" = "old" ]; then
+		sed -i "/^[[:space:]]*clustering = yes/ a\\
+\tidmap backend = $OCF_RESKEY_smb_idmap_backend" $OCF_RESKEY_smb_conf.$$
+	else
+		sed -i "/^[[:space:]]*clustering = yes/ a\\
+\tidmap config * : backend = $OCF_RESKEY_smb_idmap_backend" $OCF_RESKEY_smb_conf.$$
+	fi
 	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"
 }
@@ -706,6 +720,8 @@ ctdb_monitor() {
 			return $OCF_NOT_RUNNING
 		elif echo "$status" | grep -qs 'No such file or directory'; then
 			return $OCF_NOT_RUNNING
+		elif echo $status | grep -qs 'connect() failed'; then
+			return $OCF_NOT_RUNNING
 		else
 			ocf_exit_reason "CTDB status call failed: $status"
 			return $OCF_ERR_GENERIC
diff --git a/heartbeat/ClusterMon b/heartbeat/ClusterMon
index 95cb860..1c48f66 100755
--- a/heartbeat/ClusterMon
+++ b/heartbeat/ClusterMon
@@ -99,11 +99,11 @@ Location to write HTML output to.
 </parameters>
 
 <actions>
-<action name="start"   timeout="20" />
-<action name="stop"    timeout="20" />
-<action name="monitor" depth="0"  timeout="20" interval="10" />
-<action name="meta-data"  timeout="5" />
-<action name="validate-all"  timeout="30" />
+<action name="start"   timeout="20s" />
+<action name="stop"    timeout="20s" />
+<action name="monitor" depth="0"  timeout="20s" interval="10s" />
+<action name="meta-data"  timeout="5s" />
+<action name="validate-all"  timeout="30s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/Delay b/heartbeat/Delay
index ab07965..10b14f9 100755
--- a/heartbeat/Delay
+++ b/heartbeat/Delay
@@ -78,12 +78,12 @@ Defaults to "startdelay" if unspecified.
 </parameters>
 
 <actions>
-<action name="start" timeout="30" />
-<action name="stop" timeout="30" />
-<action name="status" depth="0" timeout="30" interval="10" />
-<action name="monitor" depth="0" timeout="30" interval="10" />
-<action name="meta-data" timeout="5" />
-<action name="validate-all" timeout="5" />
+<action name="start" timeout="30s" />
+<action name="stop" timeout="30s" />
+<action name="status" depth="0" timeout="30s" interval="10s" />
+<action name="monitor" depth="0" timeout="30s" interval="10s" />
+<action name="meta-data" timeout="5s" />
+<action name="validate-all" timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/Dummy b/heartbeat/Dummy
index 61b442c..933694f 100755
--- a/heartbeat/Dummy
+++ b/heartbeat/Dummy
@@ -76,14 +76,14 @@ Fake attribute that can be changed to cause a reload
 </parameters>
 
 <actions>
-<action name="start"        timeout="20" />
-<action name="stop"         timeout="20" />
-<action name="monitor"      timeout="20" interval="10" depth="0" />
-<action name="reload"       timeout="20" />
-<action name="migrate_to"   timeout="20" />
-<action name="migrate_from" timeout="20" />
-<action name="meta-data"    timeout="5" />
-<action name="validate-all"   timeout="20" />
+<action name="start"        timeout="20s" />
+<action name="stop"         timeout="20s" />
+<action name="monitor"      timeout="20s" interval="10s" depth="0" />
+<action name="reload"       timeout="20s" />
+<action name="migrate_to"   timeout="20s" />
+<action name="migrate_from" timeout="20s" />
+<action name="meta-data"    timeout="5s" />
+<action name="validate-all"   timeout="20s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/EvmsSCC b/heartbeat/EvmsSCC
index 21dfc7b..00da914 100755
--- a/heartbeat/EvmsSCC
+++ b/heartbeat/EvmsSCC
@@ -79,12 +79,12 @@ If set to true, suppresses the deprecation warning for this agent.
 </parameters>
 
 <actions>
-<action name="start" timeout="60" />
-<action name="stop" timeout="60" />
-<action name="notify" timeout="60" />
-<action name="status" depth="0" timeout="10" interval="10" />
-<action name="monitor" depth="0" timeout="10" interval="10" />
-<action name="meta-data" timeout="5" />
+<action name="start" timeout="60s" />
+<action name="stop" timeout="60s" />
+<action name="notify" timeout="60s" />
+<action name="status" depth="0" timeout="10s" interval="10s" />
+<action name="monitor" depth="0" timeout="10s" interval="10s" />
+<action name="meta-data" timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/Evmsd b/heartbeat/Evmsd
index c41fd82..5d752cb 100755
--- a/heartbeat/Evmsd
+++ b/heartbeat/Evmsd
@@ -58,10 +58,10 @@ If set to true, suppresses the deprecation warning for this agent.
 </parameters>
 
 <actions>
-<action name="start"        timeout="20" />
-<action name="stop"         timeout="20" />
-<action name="monitor"      timeout="20" interval="10" depth="0" />
-<action name="meta-data"    timeout="5" />
+<action name="start"        timeout="20s" />
+<action name="stop"         timeout="20s" />
+<action name="monitor"      timeout="20s" interval="10s" depth="0" />
+<action name="meta-data"    timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/Filesystem b/heartbeat/Filesystem
index 145be49..7c73b0b 100755
--- a/heartbeat/Filesystem
+++ b/heartbeat/Filesystem
@@ -219,12 +219,12 @@ block if unresponsive nfs mounts are in use on the system.
 </parameters>
 
 <actions>
-<action name="start" timeout="60" />
-<action name="stop" timeout="60" />
-<action name="notify" timeout="60" />
-<action name="monitor" depth="0" timeout="40" interval="20" />
-<action name="validate-all" timeout="5" />
-<action name="meta-data" timeout="5" />
+<action name="start" timeout="60s" />
+<action name="stop" timeout="60s" />
+<action name="notify" timeout="60s" />
+<action name="monitor" depth="0" timeout="40s" interval="20s" />
+<action name="validate-all" timeout="5s" />
+<action name="meta-data" timeout="5s" />
 </actions>
 </resource-agent>
 END
@@ -275,7 +275,7 @@ determine_blockdevice() {
 	# Get the current real device name, if possible.
 	# (specified devname could be -L or -U...)
 	case "$FSTYPE" in
-	nfs4|nfs|smbfs|cifs|glusterfs|ceph|tmpfs|overlay|overlayfs|rozofs|zfs|none)
+	nfs4|nfs|smbfs|cifs|glusterfs|ceph|tmpfs|overlay|overlayfs|rozofs|zfs|cvfs|none)
 		: ;;
 	*)
 		DEVICE=`list_mounts | grep " $MOUNTPOINT " | cut -d' ' -f1`
@@ -326,7 +326,7 @@ is_fsck_needed() {
 		no)    false;;
 		""|auto)
 		case $FSTYPE in
-			ext4|ext4dev|ext3|reiserfs|reiser4|nss|xfs|jfs|vfat|fat|nfs4|nfs|cifs|smbfs|ocfs2|gfs2|none|lustre|glusterfs|ceph|tmpfs|overlay|overlayfs|rozofs|zfs)
+			ext4|ext4dev|ext3|reiserfs|reiser4|nss|xfs|jfs|vfat|fat|nfs4|nfs|cifs|smbfs|ocfs2|gfs2|none|lustre|glusterfs|ceph|tmpfs|overlay|overlayfs|rozofs|zfs|cvfs)
 			false;;
 			*)
 			true;;
@@ -730,7 +730,7 @@ set_blockdevice_var() {
 
 	# these are definitely not block devices
 	case $FSTYPE in
-	nfs4|nfs|smbfs|cifs|none|glusterfs|ceph|tmpfs|overlay|overlayfs|rozofs|zfs) return;;
+	nfs4|nfs|smbfs|cifs|none|glusterfs|ceph|tmpfs|overlay|overlayfs|rozofs|zfs|cvfs) return;;
 	esac
 
 	if `is_option "loop"`; then
@@ -842,7 +842,7 @@ is_option "ro" &&
 	CLUSTERSAFE=2
 
 case $FSTYPE in
-nfs4|nfs|smbfs|cifs|none|gfs2|glusterfs|ceph|ocfs2|overlay|overlayfs|tmpfs)
+nfs4|nfs|smbfs|cifs|none|gfs2|glusterfs|ceph|ocfs2|overlay|overlayfs|tmpfs|cvfs)
 	CLUSTERSAFE=1 # this is kind of safe too
 	;;
 # add here CLUSTERSAFE=0 for all filesystems which are not
diff --git a/heartbeat/ICP b/heartbeat/ICP
index 8f187e0..b43caab 100755
--- a/heartbeat/ICP
+++ b/heartbeat/ICP
@@ -86,12 +86,12 @@ The device name.
 </parameters>
 
 <actions>
-<action name="start" timeout="20" />
-<action name="stop" timeout="20" />
-<action name="status" depth="0" timeout="20" interval="10" />
-<action name="monitor" depth="0" timeout="20" interval="10" />
-<action name="validate-all" timeout="5" />
-<action name="meta-data" timeout="5" />
+<action name="start" timeout="20s" />
+<action name="stop" timeout="20s" />
+<action name="status" depth="0" timeout="20s" interval="10s" />
+<action name="monitor" depth="0" timeout="20s" interval="10s" />
+<action name="validate-all" timeout="5s" />
+<action name="meta-data" timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/IPsrcaddr b/heartbeat/IPsrcaddr
index 08fd8a6..4ca3d23 100755
--- a/heartbeat/IPsrcaddr
+++ b/heartbeat/IPsrcaddr
@@ -102,9 +102,9 @@ dotted quad notation  255.255.255.0).
 <actions>
 <action name="start" timeout="20s" />
 <action name="stop" timeout="20s" />
-<action name="monitor" depth="0" timeout="20s" interval="10" />
-<action name="validate-all" timeout="5" />
-<action name="meta-data" timeout="5" />
+<action name="monitor" depth="0" timeout="20s" interval="10s" />
+<action name="validate-all" timeout="5s" />
+<action name="meta-data" timeout="5s" />
 </actions>
 </resource-agent>
 END
@@ -400,7 +400,11 @@ srca_validate_all() {
 	fi
 
 	check_binary $AWK
-	check_binary $IFCONFIG
+	case "$SYSTYPE" in
+		*BSD|SunOS)
+			check_binary $IFCONFIG
+			;;
+	esac
 
 #	The IP address should be in good shape
 	if CheckIP "$ipaddress"; then
@@ -469,7 +473,7 @@ rc=$?
 }
 
 INTERFACE=`echo $findif_out | awk '{print $1}'`
-NETWORK=`ip route list dev $INTERFACE scope link match $ipaddress|grep -o '^[^ ]*'`
+NETWORK=`ip route list dev $INTERFACE scope link proto kernel match $ipaddress|grep -o '^[^ ]*'`
 
 case $1 in
 	start)		srca_start $ipaddress
diff --git a/heartbeat/LVM b/heartbeat/LVM
index aa1276e..d3cd1a1 100755
--- a/heartbeat/LVM
+++ b/heartbeat/LVM
@@ -106,13 +106,13 @@ logical volumes.
 </parameters>
 
 <actions>
-<action name="start" timeout="30" />
-<action name="stop" timeout="30" />
-<action name="status" timeout="30" />
-<action name="monitor" depth="0" timeout="30" interval="10" />
-<action name="methods" timeout="5" />
-<action name="meta-data" timeout="5" />
-<action name="validate-all" timeout="5" />
+<action name="start" timeout="30s" />
+<action name="stop" timeout="30s" />
+<action name="status" timeout="30s" />
+<action name="monitor" depth="0" timeout="30s" interval="10s" />
+<action name="methods" timeout="5s" />
+<action name="meta-data" timeout="5s" />
+<action name="validate-all" timeout="5s" />
 </actions>
 </resource-agent>
 EOF
@@ -217,7 +217,7 @@ LVM_start() {
 
 	# systemd drop-in to stop process before storage services during
 	# shutdown/reboot
-	if ps -p 1 | grep -q systemd ; then
+	if systemd_is_running ; then
 		systemd_drop_in "99-LVM" "After" "blk-availability.service"
 	fi
 
diff --git a/heartbeat/LVM-activate b/heartbeat/LVM-activate
index f5c1b66..60e6561 100755
--- a/heartbeat/LVM-activate
+++ b/heartbeat/LVM-activate
@@ -152,11 +152,11 @@ The tag used for tagging activation mode.
 </parameters>
 
 <actions>
-<action name="start"		timeout="90" />
-<action name="stop"		timeout="90" />
-<action name="monitor"		timeout="90" interval="30" depth="0" />
-<action name="meta-data"	timeout="10" />
-<action name="validate-all"	timeout="20" />
+<action name="start"		timeout="90s" />
+<action name="stop"		timeout="90s" />
+<action name="monitor"		timeout="90s" interval="30s" depth="0" />
+<action name="meta-data"	timeout="10s" />
+<action name="validate-all"	timeout="20s" />
 </actions>
 </resource-agent>
 END
@@ -419,6 +419,39 @@ lvm_validate() {
 	local lv_count
 	local mode
 
+	# Parameters checking
+	if [ -z "$VG" ]
+	then
+		ocf_exit_reason "You must identify the volume group name!"
+		exit $OCF_ERR_ARGS
+	fi
+
+	if [ "$LV_activation_mode" != "shared" ] && [ "$LV_activation_mode" != "exclusive" ]
+	then
+		ocf_exit_reason "Invalid value for activation_mode: $LV_activation_mode"
+		exit $OCF_ERR_ARGS
+	fi
+
+	# Convert VG_access_mode from string to index
+	case ${VG_access_mode} in
+	lvmlockd)
+		VG_access_mode=1
+		;;
+	clvmd)
+		VG_access_mode=2
+		;;
+	system_id)
+		VG_access_mode=3
+		;;
+	tagging)
+		VG_access_mode=4
+		;;
+	*)
+		ocf_exit_reason "You specified an invalid value for vg_access_mode: $VG_access_mode"
+		exit $OCF_ERR_ARGS
+		;;
+	esac
+
 	check_binary pgrep
 	# Every LVM command is just symlink to lvm binary
 	check_binary lvm
@@ -767,54 +800,10 @@ lvm_stop() {
 #
 
 case $__OCF_ACTION in
-meta-data)		meta_data
-			exit $OCF_SUCCESS
-			;;
-usage|help)		usage
-			exit $OCF_SUCCESS
-			;;
-esac
-
-# Parameters checking
-if [ -z "$VG" ]
-then
-	ocf_exit_reason "You must identify the volume group name!"
-	exit $OCF_ERR_ARGS
-fi
-
-if [ "$LV_activation_mode" != "shared" ] && [ "$LV_activation_mode" != "exclusive" ]
-then
-	ocf_exit_reason "Invalid value for activation_mode: $LV_activation_mode"
-	exit $OCF_ERR_ARGS
-fi
-
-# Convert VG_access_mode from string to index
-case ${VG_access_mode} in
-lvmlockd)
-	VG_access_mode=1
-	;;
-clvmd)
-	VG_access_mode=2
-	;;
-system_id)
-	VG_access_mode=3
-	;;
-tagging)
-	VG_access_mode=4
-	;;
-*)
-	ocf_exit_reason "You specified an invalid value for vg_access_mode: $VG_access_mode"
-	exit $OCF_ERR_ARGS
-	;;
-esac
-
-# Translate each action into the appropriate function call
-case $__OCF_ACTION in
 start)
 	lvm_validate
 	lvm_start
 	;;
-
 stop)
 	lvm_stop
 	;;
@@ -824,6 +813,12 @@ monitor)
 validate-all)
 	lvm_validate
 	;;
+meta-data)
+	meta_data
+	;;
+usage|help)
+	usage
+	;;
 *)
 	usage
 	exit $OCF_ERR_UNIMPLEMENTED
diff --git a/heartbeat/LinuxSCSI b/heartbeat/LinuxSCSI
index 89fed6b..6cf69cb 100755
--- a/heartbeat/LinuxSCSI
+++ b/heartbeat/LinuxSCSI
@@ -142,11 +142,11 @@ If set to true, suppresses the deprecation warning for this agent.
 <actions>
 <action name="start" timeout="20s" />
 <action name="stop" timeout="20s" />
-<action name="methods" timeout="5" />
-<action name="status" depth="0" timeout="20s" interval="10" />
-<action name="monitor" depth="0" timeout="20s" interval="10" />
-<action name="meta-data" timeout="5" />
-<action name="validate-all" timeout="5" />
+<action name="methods" timeout="5s" />
+<action name="status" depth="0" timeout="20s" interval="10s" />
+<action name="monitor" depth="0" timeout="20s" interval="10s" />
+<action name="meta-data" timeout="5s" />
+<action name="validate-all" timeout="5s" />
 </actions>
 </resource-agent>
 EOF
diff --git a/heartbeat/MailTo b/heartbeat/MailTo
index b2aa89b..e3a13a3 100755
--- a/heartbeat/MailTo
+++ b/heartbeat/MailTo
@@ -72,12 +72,12 @@ The subject of the email.
 </parameters>
 
 <actions>
-<action name="start" timeout="10" />
-<action name="stop" timeout="10" />
-<action name="status" depth="0" timeout="10" interval="10" />
-<action name="monitor" depth="0" timeout="10" interval="10" />
-<action name="meta-data" timeout="5" />
-<action name="validate-all" timeout="5" />
+<action name="start" timeout="10s" />
+<action name="stop" timeout="10s" />
+<action name="status" depth="0" timeout="10s" interval="10s" />
+<action name="monitor" depth="0" timeout="10s" interval="10s" />
+<action name="meta-data" timeout="5s" />
+<action name="validate-all" timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/Makefile.am b/heartbeat/Makefile.am
index 1fde5e9..200a20f 100644
--- a/heartbeat/Makefile.am
+++ b/heartbeat/Makefile.am
@@ -70,7 +70,7 @@ ocf_SCRIPTS	     =  AoEtarget		\
 			MailTo			\
 			ManageRAID		\
 			ManageVE		\
-			NodeUtilization	\
+			NodeUtilization		\
 			Pure-FTPd		\
 			Raid1			\
 			Route			\
@@ -97,6 +97,7 @@ ocf_SCRIPTS	     =  AoEtarget		\
 			aws-vpc-route53		\
 			awseip			\
 			awsvip			\
+			azure-lb		\
 			clvm			\
 			conntrackd		\
 			db2			\
@@ -114,11 +115,15 @@ ocf_SCRIPTS	     =  AoEtarget		\
 			ids			\
 			iface-bridge		\
 			iface-vlan		\
-			ipsec		\
+			ipsec			\
 			iscsi			\
 			jboss			\
+			jira			\
 			kamailio		\
 			lxc			\
+			lxd-info		\
+			machine-info		\
+			mariadb			\
 			minio			\
 			mysql			\
 			mysql-proxy		\
@@ -146,6 +151,7 @@ ocf_SCRIPTS	     =  AoEtarget		\
 			scsi2reservation	\
 			sfex			\
 			sg_persist              \
+			mpathpersist		\
 			slapd			\
 			symlink			\
 			syslog-ng		\
@@ -160,15 +166,15 @@ ocfcommon_DATA		= ocf-shellfuncs 	\
 			  ocf-binaries	 	\
 			  ocf-directories 	\
 			  ocf-returncodes 	\
- 			  ocf-rarun		\
- 			  ocf-distro		\
+			  ocf-rarun		\
+			  ocf-distro		\
 			  apache-conf.sh 	\
-			  http-mon.sh    	\
+			  http-mon.sh		\
 			  sapdb-nosha.sh	\
 			  sapdb.sh		\
-			  lvm-clvm.sh       \
-			  lvm-plain.sh      \
-			  lvm-tag.sh        \
+			  lvm-clvm.sh		\
+			  lvm-plain.sh		\
+			  lvm-tag.sh		\
 			  ora-common.sh		\
 			  mysql-common.sh	\
 			  nfsserver-redhat.sh	\
diff --git a/heartbeat/ManageRAID b/heartbeat/ManageRAID
index e56dd6a..ae1832a 100755
--- a/heartbeat/ManageRAID
+++ b/heartbeat/ManageRAID
@@ -110,12 +110,12 @@ meta_data()
   </parameters>
 
   <actions>
-    <action name="start" timeout="75" />
-    <action name="stop" timeout="75" />
-    <action name="status" depth="0" timeout="10" interval="10" />
-    <action name="monitor" depth="0" timeout="10" interval="10" />
-    <action name="validate-all" timeout="5" />
-    <action name="meta-data" timeout="5" />
+    <action name="start" timeout="75s" />
+    <action name="stop" timeout="75s" />
+    <action name="status" depth="0" timeout="10s" interval="10s" />
+    <action name="monitor" depth="0" timeout="10s" interval="10s" />
+    <action name="validate-all" timeout="5s" />
+    <action name="meta-data" timeout="5s" />
   </actions>
 </resource-agent>
 END
diff --git a/heartbeat/ManageVE b/heartbeat/ManageVE
index df0f670..b31317d 100755
--- a/heartbeat/ManageVE
+++ b/heartbeat/ManageVE
@@ -87,14 +87,14 @@ meta_data()
   </parameters>
 
   <actions>
-    <action name="start" timeout="75" />
-    <action name="stop" timeout="75" />
-    <action name="status" depth="0" timeout="10" interval="10" />
-    <action name="monitor" depth="0" timeout="10" interval="10" />
-    <action name="migrate_to" timeout="75" />
-    <action name="migrate_from" timeout="75" />
-    <action name="validate-all" timeout="5" />
-    <action name="meta-data" timeout="5" />
+    <action name="start" timeout="75s" />
+    <action name="stop" timeout="75s" />
+    <action name="status" depth="0" timeout="10s" interval="10s" />
+    <action name="monitor" depth="0" timeout="10s" interval="10s" />
+    <action name="migrate_to" timeout="75s" />
+    <action name="migrate_from" timeout="75s" />
+    <action name="validate-all" timeout="5s" />
+    <action name="meta-data" timeout="5s" />
   </actions>
 </resource-agent>
 END
diff --git a/heartbeat/NodeUtilization b/heartbeat/NodeUtilization
index 61969e6..9adadb6 100755
--- a/heartbeat/NodeUtilization
+++ b/heartbeat/NodeUtilization
@@ -100,11 +100,11 @@ If not set, the parameters will be set once when the resource instance starts.
 </parameters>
 
 <actions>
-<action name="start"   timeout="90" />
-<action name="stop"    timeout="100" />
+<action name="start"   timeout="90s" />
+<action name="stop"    timeout="100s" />
 <action name="monitor" timeout="20s" interval="60s"/>
-<action name="meta-data"  timeout="5" />
-<action name="validate-all"  timeout="30" />
+<action name="meta-data"  timeout="5s" />
+<action name="validate-all"  timeout="30s" />
 </actions>
 </resource-agent>
 END
@@ -129,10 +129,10 @@ set_utilization() {
 
     if ocf_is_true "$OCF_RESKEY_utilization_cpu"; then
         sys_cpu=$(( $(grep -c processor /proc/cpuinfo) - $OCF_RESKEY_utilization_cpu_reservation ))
-        uti_cpu=$(crm_attribute -Q -t nodes -U "$host_name" -z -n cpu 2>/dev/null)
+        uti_cpu=$(crm_attribute --quiet -t nodes --node "$host_name" -z -n cpu 2>/dev/null)
 
         if [ "$sys_cpu" != "$uti_cpu" ]; then
-            if ! crm_attribute -t nodes -U "$host_name" -z -n cpu -v $sys_cpu; then
+            if ! crm_attribute -t nodes --node "$host_name" -z -n cpu -v $sys_cpu; then
                 ocf_log err "Failed to set the cpu utilization attribute for $host_name using crm_attribute."
                 return 1
             fi
@@ -141,10 +141,10 @@ set_utilization() {
 
     if ocf_is_true "$OCF_RESKEY_utilization_host_memory"; then
         sys_mem=$(( $(awk '/MemTotal/{printf("%d\n",$2/1024);exit(0)}' /proc/meminfo) - $OCF_RESKEY_utilization_host_memory_reservation ))
-        uti_mem=$(crm_attribute -Q -t nodes -U "$host_name" -z -n host_memory 2>/dev/null)
+        uti_mem=$(crm_attribute --quiet -t nodes --node "$host_name" -z -n host_memory 2>/dev/null)
 
         if [ "$sys_mem" != "$uti_mem" ]; then
-            if ! crm_attribute -t nodes -U "$host_name" -z -n host_memory -v $sys_mem; then
+            if ! crm_attribute -t nodes --node "$host_name" -z -n host_memory -v $sys_mem; then
                 ocf_log err "Failed to set the host_memory utilization attribute for $host_name using crm_attribute."
                 return 1
             fi
@@ -153,12 +153,12 @@ set_utilization() {
 
     if ocf_is_true "$OCF_RESKEY_utilization_hv_memory"; then
         hv_mem=$(( $(Host_Total_Memory) - OCF_RESKEY_utilization_hv_memory_reservation ))
-        uti_mem=$(crm_attribute -Q -t nodes -U "$host_name" -z -n hv_memory 2>/dev/null)
+        uti_mem=$(crm_attribute --quiet -t nodes --node "$host_name" -z -n hv_memory 2>/dev/null)
 
         [ $hv_mem -lt 0 ] && hv_mem=0
 
         if [ "$hv_mem" != "$uti_mem" ]; then
-            if ! crm_attribute -t nodes -U "$host_name" -z -n hv_memory -v $hv_mem; then
+            if ! crm_attribute -t nodes --node "$host_name" -z -n hv_memory -v $hv_mem; then
                 ocf_log err "Failed to set the hv_memory utilization attribute for $host_name using crm_attribute."
                 return 1
             fi
diff --git a/heartbeat/README.mariadb.md b/heartbeat/README.mariadb.md
new file mode 100644
index 0000000..da35a03
--- /dev/null
+++ b/heartbeat/README.mariadb.md
@@ -0,0 +1,156 @@
+Setting up the MariaDB resource agent
+=====================================
+
+This resource agent requires corosync version >= 2 and mariadb version > 10.2 .
+
+Before embarking on this quest one should read the MariaDB pages on replication
+and global transaction IDs, GTID. This will greatly help in understanding what
+is going on and why.
+
+Replication: https://mariadb.com/kb/en/mariadb/setting-up-replication/
+GTID: https://mariadb.com/kb/en/mariadb/gtid/
+semi-sync: https://mariadb.com/kb/en/mariadb/semisynchronous-replication/
+
+Some reading on failures under enhanced semi-sync can be found here:
+https://jira.mariadb.org/browse/MDEV-162
+
+Part 1: MariaDB Setup
+---------------------
+
+It is best to initialize your MariaDB and do a failover before trying to use
+Pacemaker to manage MariaDB. This will both verify the MariaDB configuration
+and help you understand what is going on.
+
+###Configuration Files
+
+In your MariaDB config file for the server on node 1, place the following
+entry (replacing my_database and other names as needed):
+```
+[mariadb]
+log-bin
+server_id=1
+log-basename=master
+binlog_do_db=my_database
+```
+
+Then for each other node create the same entry, but increment the server_id.
+
+###Replication User
+
+Now create the replication user (be sure to change the password!):
+```
+GRANT ALL PRIVILEGES ON *.* TO 'slave_user'@'%' IDENTIFIED BY 'password';
+GRANT ALL PRIVILEGES ON *.* TO 'slave_user'@'localhost' IDENTIFIED BY 'password';
+```
+
+The second entry may not be necessary, but simplified other steps. Change
+user name and password as needed.
+
+
+###Intialize from a database backup
+
+Initialize all nodes from an existing backup, or create a backup from the
+first node if needed:
+
+On the current database:
+```
+mysqldump -u root --master-data --databases my_database1 my_database2 > backup.sql
+```
+
+At the top of this file is a commented out line:
+SET GLOBAL gtid_slave_pos='XXXX...'
+
+uncomment his line.
+
+On all new nodes:
+```
+mysqldump -u root < backup.sql
+```
+
+###Initialize replication
+
+Choose a node as master, in this example node1.
+
+On all slaves, execute:
+```
+RESET MASTER;
+
+CHANGE MASTER TO master_host="node1", master_port=3306, \
+       master_user="slave_user", master_password="password", \
+       master_use_gtid=current_pos;
+
+SET GLOBAL rpl_semi_sync_master_enabled='ON', rpl_semi_sync_slave_enabled='ON';
+
+START SLAVE;
+
+SHOW SLAVE STATUS\G
+```
+
+In an ideal world this will show that replication is now fully working.
+
+Once replication is working, verify the configuration by doing some updates
+and verifying that they are replicated.
+
+Now try changing the master. On each slave perform:
+```
+STOP SLAVE
+```
+
+Choose a new master, node2 in our example. On all slave nodes execute:
+```
+CHANGE MASTER TO  master_host="node2", master_port=3306, \
+       master_user="slave_user", master_password="password", \
+       master_use_gtid=current_pos;
+
+START SLAVE;
+```
+
+And again, check that replication is working and changes are synchronized.
+
+
+Part 2: Pacemaker Setup
+-----------------------
+
+This is pretty straightforward. Example is using pcs.
+
+```
+# Dump the cib
+pcs cluster cib mariadb_cfg
+
+# Create the mariadb_server resource
+pcs -f mariadb_cfg resource create mariadb_server mariadb \
+   binary="/usr/sbin/mysqld" \
+   replication_user="slave_user" \
+   replication_passwd="password" \
+   node_list="node1 node2 node3" \
+   op start timeout=120 interval=0 \
+   op stop timeout=120 interval=0 \
+   op promote timeout=120 interval=0 \
+   op demote timeout=120 interval=0 \
+   op monitor role=Master timeout=30 interval=10 \
+   op monitor role=Slave timeout=30 interval=20 \
+   op notify  timeout="60s" interval="0s"
+
+# Create the master slave resource
+pcs -f mariadb_cfg resource master msMariadb mariadb_server \
+    master-max=1 master-node-max=1 clone-max=3 clone-node-max=1 notify=true
+
+# Avoid running this on some nodes, only if needed
+pcs -f mariadb_cfg constraint location msMariadb avoids \
+    node4=INFINITY node5=INFINITY
+
+# Push the cib
+pcs cluster cib-push mariadb_cfg
+```
+
+You should now have a running MariaDB cluster:
+```
+pcs status
+
+...
+ Master/Slave Set: msMariadb [mariadb_server]
+      Masters: [ node1 ]
+      Slaves: [ node2 node3 ]
+...
+```
+
diff --git a/heartbeat/Raid1 b/heartbeat/Raid1
index c7a0d76..1b9213a 100755
--- a/heartbeat/Raid1
+++ b/heartbeat/Raid1
@@ -137,10 +137,10 @@ Only set this to "true" if you know what you are doing!
 <actions>
 <action name="start" timeout="20s" />
 <action name="stop" timeout="20s" />
-<action name="status" depth="0" timeout="20s" interval="10" />
-<action name="monitor" depth="0" timeout="20s" interval="10" />
-<action name="validate-all" timeout="5" />
-<action name="meta-data" timeout="5" />
+<action name="status" depth="0" timeout="20s" interval="10s" />
+<action name="monitor" depth="0" timeout="20s" interval="10s" />
+<action name="validate-all" timeout="5s" />
+<action name="meta-data" timeout="5s" />
 </actions>
 </resource-agent>
 END
@@ -246,7 +246,7 @@ mknod_raid1_stop() {
 	rm -f $tmp_block_file
 	ocf_log info "block device file $1 missing, creating one in order to stop the array"
 	mknod $tmp_block_file b 9 $n
-	$MDADM --stop $tmp_block_file --config=$RAIDCONF --wait-clean -W
+	$MDADM --stop $tmp_block_file --config=$RAIDCONF
 	rc=$?
 	rm -f $tmp_block_file
 	return $rc
@@ -254,12 +254,12 @@ mknod_raid1_stop() {
 raid1_stop_one() {
 	ocf_log info "Stopping array $1"
 	if [ -b "$1" ]; then
-		$MDADM --stop $1 --config=$RAIDCONF --wait-clean -W &&
+		$MDADM --stop $1 --config=$RAIDCONF &&
 			return
 	else
 		# newer mdadm releases can stop arrays when given the
 		# basename; try that first
-		$MDADM --stop `basename $1` --config=$RAIDCONF --wait-clean -W &&
+		$MDADM --stop `basename $1` --config=$RAIDCONF &&
 			return
 		# otherwise create a block device file
 		mknod_raid1_stop $1
@@ -384,8 +384,16 @@ raid1_monitor_one() {
 		2)	ocf_exit_reason "$mddev has failed."
 			return $OCF_ERR_GENERIC
 			;;
-		4)	ocf_exit_reason "mdadm failed on $mddev."
-			return $OCF_ERR_GENERIC
+		4)
+			if [ "$__OCF_ACTION" = "stop" ] ; then
+				# There may be a transient invalid device after
+				# we stop MD due to uevent processing, the
+				# original device is stopped though.
+				return $OCF_NOT_RUNNING
+			else
+				ocf_exit_reason "mdadm failed on $mddev."
+				return $OCF_ERR_GENERIC
+			fi
 			;;
 		*)	ocf_exit_reason "mdadm returned an unknown result ($rc)."
 			return $OCF_ERR_GENERIC
diff --git a/heartbeat/Route b/heartbeat/Route
index 0a446ad..42010f8 100755
--- a/heartbeat/Route
+++ b/heartbeat/Route
@@ -138,13 +138,13 @@ detect   Detect from 'destination' address.
 </parameters>
 
 <actions>
-<action name="start"        timeout="20" />
-<action name="stop"         timeout="20" />
-<action name="monitor"      timeout="20" interval="10" 
+<action name="start"        timeout="20s" />
+<action name="stop"         timeout="20s" />
+<action name="monitor"      timeout="20s" interval="10s" 
                             depth="0"/>
-<action name="reload"       timeout="20" />
-<action name="meta-data"    timeout="5" />
-<action name="validate-all" timeout="20" />
+<action name="reload"       timeout="20s" />
+<action name="meta-data"    timeout="5s" />
+<action name="validate-all" timeout="20s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/SAPDatabase b/heartbeat/SAPDatabase
index d803df9..a45f45d 100755
--- a/heartbeat/SAPDatabase
+++ b/heartbeat/SAPDatabase
@@ -189,13 +189,13 @@ Usually you can leave this empty. Then the default: /usr/sap/hostctrl/exe is use
 </parameters>
 
 <actions>
-<action name="start" timeout="1800" />
-<action name="stop" timeout="1800" />
-<action name="status" timeout="60" />
-<action name="monitor" depth="0" timeout="60" interval="120" />
-<action name="validate-all" timeout="5" />
-<action name="meta-data" timeout="5" />
-<action name="methods" timeout="5" />
+<action name="start" timeout="1800s" />
+<action name="stop" timeout="1800s" />
+<action name="status" timeout="60s" />
+<action name="monitor" depth="0" timeout="60s" interval="120s" />
+<action name="validate-all" timeout="5s" />
+<action name="meta-data" timeout="5s" />
+<action name="methods" timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/SAPInstance b/heartbeat/SAPInstance
index 7746b52..d125cfe 100755
--- a/heartbeat/SAPInstance
+++ b/heartbeat/SAPInstance
@@ -214,17 +214,17 @@ The name of the SAP START profile. Specify this parameter, if you have changed t
 </parameters>
 
 <actions>
-<action name="start" timeout="180" />
-<action name="stop" timeout="240" />
-<action name="status" timeout="60" />
-<action name="monitor" depth="0" timeout="60" interval="120" />
-<action name="monitor" depth="0" timeout="60" interval="121" role="Slave" />
-<action name="monitor" depth="0" timeout="60" interval="119" role="Master" />
-<action name="promote" timeout="320" />
-<action name="demote" timeout="320" />
-<action name="validate-all" timeout="5" />
-<action name="meta-data" timeout="5" />
-<action name="methods" timeout="5" />
+<action name="start" timeout="180s" />
+<action name="stop" timeout="240s" />
+<action name="status" timeout="60s" />
+<action name="monitor" depth="0" timeout="60s" interval="120s" />
+<action name="monitor" depth="0" timeout="60s" interval="121s" role="Slave" />
+<action name="monitor" depth="0" timeout="60s" interval="119s" role="Master" />
+<action name="promote" timeout="320s" />
+<action name="demote" timeout="320s" />
+<action name="validate-all" timeout="5s" />
+<action name="meta-data" timeout="5s" />
+<action name="methods" timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/SendArp b/heartbeat/SendArp
index dbcc7dc..a410948 100755
--- a/heartbeat/SendArp
+++ b/heartbeat/SendArp
@@ -116,8 +116,8 @@ sending ARPs succeeded.
 <actions>
 <action name="start"   timeout="20s" />
 <action name="stop"    timeout="20s" />
-<action name="monitor" depth="0"  timeout="20" interval="10" />
-<action name="meta-data"  timeout="5" />
+<action name="monitor" depth="0"  timeout="20s" interval="10s" />
+<action name="meta-data"  timeout="5s" />
 <action name="validate-all"  timeout="20s" />
 </actions>
 </resource-agent>
diff --git a/heartbeat/ServeRAID b/heartbeat/ServeRAID
index 4308813..395e3d0 100755
--- a/heartbeat/ServeRAID
+++ b/heartbeat/ServeRAID
@@ -136,13 +136,13 @@ The logical drive under consideration.
 </parameters>
 
 <actions>
-<action name="start" timeout="40" />
-<action name="stop" timeout="40" />
-<action name="status" depth="0" timeout="20" interval="10" />
-<action name="monitor" depth="0" timeout="20" interval="10" />
-<action name="validate-all" timeout="5" />
-<action name="meta-data" timeout="5" />
-<action name="methods" timeout="5" />
+<action name="start" timeout="40s" />
+<action name="stop" timeout="40s" />
+<action name="status" depth="0" timeout="20s" interval="10s" />
+<action name="monitor" depth="0" timeout="20s" interval="10s" />
+<action name="validate-all" timeout="5s" />
+<action name="meta-data" timeout="5s" />
+<action name="methods" timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/SphinxSearchDaemon b/heartbeat/SphinxSearchDaemon
index b507ea0..ad7bc98 100755
--- a/heartbeat/SphinxSearchDaemon
+++ b/heartbeat/SphinxSearchDaemon
@@ -89,8 +89,8 @@ is able to query its indices and respond properly.
 <actions>
 <action name="start"        timeout="20s" />
 <action name="stop"         timeout="20s" />
-<action name="monitor"      timeout="20" interval="10" depth="0" />
-<action name="meta-data"    timeout="5" />
+<action name="monitor"      timeout="20s" interval="10s" depth="0" />
+<action name="meta-data"    timeout="5s" />
 <action name="validate-all"   timeout="20s" />
 </actions>
 </resource-agent>
diff --git a/heartbeat/Squid b/heartbeat/Squid
index 1f93f0a..6b7e04c 100755
--- a/heartbeat/Squid
+++ b/heartbeat/Squid
@@ -157,10 +157,10 @@ the configuration file given by "syslog_ng_conf" as a basename part,
 <actions>
 <action name="start" timeout="60s" />
 <action name="stop" timeout="120s" />
-<action name="status" timeout="60" />
+<action name="status" timeout="60s" />
 <action name="monitor" depth="0" timeout="30s" interval="10s" />
 <action name="meta-data" timeout="5s" />
-<action name="validate-all"  timeout="5"/>
+<action name="validate-all"  timeout="5s"/>
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/Stateful b/heartbeat/Stateful
index 2e2608f..809db4d 100755
--- a/heartbeat/Stateful
+++ b/heartbeat/Stateful
@@ -63,8 +63,8 @@ Location to store the resource state in
 <action name="stop"    timeout="20s" />
 <action name="promote"    timeout="20s" />
 <action name="demote"    timeout="20s" />
-<action name="monitor" depth="0"  timeout="20" interval="10"/>
-<action name="meta-data"  timeout="5" />
+<action name="monitor" depth="0"  timeout="20s" interval="10s"/>
+<action name="meta-data"  timeout="5s" />
 <action name="validate-all"  timeout="20s" />
 </actions>
 </resource-agent>
diff --git a/heartbeat/SysInfo b/heartbeat/SysInfo
index d33c868..92289fe 100755
--- a/heartbeat/SysInfo
+++ b/heartbeat/SysInfo
@@ -96,7 +96,7 @@ Units:
 <action name="start"   timeout="20s" />
 <action name="stop"    timeout="20s" />
 <action name="monitor" timeout="20s" interval="60s"/>
-<action name="meta-data"  timeout="5" />
+<action name="meta-data"  timeout="5s" />
 <action name="validate-all"  timeout="20s" />
 </actions>
 </resource-agent>
diff --git a/heartbeat/VirtualDomain b/heartbeat/VirtualDomain
index b974466..86fd36d 100755
--- a/heartbeat/VirtualDomain
+++ b/heartbeat/VirtualDomain
@@ -287,14 +287,14 @@ Instruct virsh to use specific shutdown mode
 </parameters>
 
 <actions>
-<action name="start" timeout="90" />
-<action name="stop" timeout="90" />
-<action name="status" depth="0" timeout="30" interval="10" />
-<action name="monitor" depth="0" timeout="30" interval="10" />
-<action name="migrate_from" timeout="60" />
-<action name="migrate_to" timeout="120" />
-<action name="meta-data" timeout="5" />
-<action name="validate-all" timeout="5" />
+<action name="start" timeout="90s" />
+<action name="stop" timeout="90s" />
+<action name="status" depth="0" timeout="30s" interval="10s" />
+<action name="monitor" depth="0" timeout="30s" interval="10s" />
+<action name="migrate_from" timeout="60s" />
+<action name="migrate_to" timeout="120s" />
+<action name="meta-data" timeout="5s" />
+<action name="validate-all" timeout="5s" />
 </actions>
 </resource-agent>
 EOF
@@ -518,6 +518,14 @@ VirtualDomain_start() {
 		return $OCF_SUCCESS
 	fi
 
+	# systemd drop-in to stop domain before libvirtd terminates services
+	# during shutdown/reboot
+	if systemd_is_running ; then
+		systemd_drop_in "99-VirtualDomain-libvirt" "After" "libvirtd.service"
+		systemd_drop_in "99-VirtualDomain-machines" "Wants" "virt-guest-shutdown.target"
+		systemctl start virt-guest-shutdown.target
+	fi
+
 	snapshotimage="$OCF_RESKEY_snapshot/${DOMAIN_NAME}.state"
 	if [ -n "$OCF_RESKEY_snapshot" -a -f "$snapshotimage" ]; then
 		virsh restore $snapshotimage
@@ -824,6 +832,14 @@ VirtualDomain_migrate_to() {
 }
 
 VirtualDomain_migrate_from() {
+	# systemd drop-in to stop domain before libvirtd terminates services
+	# during shutdown/reboot
+	if systemd_is_running ; then
+		systemd_drop_in "99-VirtualDomain-libvirt" "After" "libvirtd.service"
+		systemd_drop_in "99-VirtualDomain-machines" "Wants" "virt-guest-shutdown.target"
+		systemctl start virt-guest-shutdown.target
+	fi
+
 	while ! VirtualDomain_monitor; do
 		sleep 1
 	done
diff --git a/heartbeat/WAS b/heartbeat/WAS
index 3c74693..3d9831d 100755
--- a/heartbeat/WAS
+++ b/heartbeat/WAS
@@ -133,13 +133,13 @@ The WAS-(snoop)-port-number.
 </parameters>
 
 <actions>
-<action name="start" timeout="300" />
-<action name="stop" timeout="300" />
-<action name="status" depth="0" timeout="30" interval="10" />
-<action name="monitor" depth="0" timeout="30" interval="10" />
-<action name="validate-all" timeout="5" />
-<action name="meta-data" timeout="5" />
-<action name="methods" timeout="5" />
+<action name="start" timeout="300s" />
+<action name="stop" timeout="300s" />
+<action name="status" depth="0" timeout="30s" interval="10s" />
+<action name="monitor" depth="0" timeout="30s" interval="10s" />
+<action name="validate-all" timeout="5s" />
+<action name="meta-data" timeout="5s" />
+<action name="methods" timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/WAS6 b/heartbeat/WAS6
index b3e7e22..8f5f287 100755
--- a/heartbeat/WAS6
+++ b/heartbeat/WAS6
@@ -107,13 +107,13 @@ The WAS profile name.
 </parameters>
 
 <actions>
-<action name="start" timeout="300" />
-<action name="stop" timeout="300" />
-<action name="status" depth="0" timeout="30" interval="10" />
-<action name="monitor" depth="0" timeout="30" interval="10" />
-<action name="validate-all" timeout="5" />
-<action name="meta-data" timeout="5" />
-<action name="methods" timeout="5" />
+<action name="start" timeout="300s" />
+<action name="stop" timeout="300s" />
+<action name="status" depth="0" timeout="30s" interval="10s" />
+<action name="monitor" depth="0" timeout="30s" interval="10s" />
+<action name="validate-all" timeout="5s" />
+<action name="meta-data" timeout="5s" />
+<action name="methods" timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/WinPopup b/heartbeat/WinPopup
index 0d3f00e..833d592 100755
--- a/heartbeat/WinPopup
+++ b/heartbeat/WinPopup
@@ -56,12 +56,12 @@ The file containing the hosts to send WinPopup messages to.
 </parameters>
 
 <actions>
-<action name="start" timeout="30" />
-<action name="stop" timeout="30" />
-<action name="status" depth="0" timeout="10" interval="10" />
-<action name="monitor" depth="0" timeout="10" interval="10" />
-<action name="validate-all" timeout="5" />
-<action name="meta-data" timeout="5" />
+<action name="start" timeout="30s" />
+<action name="stop" timeout="30s" />
+<action name="status" depth="0" timeout="10s" interval="10s" />
+<action name="monitor" depth="0" timeout="10s" interval="10s" />
+<action name="validate-all" timeout="5s" />
+<action name="meta-data" timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/Xen b/heartbeat/Xen
index 92291ee..18a982b 100755
--- a/heartbeat/Xen
+++ b/heartbeat/Xen
@@ -168,13 +168,13 @@ add this parameter with a list of scripts to monitor.
 </parameters>
 
 <actions>
-<action name="start" timeout="60" />
-<action name="stop" timeout="40" />
-<action name="migrate_from" timeout="120" />
-<action name="migrate_to" timeout="120" />
-<action name="monitor" depth="0" timeout="30" interval="10" />
-<action name="meta-data" timeout="5" />
-<action name="validate-all" timeout="5" />
+<action name="start" timeout="60s" />
+<action name="stop" timeout="40s" />
+<action name="migrate_from" timeout="120s" />
+<action name="migrate_to" timeout="120s" />
+<action name="monitor" depth="0" timeout="30s" interval="10s" />
+<action name="meta-data" timeout="5s" />
+<action name="validate-all" timeout="5s" />
 </actions>
 </resource-agent>
 END
@@ -434,7 +434,7 @@ Xen_Migrate_To() {
 		ocf_log info "$DOMAIN_NAME: Starting $xentool migrate to $target_node"
 
 		if [ -n "$target_attr" ]; then
-			nodevalue=`crm_attribute --type nodes --node-uname $target_node --attr-name $target_attr --get-value -q`
+			nodevalue=`crm_attribute --type nodes --node $target_node -n $target_attr -G -q`
 			if [ -n "${nodevalue}" -a "${nodevalue}" != "(null)" ]; then
 				target_addr="$nodevalue"
 				ocf_log info "$DOMAIN_NAME: $target_node is using address $target_addr"
diff --git a/heartbeat/Xinetd b/heartbeat/Xinetd
index 78d021e..4ab44c9 100755
--- a/heartbeat/Xinetd
+++ b/heartbeat/Xinetd
@@ -66,10 +66,10 @@ The name of the service managed by xinetd.
 <action name="start" timeout="20s" />
 <action name="stop" timeout="20s" />
 <action name="restart" timeout="20s" />
-<action name="status" depth="0" timeout="10" interval="10" />
-<action name="monitor" depth="0" timeout="10" interval="10" />
-<action name="validate-all" timeout="5" />
-<action name="meta-data" timeout="5" />
+<action name="status" depth="0" timeout="10s" interval="10s" />
+<action name="monitor" depth="0" timeout="10s" interval="10s" />
+<action name="validate-all" timeout="5s" />
+<action name="meta-data" timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/anything b/heartbeat/anything
index fbf8d2c..d8f4d2d 100755
--- a/heartbeat/anything
+++ b/heartbeat/anything
@@ -296,9 +296,9 @@ before sending kill -SIGKILL. Defaults to 2/3 of the stop operation timeout.
 <actions>
 <action name="start"   timeout="20s" />
 <action name="stop"    timeout="20s" />
-<action name="monitor" depth="0"  timeout="20s" interval="10" />
-<action name="meta-data"  timeout="5" />
-<action name="validate-all"  timeout="5" />
+<action name="monitor" depth="0"  timeout="20s" interval="10s" />
+<action name="meta-data"  timeout="5s" />
+<action name="validate-all"  timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/apache b/heartbeat/apache
index 3b14dcb..fd8ea34 100755
--- a/heartbeat/apache
+++ b/heartbeat/apache
@@ -595,9 +595,9 @@ that doesn't work set this to true to enforce IPv6.
 <action name="start"   timeout="40s" />
 <action name="stop"    timeout="60s" />
 <action name="status"  timeout="30s" />
-<action name="monitor" depth="0"  timeout="20s" interval="10" />
-<action name="meta-data"  timeout="5" />
-<action name="validate-all"  timeout="5" />
+<action name="monitor" depth="0"  timeout="20s" interval="10s" />
+<action name="meta-data"  timeout="5s" />
+<action name="validate-all"  timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/asterisk b/heartbeat/asterisk
index c6586a3..ecb108a 100755
--- a/heartbeat/asterisk
+++ b/heartbeat/asterisk
@@ -178,12 +178,12 @@ If unset, the agent does no SIP URI monitoring.
 </parameters>
 
 <actions>
-<action name="start" timeout="20" />
-<action name="stop" timeout="20" />
-<action name="status" timeout="20" />
-<action name="monitor" timeout="30" interval="20" />
-<action name="validate-all" timeout="5" />
-<action name="meta-data" timeout="5" />
+<action name="start" timeout="20s" />
+<action name="stop" timeout="20s" />
+<action name="status" timeout="20s" />
+<action name="monitor" timeout="30s" interval="20s" />
+<action name="validate-all" timeout="5s" />
+<action name="meta-data" timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/aws-vpc-move-ip b/heartbeat/aws-vpc-move-ip
index 30ea106..cefa38e 100755
--- a/heartbeat/aws-vpc-move-ip
+++ b/heartbeat/aws-vpc-move-ip
@@ -66,7 +66,7 @@ cat <<END
 Resource Agent to move IP addresses within a VPC of the Amazon Webservices EC2
 by changing an entry in an specific routing table
 </longdesc>
-<shortdesc lang="en">Move IP within a APC of the AWS EC2</shortdesc>
+<shortdesc lang="en">Move IP within a VPC of the AWS EC2</shortdesc>
 
 <parameters>
 <parameter name="awscli">
@@ -119,11 +119,11 @@ Enable enhanced monitoring using AWS API calls to check route table entry
 </parameters>
 
 <actions>
-<action name="start" timeout="180" />
-<action name="stop" timeout="180" />
-<action name="monitor" depth="0" timeout="30" interval="60" />
-<action name="validate-all" timeout="5" />
-<action name="meta-data" timeout="5" />
+<action name="start" timeout="180s" />
+<action name="stop" timeout="180s" />
+<action name="monitor" depth="0" timeout="30s" interval="60s" />
+<action name="validate-all" timeout="5s" />
+<action name="meta-data" timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/aws-vpc-route53 b/heartbeat/aws-vpc-route53
index ff44bf7..59cb672 100755
--- a/heartbeat/aws-vpc-route53
+++ b/heartbeat/aws-vpc-route53
@@ -142,11 +142,11 @@ output has to be "text".
 </parameter>
 </parameters>
 <actions>
-<action name="start" timeout="180" />
-<action name="stop" timeout="180" />
-<action name="monitor" depth="0" timeout="180" interval="300" />
-<action name="validate-all" timeout="5" />
-<action name="meta-data" timeout="5" />
+<action name="start" timeout="180s" />
+<action name="stop" timeout="180s" />
+<action name="monitor" depth="0" timeout="180s" interval="300s" />
+<action name="validate-all" timeout="5s" />
+<action name="meta-data" timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/awseip b/heartbeat/awseip
index 6b5fc5f..4bb29c9 100755
--- a/heartbeat/awseip
+++ b/heartbeat/awseip
@@ -43,9 +43,11 @@
 # Defaults
 #
 OCF_RESKEY_awscli_default="/usr/bin/aws"
-OCF_RESKEY_api_delay_default="1"
+OCF_RESKEY_profile_default="default"
+OCF_RESKEY_api_delay_default="3"
 
 : ${OCF_RESKEY_awscli=${OCF_RESKEY_awscli_default}}
+: ${OCF_RESKEY_profile=${OCF_RESKEY_profile_default}}
 : ${OCF_RESKEY_api_delay=${OCF_RESKEY_api_delay_default}}
 
 meta_data() {
@@ -76,6 +78,14 @@ command line tools for aws services
 <content type="string" default="${OCF_RESKEY_awscli_default}" />
 </parameter>
 
+<parameter name="profile">
+<longdesc lang="en">
+Valid AWS CLI profile name (see ~/.aws/config and 'aws configure')
+</longdesc>
+<shortdesc lang="en">profile name</shortdesc>
+<content type="string" default="${OCF_RESKEY_profile_default}" />
+</parameter>
+
 <parameter name="elastic_ip" unique="1" required="1">
 <longdesc lang="en">
 reserved elastic ip for ec2 instance
@@ -111,15 +121,14 @@ a short delay between API calls, to avoid sending API too quick
 </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" />
+<action name="start"        timeout="30s" />
+<action name="stop"         timeout="30s" />
+<action name="monitor"      timeout="30s" interval="20s" depth="0" />
+<action name="migrate_to"   timeout="30s" />
+<action name="migrate_from" timeout="30s" />
+<action name="meta-data"    timeout="5s" />
+<action name="validate"     timeout="10s" />
+<action name="validate-all" timeout="10s" />
 </actions>
 </resource-agent>
 END
@@ -139,14 +148,21 @@ awseip_start() {
     awseip_monitor && return $OCF_SUCCESS
 
     if [ -n "${PRIVATE_IP_ADDRESS}" ]; then
-        $AWSCLI ec2 associate-address  \
-            --instance-id ${INSTANCE_ID} \
+        NETWORK_INTERFACES_MACS="$(curl -s http://169.254.169.254/latest/meta-data/network/interfaces/macs/)"
+        for MAC in ${NETWORK_INTERFACES_MACS}; do
+            curl -s http://169.254.169.254/latest/meta-data/network/interfaces/macs/${MAC}/local-ipv4s |
+                grep -q "^${PRIVATE_IP_ADDRESS}$"
+            if [ $? -eq 0 ]; then
+                NETWORK_ID="$(curl -s http://169.254.169.254/latest/meta-data/network/interfaces/macs/${MAC}/interface-id)"
+            fi
+        done
+        $AWSCLI --profile $OCF_RESKEY_profile ec2 associate-address  \
             --network-interface-id ${NETWORK_ID} \
             --allocation-id ${ALLOCATION_ID} \
             --private-ip-address ${PRIVATE_IP_ADDRESS}
         RET=$?
     else
-        $AWSCLI ec2 associate-address  \
+        $AWSCLI --profile $OCF_RESKEY_profile ec2 associate-address  \
             --instance-id ${INSTANCE_ID} \
             --allocation-id ${ALLOCATION_ID}
         RET=$?
@@ -159,16 +175,16 @@ awseip_start() {
         return $OCF_NOT_RUNNING
     fi
 
-    ocf_log info "elastic_ip have been successfully bring up (${ELASTIC_IP})"
+    ocf_log info "elastic_ip has been successfully brought up (${ELASTIC_IP})"
     return $OCF_SUCCESS
 }
 
 awseip_stop() {
     awseip_monitor || return $OCF_SUCCESS
 
-    ASSOCIATION_ID=$($AWSCLI ec2 describe-addresses \
+    ASSOCIATION_ID=$($AWSCLI --profile $OCF_RESKEY_profile --output json ec2 describe-addresses \
                          --allocation-id ${ALLOCATION_ID} | grep -m 1 "AssociationId" | awk -F'"' '{print$4}')
-    $AWSCLI ec2 disassociate-address  \
+    $AWSCLI --profile $OCF_RESKEY_profile ec2 disassociate-address  \
         --association-id ${ASSOCIATION_ID}
     RET=$?
 
@@ -179,12 +195,12 @@ awseip_stop() {
         return $OCF_NOT_RUNNING
     fi
 
-    ocf_log info "elastic_ip have been successfully bring down (${ELASTIC_IP})"
+    ocf_log info "elastic_ip has been successfully brought down (${ELASTIC_IP})"
     return $OCF_SUCCESS
 }
 
 awseip_monitor() {
-    $AWSCLI ec2 describe-instances --instance-id "${INSTANCE_ID}" | grep -q "${ELASTIC_IP}"
+    $AWSCLI --profile $OCF_RESKEY_profile ec2 describe-instances --instance-id "${INSTANCE_ID}" | grep -q "${ELASTIC_IP}"
     RET=$?
 
     if [ $RET -ne 0 ]; then
@@ -196,6 +212,11 @@ awseip_monitor() {
 awseip_validate() {
     check_binary ${AWSCLI}
 
+    if [ -z "$OCF_RESKEY_profile" ]; then
+        ocf_exit_reason "profile parameter not set"
+        return $OCF_ERR_CONFIGURED
+    fi
+
     if [ -z "${INSTANCE_ID}" ]; then
         ocf_exit_reason "instance_id not found. Is this a EC2 instance?"
         return $OCF_ERR_GENERIC
@@ -216,7 +237,6 @@ 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)
diff --git a/heartbeat/awsvip b/heartbeat/awsvip
index f36ad45..4481784 100755
--- a/heartbeat/awsvip
+++ b/heartbeat/awsvip
@@ -43,9 +43,11 @@
 # Defaults
 #
 OCF_RESKEY_awscli_default="/usr/bin/aws"
-OCF_RESKEY_api_delay_default="1"
+OCF_RESKEY_profile_default="default"
+OCF_RESKEY_api_delay_default="3"
 
 : ${OCF_RESKEY_awscli=${OCF_RESKEY_awscli_default}}
+: ${OCF_RESKEY_profile=${OCF_RESKEY_profile_default}}
 : ${OCF_RESKEY_api_delay=${OCF_RESKEY_api_delay_default}}
 
 meta_data() {
@@ -76,6 +78,14 @@ command line tools for aws services
 <content type="string" default="${OCF_RESKEY_awscli_default}" />
 </parameter>
 
+<parameter name="profile">
+<longdesc lang="en">
+Valid AWS CLI profile name (see ~/.aws/config and 'aws configure')
+</longdesc>
+<shortdesc lang="en">profile name</shortdesc>
+<content type="string" default="${OCF_RESKEY_profile_default}" />
+</parameter>
+
 <parameter name="secondary_private_ip" unique="1" required="1">
 <longdesc lang="en">
 reserved secondary private ip for ec2 instance
@@ -95,15 +105,14 @@ a short delay between API calls, to avoid sending API too quick
 </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" />
+<action name="start"        timeout="30s" />
+<action name="stop"         timeout="30s" />
+<action name="monitor"      timeout="30s" interval="20s" depth="0" />
+<action name="migrate_to"   timeout="30s" />
+<action name="migrate_from" timeout="30s" />
+<action name="meta-data"    timeout="5s" />
+<action name="validate"     timeout="10s" />
+<action name="validate-all" timeout="10s" />
 </actions>
 </resource-agent>
 END
@@ -122,7 +131,7 @@ END
 awsvip_start() {
     awsvip_monitor && return $OCF_SUCCESS
 
-    $AWSCLI ec2 assign-private-ip-addresses \
+    $AWSCLI --profile $OCF_RESKEY_profile ec2 assign-private-ip-addresses \
         --network-interface-id ${NETWORK_ID} \
         --private-ip-addresses ${SECONDARY_PRIVATE_IP} \
         --allow-reassignment
@@ -135,14 +144,14 @@ awsvip_start() {
         return $OCF_NOT_RUNNING
     fi
 
-    ocf_log info "secondary_private_ip have been successfully bring up (${SECONDARY_PRIVATE_IP})"
+    ocf_log info "secondary_private_ip has been successfully brought up (${SECONDARY_PRIVATE_IP})"
     return $OCF_SUCCESS
 }
 
 awsvip_stop() {
     awsvip_monitor || return $OCF_SUCCESS
 
-    $AWSCLI ec2 unassign-private-ip-addresses \
+    $AWSCLI --profile $OCF_RESKEY_profile ec2 unassign-private-ip-addresses \
         --network-interface-id ${NETWORK_ID} \
         --private-ip-addresses ${SECONDARY_PRIVATE_IP}
     RET=$?
@@ -154,12 +163,12 @@ awsvip_stop() {
         return $OCF_NOT_RUNNING
     fi
 
-    ocf_log info "secondary_private_ip have been successfully bring down (${SECONDARY_PRIVATE_IP})"
+    ocf_log info "secondary_private_ip has been successfully brought down (${SECONDARY_PRIVATE_IP})"
     return $OCF_SUCCESS
 }
 
 awsvip_monitor() {
-    $AWSCLI ec2 describe-instances --instance-id "${INSTANCE_ID}" | grep -q "${SECONDARY_PRIVATE_IP}"
+    $AWSCLI --profile $OCF_RESKEY_profile ec2 describe-instances --instance-id "${INSTANCE_ID}" | grep -q "${SECONDARY_PRIVATE_IP}"
     RET=$?
 
     if [ $RET -ne 0 ]; then
@@ -171,6 +180,11 @@ awsvip_monitor() {
 awsvip_validate() {
     check_binary ${AWSCLI}
 
+    if [ -z "$OCF_RESKEY_profile" ]; then
+        ocf_exit_reason "profile parameter not set"
+        return $OCF_ERR_CONFIGURED
+    fi
+
     if [ -z "${INSTANCE_ID}" ]; then
         ocf_exit_reason "instance_id not found. Is this a EC2 instance?"
         return $OCF_ERR_GENERIC
@@ -189,7 +203,7 @@ esac
 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}')"
+NETWORK_ID="$($AWSCLI --profile $OCF_RESKEY_profile --output json ec2 describe-instances --instance-id ${INSTANCE_ID} | grep -m 1 'eni' | awk -F'"' '{print$4}')"
 
 case $__OCF_ACTION in
     start)
diff --git a/heartbeat/azure-lb b/heartbeat/azure-lb
new file mode 100755
index 0000000..3129648
--- /dev/null
+++ b/heartbeat/azure-lb
@@ -0,0 +1,213 @@
+#!/bin/sh
+#
+
+#  License:      GNU General Public License (GPL)
+#  (c) 2017 O. Albrigtsen
+#           and Linux-HA contributors
+#
+# -----------------------------------------------------------------------------
+#      O C F    R E S O U R C E    S C R I P T   S P E C I F I C A T I O N
+# -----------------------------------------------------------------------------
+#
+# NAME
+#       azure-lb : OCF resource agent script for Azure Load Balancer
+#
+# Initialization:
+: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
+. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
+
+# Defaults
+OCF_RESKEY_nc_default="/usr/bin/nc"
+OCF_RESKEY_port_default="61000"
+
+: ${OCF_RESKEY_nc=${OCF_RESKEY_nc_default}}
+: ${OCF_RESKEY_port=${OCF_RESKEY_port_default}}
+
+process="$OCF_RESOURCE_INSTANCE"
+pidfile="/var/run/$OCF_RESOURCE_INSTANCE.pid"
+
+
+lb_usage() {
+	cat <<END
+    usage: $0 (start|stop|validate-all|meta-data|help|usage|monitor)
+    $0 manages service that answers Azure Load Balancer health probe requests as a OCF HA resource.
+    The 'start' operation starts the instance.
+    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 'validate-all' operation reports whether the parameters are valid
+END
+}
+
+lb_metadata() {
+cat <<END
+<?xml version="1.0"?>
+<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
+<resource-agent name="azure-lb">
+<version>1.0</version>
+<longdesc lang="en">
+Resource agent to answer Azure Load Balancer health probe requests
+</longdesc>
+<shortdesc lang="en">Answers Azure Load Balancer health probe requests</shortdesc>
+
+<parameters>
+
+<parameter name="nc">
+<longdesc lang="en">
+The full name of the nc binary.
+</longdesc>
+<shortdesc lang="en">Full path name of the nc binary</shortdesc>
+<content type="string" default="${OCF_RESKEY_nc_default}"/>
+</parameter>
+
+<parameter name="port">
+<longdesc lang="en">
+Port to listen to.
+</longdesc>
+<shortdesc lang="en">Listen to port</shortdesc>
+<content type="string" default="${OCF_RESKEY_port_default}"/>
+</parameter>
+
+</parameters>
+
+<actions>
+<action name="start"   timeout="20s" />
+<action name="stop"    timeout="20s" />
+<action name="monitor" depth="0"  timeout="20s" interval="10s" />
+<action name="meta-data"  timeout="5s" />
+<action name="validate-all"  timeout="5s" />
+</actions>
+</resource-agent>
+END
+exit 0
+}
+
+getpid() {
+        grep -o '[0-9]*' $1
+}
+
+lb_monitor() {
+	if test -f "$pidfile"; then
+		if pid=`getpid $pidfile` && [ "$pid" ] && kill -s 0 $pid; then
+			return $OCF_SUCCESS
+		else
+			# pidfile w/o process means the process died
+			return $OCF_ERR_GENERIC
+		fi
+	else
+		return $OCF_NOT_RUNNING
+	fi
+}
+
+lb_start() {
+	cmd="$OCF_RESKEY_nc -l -k $OCF_RESKEY_port"
+	if ! lb_monitor; then
+		ocf_log debug "Starting $process: $cmd"
+		# Execute the command as created above
+		eval "$cmd & echo \$!" > $pidfile
+		if lb_monitor; then
+			ocf_log debug "$process: $cmd started successfully, calling monitor"
+			lb_monitor
+			return $?
+		else 
+			ocf_log err "$process: $cmd could not be started"
+			return $OCF_ERR_GENERIC
+		fi
+	else
+		# If already running, consider start successful
+		ocf_log debug "$process: $cmd is already running"
+		return $OCF_SUCCESS
+	fi
+}
+
+lb_stop() {
+	local rc=$OCF_SUCCESS
+
+        if [ -n "$OCF_RESKEY_CRM_meta_timeout" ]; then
+                # Allow 2/3 of the action timeout for the orderly shutdown
+                # (The origin unit is ms, hence the conversion)
+                stop_timeout=$((OCF_RESKEY_CRM_meta_timeout/1500))
+        else
+                stop_timeout=10
+        fi
+
+	if lb_monitor; then
+                pid=`getpid $pidfile`
+                kill $pid
+
+                i=0
+                while [ $i -lt $stop_timeout ]; do
+                        if ! lb_monitor; then
+                        	rm -f $pidfile
+                                return $OCF_SUCCESS
+                        fi
+                        sleep 1 
+                        i=$((i+1))
+                done
+
+                ocf_log warn "Stop with SIGTERM failed/timed out, now sending SIGKILL."
+                kill -s 9 $pid
+                while :; do
+                        if ! lb_monitor; then
+                                ocf_log warn "SIGKILL did the job."
+                                rc=$OCF_SUCCESS
+                                break
+                        fi
+                        ocf_log info "The job still hasn't stopped yet. Waiting..."
+                        sleep 1
+                done
+	fi
+	rm -f $pidfile 
+	return $rc
+}
+
+lb_validate() {
+	check_binary "$OCF_RESKEY_nc"
+
+	if ! ocf_is_decimal "$OCF_RESKEY_port"; then
+		ocf_exit_reason "$OCF_RESKEY_port is not a valid port"
+		exit $OCF_ERR_CONFIGURED
+	fi
+
+	return $OCF_SUCCESS
+}
+
+###############################################################################
+#
+# MAIN
+#
+###############################################################################
+
+case $__OCF_ACTION in
+	meta-data)
+		lb_metadata
+		exit $OCF_SUCCESS
+		;;
+	usage|help)
+		lb_usage
+		exit $OCF_SUCCESS
+		;;
+esac
+
+if ! ocf_is_root; then
+	ocf_log err "You must be root for $__OCF_ACTION operation."
+	exit $OCF_ERR_PERM
+fi
+
+case $__OCF_ACTION in
+	start)
+		lb_validate 
+		lb_start;;
+	stop)
+		lb_stop;;
+	monitor)
+		lb_monitor;;
+	validate-all)
+		lb_validate;;
+	*)	
+		echo $USAGE
+		exit $OCF_ERR_UNIMPLEMENTED
+		;;
+esac
+
+exit $?
diff --git a/heartbeat/clvm b/heartbeat/clvm
index 43b9302..35544fb 100755
--- a/heartbeat/clvm
+++ b/heartbeat/clvm
@@ -75,11 +75,11 @@ is set to.
 </parameters>
 
 <actions>
-<action name="start"        timeout="90" />
-<action name="stop"         timeout="90" />
-<action name="monitor"      timeout="90" interval="30" depth="0" />
-<action name="meta-data"    timeout="10" />
-<action name="validate-all"   timeout="20" />
+<action name="start"        timeout="90s" />
+<action name="stop"         timeout="90s" />
+<action name="monitor"      timeout="90s" interval="30s" depth="0" />
+<action name="meta-data"    timeout="10s" />
+<action name="validate-all"   timeout="20s" />
 </actions>
 </resource-agent>
 END
@@ -363,7 +363,7 @@ clvmd_start()
 
 	# systemd drop-in to stop process before storage services during
 	# shutdown/reboot
-	if ps -p 1 | grep -q systemd ; then
+	if systemd_is_running ; then
 		systemd_drop_in "99-clvmd" "After" "blk-availability.service"
 	fi
 
diff --git a/heartbeat/conntrackd b/heartbeat/conntrackd
index c09c3ad..0fb8c98 100755
--- a/heartbeat/conntrackd
+++ b/heartbeat/conntrackd
@@ -76,15 +76,15 @@ For example "/packages/conntrackd-0.9.14/etc/conntrackd/conntrackd.conf"</longde
 </parameters>
 
 <actions>
-<action name="start"   timeout="30" />
-<action name="promote"	 timeout="30" />
-<action name="demote"	timeout="30" />
-<action name="notify"	timeout="30" />
-<action name="stop"    timeout="30" />
-<action name="monitor" timeout="20" interval="20" role="Slave" />
-<action name="monitor" timeout="20" interval="10" role="Master" />
-<action name="meta-data"  timeout="5" />
-<action name="validate-all"  timeout="30" />
+<action name="start"   timeout="30s" />
+<action name="promote"	 timeout="30s" />
+<action name="demote"	timeout="30s" />
+<action name="notify"	timeout="30s" />
+<action name="stop"    timeout="30s" />
+<action name="monitor" timeout="20s" interval="20s" role="Slave" />
+<action name="monitor" timeout="20s" interval="10s" role="Master" />
+<action name="meta-data"  timeout="5s" />
+<action name="validate-all"  timeout="30s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/db2 b/heartbeat/db2
index b67363e..d24c770 100755
--- a/heartbeat/db2
+++ b/heartbeat/db2
@@ -109,15 +109,15 @@ The number of the partion (DBPARTITIONNUM) to be managed.
 </parameters>
 
 <actions>
-<action name="start" timeout="120"/>
-<action name="stop" timeout="120"/>
-<action name="promote" timeout="120"/>
-<action name="demote" timeout="120"/>
-<action name="notify" timeout="10"/>
-<action name="monitor" depth="0" timeout="60" interval="20"/>
-<action name="monitor" depth="0" timeout="60" role="Master" interval="22"/>
-<action name="validate-all" timeout="5"/>
-<action name="meta-data" timeout="5"/>
+<action name="start" timeout="120s"/>
+<action name="stop" timeout="120s"/>
+<action name="promote" timeout="120s"/>
+<action name="demote" timeout="120s"/>
+<action name="notify" timeout="10s"/>
+<action name="monitor" depth="0" timeout="60s" interval="20s"/>
+<action name="monitor" depth="0" timeout="60s" role="Master" interval="22s"/>
+<action name="validate-all" timeout="5s"/>
+<action name="meta-data" timeout="5s"/>
 </actions>
 </resource-agent>
 END
@@ -272,7 +272,7 @@ db2_fal_attrib() {
         ;;
 
         get)
-        crm_attribute -t nodes -l reboot -n $attr -G -Q 2>&1
+        crm_attribute -t nodes -l reboot -n $attr -G --quiet 2>&1
         rc=$?
         if [ $rc != 0 ]
         then
@@ -714,7 +714,7 @@ db2_monitor() {
             ocf_is_ms && master_score -v 10000 -l reboot
             ;;
 
-            STANDBY/PEER/*|Standby/*Peer)
+            STANDBY/*PEER/*|Standby/*Peer)
             master_score -v 8000 -l reboot
             ;;
 
@@ -767,7 +767,7 @@ db2_promote() {
             # must take over 
             ;;
 
-            STANDBY/PEER/DISCONNECTED|STANDBY/DISCONNECTED_PEER/DISCONNECTED|Standby/DisconnectedPeer)
+            STANDBY/*PEER/DISCONNECTED|Standby/DisconnectedPeer)
             # must take over forced 
             force="by force peer window only"
             ;;
diff --git a/heartbeat/dhcpd b/heartbeat/dhcpd
index 1596ddd..8b2d8b6 100755
--- a/heartbeat/dhcpd
+++ b/heartbeat/dhcpd
@@ -178,12 +178,12 @@ Manage an ISC DHCP server service in a chroot environment.
     </parameter>
   </parameters>
   <actions>
-    <action name="start"        timeout="20" />
-    <action name="stop"         timeout="20" />
-    <action name="restart"         timeout="20" />
-    <action name="monitor"      timeout="20" interval="10" depth="0" />
-    <action name="meta-data"    timeout="5" />
-    <action name="validate-all"   timeout="20" />
+    <action name="start"        timeout="20s" />
+    <action name="stop"         timeout="20s" />
+    <action name="restart"         timeout="20s" />
+    <action name="monitor"      timeout="20s" interval="10s" depth="0" />
+    <action name="meta-data"    timeout="5s" />
+    <action name="validate-all"   timeout="20s" />
   </actions>
 </resource-agent>
 EOF
diff --git a/heartbeat/dnsupdate b/heartbeat/dnsupdate
index d834799..399c6fd 100755
--- a/heartbeat/dnsupdate
+++ b/heartbeat/dnsupdate
@@ -117,12 +117,12 @@ delete all previous records.
 </parameters>
 
 <actions>
-<action name="start" timeout="30" />
-<action name="stop" timeout="30" />
-<action name="status" depth="0" timeout="30" interval="10" />
-<action name="monitor" depth="0" timeout="30" interval="10" />
-<action name="meta-data" timeout="5" />
-<action name="validate-all" timeout="5" />
+<action name="start" timeout="30s" />
+<action name="stop" timeout="30s" />
+<action name="status" depth="0" timeout="30s" interval="10s" />
+<action name="monitor" depth="0" timeout="30s" interval="10s" />
+<action name="meta-data" timeout="5s" />
+<action name="validate-all" timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/docker b/heartbeat/docker
index 49e7052..87f94a7 100755
--- a/heartbeat/docker
+++ b/heartbeat/docker
@@ -179,11 +179,11 @@ container to be considered healthy.
 </parameters>
 
 <actions>
-<action name="start"        timeout="90" />
-<action name="stop"         timeout="90" />
-<action name="monitor"      timeout="30" interval="30" depth="0" />
-<action name="meta-data"    timeout="5" />
-<action name="validate-all"   timeout="30" />
+<action name="start"        timeout="90s" />
+<action name="stop"         timeout="90s" />
+<action name="monitor"      timeout="30s" interval="30s" depth="0" />
+<action name="meta-data"    timeout="5s" />
+<action name="validate-all"   timeout="30s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/eDir88 b/heartbeat/eDir88
index edb7592..afad0be 100755
--- a/heartbeat/eDir88
+++ b/heartbeat/eDir88
@@ -138,11 +138,11 @@ Value for the DHOST_OPTIONS java environment variable. If unset, original values
 </parameters>
 
 <actions>
-<action name="start" timeout="600" />
-<action name="stop" timeout="600" />
-<action name="monitor" timeout="60" interval="30" />
-<action name="meta-data" timeout="5" />
-<action name="validate-all" timeout="5" />
+<action name="start" timeout="600s" />
+<action name="stop" timeout="600s" />
+<action name="monitor" timeout="60s" interval="30s" />
+<action name="meta-data" timeout="5s" />
+<action name="validate-all" timeout="5s" />
 </actions>
 </resource-agent>
 EOFB
diff --git a/heartbeat/exportfs b/heartbeat/exportfs
index e70dbd3..0f4780e 100755
--- a/heartbeat/exportfs
+++ b/heartbeat/exportfs
@@ -152,11 +152,11 @@ Location of the rmtab backup, relative to directory.
 </parameters>
 
 <actions>
-<action name="start"   timeout="40" />
-<action name="stop"    timeout="120" />
-<action name="monitor" depth="0"  timeout="20" interval="10" />
-<action name="meta-data"  timeout="5" />
-<action name="validate-all"  timeout="30" />
+<action name="start"   timeout="40s" />
+<action name="stop"    timeout="120s" />
+<action name="monitor" depth="0"  timeout="20s" interval="10s" />
+<action name="meta-data"  timeout="5s" />
+<action name="validate-all"  timeout="30s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/fio b/heartbeat/fio
index 8b11229..0380be1 100755
--- a/heartbeat/fio
+++ b/heartbeat/fio
@@ -60,11 +60,11 @@ descriptions to run.
 </parameters>
 
 <actions>
-<action name="start"        timeout="60" />
-<action name="stop"         timeout="60" />
-<action name="monitor"      timeout="60" interval="10" />
-<action name="meta-data"    timeout="5" />
-<action name="validate-all"   timeout="20" />
+<action name="start"        timeout="60s" />
+<action name="stop"         timeout="60s" />
+<action name="monitor"      timeout="60s" interval="10s" />
+<action name="meta-data"    timeout="5s" />
+<action name="validate-all"   timeout="20s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/galera b/heartbeat/galera
index ee84514..270bdaf 100755
--- a/heartbeat/galera
+++ b/heartbeat/galera
@@ -250,16 +250,16 @@ Cluster check user password
 </parameters>
 
 <actions>
-<action name="start" timeout="120" />
-<action name="stop" timeout="120" />
-<action name="status" timeout="60" />
-<action name="monitor" depth="0" timeout="30" interval="20" />
-<action name="monitor" role="Master" depth="0" timeout="30" interval="10" />
-<action name="monitor" role="Slave" depth="0" timeout="30" interval="30" />
-<action name="promote" timeout="300" />
-<action name="demote" timeout="120" />
-<action name="validate-all" timeout="5" />
-<action name="meta-data" timeout="5" />
+<action name="start" timeout="120s" />
+<action name="stop" timeout="120s" />
+<action name="status" timeout="60s" />
+<action name="monitor" depth="0" timeout="30s" interval="20s" />
+<action name="monitor" role="Master" depth="0" timeout="30s" interval="10s" />
+<action name="monitor" role="Slave" depth="0" timeout="30s" interval="30s" />
+<action name="promote" timeout="300s" />
+<action name="demote" timeout="120s" />
+<action name="validate-all" timeout="5s" />
+<action name="meta-data" timeout="5s" />
 </actions>
 </resource-agent>
 END
@@ -293,7 +293,7 @@ clear_bootstrap_node()
 
 is_bootstrap()
 {
-    ${HA_SBIN_DIR}/crm_attribute -N $NODENAME -l reboot --name "${INSTANCE_ATTR_NAME}-bootstrap" -Q 2>/dev/null
+    ${HA_SBIN_DIR}/crm_attribute -N $NODENAME -l reboot --name "${INSTANCE_ATTR_NAME}-bootstrap" --quiet 2>/dev/null
 
 }
 
@@ -310,7 +310,7 @@ clear_no_grastate()
 is_no_grastate()
 {
     local node=$(ocf_attribute_target $1)
-    ${HA_SBIN_DIR}/crm_attribute -N $node -l reboot --name "${INSTANCE_ATTR_NAME}-no-grastate" -Q 2>/dev/null
+    ${HA_SBIN_DIR}/crm_attribute -N $node -l reboot --name "${INSTANCE_ATTR_NAME}-no-grastate" --quiet 2>/dev/null
 }
 
 clear_last_commit()
@@ -328,9 +328,9 @@ get_last_commit()
     local node=$(ocf_attribute_target $1)
 
     if [ -z "$node" ]; then
-       ${HA_SBIN_DIR}/crm_attribute -N $NODENAME -l reboot --name "${INSTANCE_ATTR_NAME}-last-committed" -Q 2>/dev/null
+       ${HA_SBIN_DIR}/crm_attribute -N $NODENAME -l reboot --name "${INSTANCE_ATTR_NAME}-last-committed" --quiet 2>/dev/null
     else 
-       ${HA_SBIN_DIR}/crm_attribute -N $node -l reboot --name "${INSTANCE_ATTR_NAME}-last-committed" -Q 2>/dev/null
+       ${HA_SBIN_DIR}/crm_attribute -N $node -l reboot --name "${INSTANCE_ATTR_NAME}-last-committed" --quiet 2>/dev/null
     fi
 }
 
@@ -349,9 +349,9 @@ get_safe_to_bootstrap()
     local node=$(ocf_attribute_target $1)
 
     if [ -z "$node" ]; then
-        ${HA_SBIN_DIR}/crm_attribute -N $NODENAME -l reboot --name "${INSTANCE_ATTR_NAME}-safe-to-bootstrap" -Q 2>/dev/null
+        ${HA_SBIN_DIR}/crm_attribute -N $NODENAME -l reboot --name "${INSTANCE_ATTR_NAME}-safe-to-bootstrap" --quiet 2>/dev/null
     else
-        ${HA_SBIN_DIR}/crm_attribute -N $node -l reboot --name "${INSTANCE_ATTR_NAME}-safe-to-bootstrap" -Q 2>/dev/null
+        ${HA_SBIN_DIR}/crm_attribute -N $node -l reboot --name "${INSTANCE_ATTR_NAME}-safe-to-bootstrap" --quiet 2>/dev/null
     fi
 }
 
diff --git a/heartbeat/garbd b/heartbeat/garbd
index 50563fb..aa0cea4 100755
--- a/heartbeat/garbd
+++ b/heartbeat/garbd
@@ -174,11 +174,11 @@ The group name of the Galera cluster to connect to.
 </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" />
+<action name="start" timeout="20s" />
+<action name="stop" timeout="20s" />
+<action name="monitor" depth="0" timeout="20s" interval="20s" />
+<action name="validate-all" timeout="5s" />
+<action name="meta-data" timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/iSCSILogicalUnit b/heartbeat/iSCSILogicalUnit
index 11bee9c..9286b40 100755
--- a/heartbeat/iSCSILogicalUnit
+++ b/heartbeat/iSCSILogicalUnit
@@ -269,12 +269,12 @@ in /sys/kernel/config/target/core/.
 </parameters>
 
 <actions>
-<action name="start"         timeout="10" />
-<action name="stop"          timeout="10" />
-<action name="status"        timeout="10" interval="10" depth="0" />
-<action name="monitor"       timeout="10" interval="10" depth="0" />
-<action name="meta-data"     timeout="5" />
-<action name="validate-all"  timeout="10" />
+<action name="start"         timeout="10s" />
+<action name="stop"          timeout="10s" />
+<action name="status"        timeout="10s" interval="10s" depth="0" />
+<action name="monitor"       timeout="10s" interval="10s" depth="0" />
+<action name="meta-data"     timeout="5s" />
+<action name="validate-all"  timeout="10s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/iSCSITarget b/heartbeat/iSCSITarget
index 2f84220..f6d6ae6 100755
--- a/heartbeat/iSCSITarget
+++ b/heartbeat/iSCSITarget
@@ -162,12 +162,12 @@ dependent. Neither the name nor the value may contain whitespace.
 </parameters>
 
 <actions>
-<action name="start"		timeout="10" />
-<action name="stop"		 timeout="10" />
-<action name="status"	   timeout="10" interval="10" depth="0" />
-<action name="monitor"	  timeout="10" interval="10" depth="0" />
-<action name="meta-data"	timeout="5" />
-<action name="validate-all"   timeout="10" />
+<action name="start"		timeout="10s" />
+<action name="stop"		 timeout="10s" />
+<action name="status"	   timeout="10s" interval="10s" depth="0" />
+<action name="monitor"	  timeout="10s" interval="10s" depth="0" />
+<action name="meta-data"	timeout="5s" />
+<action name="validate-all"   timeout="10s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/ids b/heartbeat/ids
index f232933..f2a573b 100755
--- a/heartbeat/ids
+++ b/heartbeat/ids
@@ -192,14 +192,14 @@ SQL test query to use for monitoring, defaults to 'SELECT COUNT(*) FROM systable
 
 
 <actions>
-<action name="start" timeout="120" />
-<action name="stop" timeout="120" />
-<action name="status" timeout="60" />
-<action name="monitor" depth="0" timeout="30" interval="10" />
-<action name="validate-all" timeout="5" />
-<action name="meta-data" timeout="5" />
-<action name="methods" timeout="5" />
-<action name="usage" timeout="5" />
+<action name="start" timeout="120s" />
+<action name="stop" timeout="120s" />
+<action name="status" timeout="60s" />
+<action name="monitor" depth="0" timeout="30s" interval="10s" />
+<action name="validate-all" timeout="5s" />
+<action name="meta-data" timeout="5s" />
+<action name="methods" timeout="5s" />
+<action name="usage" timeout="5s" />
 </actions>
 
 
diff --git a/heartbeat/ipsec b/heartbeat/ipsec
index 6144c00..9134a70 100755
--- a/heartbeat/ipsec
+++ b/heartbeat/ipsec
@@ -78,11 +78,11 @@ The directory where the IPSEC tunnel configurations can be found.
 </parameters>
 
 <actions>
-<action name="start"        timeout="20" />
-<action name="stop"         timeout="20" />
-<action name="monitor"      timeout="20" interval="10" depth="0" />
-<action name="reload"       timeout="20" />
-<action name="meta-data"    timeout="5" />
+<action name="start"        timeout="20s" />
+<action name="stop"         timeout="20s" />
+<action name="monitor"      timeout="20s" interval="10s" depth="0" />
+<action name="reload"       timeout="20s" />
+<action name="meta-data"    timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/iscsi b/heartbeat/iscsi
index 81cd78e..602a658 100755
--- a/heartbeat/iscsi
+++ b/heartbeat/iscsi
@@ -143,13 +143,13 @@ attribute appropriately.
 </parameters>
 
 <actions>
-<action name="start" timeout="120" />
-<action name="stop" timeout="120" />
-<action name="status" timeout="30" />
-<action name="monitor" depth="0" timeout="30" interval="120" />
-<action name="validate-all" timeout="5" />
-<action name="methods" timeout="5" />
-<action name="meta-data" timeout="5" />
+<action name="start" timeout="120s" />
+<action name="stop" timeout="120s" />
+<action name="status" timeout="30s" />
+<action name="monitor" depth="0" timeout="30s" interval="120s" />
+<action name="validate-all" timeout="5s" />
+<action name="methods" timeout="5s" />
+<action name="meta-data" timeout="5s" />
 </actions>
 </resource-agent>
 EOF
diff --git a/heartbeat/jboss b/heartbeat/jboss
index ca8e20b..664d5ba 100755
--- a/heartbeat/jboss
+++ b/heartbeat/jboss
@@ -502,7 +502,7 @@ Rotate console log suffix.
 <action name="status" timeout="30s" />
 <action name="monitor" depth="0" timeout="30s" interval="10s" />
 <action name="meta-data" timeout="5s" />
-<action name="validate-all"  timeout="5"/>
+<action name="validate-all"  timeout="5s"/>
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/jira b/heartbeat/jira
new file mode 100755
index 0000000..b01cfc3
--- /dev/null
+++ b/heartbeat/jira
@@ -0,0 +1,281 @@
+#! /bin/bash
+# 
+####################################################################
+# Description: OCF Resource Agent to manage JIRA software.
+# Author     : Saleh A. (saleh.abbas.saber at gmail.com)
+#
+# License    : WTFPL 2
+#
+#        DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 
+#                    Version 2, December 2004 
+#
+# Copyright (C) 2004 Sam Hocevar <sam at hocevar.net> 
+#
+# Everyone is permitted to copy and distribute verbatim or modified 
+# copies of this license document, and changing it is allowed as long 
+# as the name is changed. 
+#
+#            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 
+#   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 
+#
+#  0. You just DO WHAT THE FUCK YOU WANT TO.
+# 
+####################################################################
+# Parameters:  
+# OCF_RESKEY_statusurl         : Status URL to monitor JIRA 
+#               (default: http://localhost:8080/status)
+# OCF_RESKEY_java_home         : Java Home
+#               (default: /usr/lib/jvm/jre)
+# OCF_RESKEY_jira_installation : Jira installtion directory
+# OCF_RESKEY_jira_user         : User running Jira software
+#               (by default: jira)
+####################################################################
+
+# Initialization
+# Source ocf-shellfuncs
+: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
+. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
+
+# Usage
+jira_usage() {
+  cat <<_EOF
+Usage: $0 action
+
+Supported Actions:
+    start       : start jira
+    stop        : stop jira 
+    monitor     : show jira status 
+    meta-data   : show the meta-data
+    validate-all: validate the RA configuration
+_EOF
+}
+
+# Start
+jira_start() {
+    # exit immediately if configuration is not valid
+    jira_validate_all || exit $?
+
+    # if resource is already running, bail out early
+    if jira_monitor; then
+        ocf_log info "Resource is already running"
+        return $OCF_SUCCESS
+    fi
+
+    # Starting Jira
+    waittime=300
+    su -m $jira_user -c "$jira_installation/bin/startup.sh &> /dev/null"
+    while [[ $waittime -gt 0 ]]; do
+      if $(curl --connect-timeout 1 --max-time 3 -s ${statusurl} | grep '{"state":"RUNNING"}' > /dev/null); then
+        waittime=0
+      else
+        sleep 1
+        waittime=$(($waittime - 1))
+      fi
+    done
+
+    # Verify jira is running
+    jira_monitor
+    rc=$?
+
+    return $?
+}
+
+# Stop
+jira_stop() {
+    local rc
+
+    # exit immediately if configuration is not valid
+    jira_validate_all || exit $?
+
+    jira_monitor
+    rc=$?
+    case "$rc" in
+        "$OCF_SUCCESS")
+            # Currently running. Normal, expected behavior.
+            ocf_log debug "Resource is currently running"
+            ;;
+        "$OCF_NOT_RUNNING")
+            # Currently not running. Nothing to do.
+            ocf_log info "Resource is already stopped"
+            return $OCF_SUCCESS
+            ;;
+    esac
+
+    # Stopping Jira
+    waittime=300
+    su -m $jira_user -c "$jira_installation/bin/shutdown.sh &> /dev/null"
+    while [[ $waittime -gt 0 ]]; do
+      if $(kill -0 $(cat ${jira_installation}/work/catalina.pid 2> /dev/null) 2> /dev/null) ; then
+        sleep 1
+        waittime=$(($waittime - 1))
+      else
+        waittime=0
+      fi
+    done
+
+    # Stop JIRA forcely if it failed
+    if $(kill -0 $(cat ${jira_installation}/work/catalina.pid 2> /dev/null) 2> /dev/null) ; then
+      kill -9 $(cat ${jira_installation}/work/catalina.pid)
+      sleep 1
+    fi
+
+    # Verify jira is stopped
+    jira_monitor
+    rc=$?
+
+    return $rc
+
+}
+
+# Monitor
+jira_monitor() {
+    local rc
+
+    # exit immediately if configuration is not valid
+    jira_validate_all || exit $?
+
+    if $(kill -0 $(cat ${jira_installation}/work/catalina.pid 2> /dev/null) 2> /dev/null) ; then
+      # Is jira working
+      if $(curl --connect-timeout 1 --max-time 3 -s ${statusurl} | grep '{"state":"RUNNING"}' > /dev/null) ; then
+        rc=0
+      else
+        # Jira has a problem
+        rc=2
+      fi 
+    else
+      # Tomcat is stopped (and Jira)
+      rc=1
+    fi
+
+    case "$rc" in
+        0)
+            rc=$OCF_SUCCESS
+            ocf_log debug "Resource is running"
+            ;;
+        1)
+            rc=$OCF_NOT_RUNNING
+            ocf_log debug "Resource is not running"
+            ;;
+        *)
+            ocf_log err "Resource has failed"
+            exit $OCF_ERR_GENERIC
+    esac
+
+    return $rc
+}
+
+# Validat All
+jira_validate_all() {
+
+    # Check if java is installed
+    if ! [ -d $OCF_RESKEY_java_home ]; then
+      ocf_log err "$OCF_RESKEY_java_home does not exist. \
+      Please ensure that Java is installed and configured correctly"
+      exit $OCF_ERR_INSTALLED
+    fi
+
+    # Check if JIRA installation directory exists 
+    if ! [ -d $OCF_RESKEY_jira_installation ]; then
+      ocf_log err "$OCF_RESKEY_jira_installation does not exist."
+      exit $OCF_ERR_INSTALLED
+    fi
+
+    return $OCF_SUCCESS
+}
+
+# Meta-data
+jira_meta_data(){
+    cat <<EOF
+<?xml version="1.0"?>
+<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
+<resource-agent name="jira">
+  <version>0.1</version>
+  <longdesc lang="en">
+OCF Resource Agent to manage JIRA software
+  </longdesc>
+  <shortdesc lang="en">JIRA OCF RA</shortdesc>
+  <parameters>
+    
+    <parameter name="statusurl" unique="0" required="0">
+      <longdesc lang="en">
+      Status URL for JIRA monitoring
+      </longdesc>
+      <shortdesc lang="en">JIRA status url</shortdesc>
+      <content type="string" default="http://localhost:8080/status"/>
+    </parameter>
+    
+    <parameter name="java_home" unique="0" required="0">
+      <longdesc lang="en">
+      Java Home in the Linux instance
+      </longdesc>
+      <shortdesc lang="en">Java Home</shortdesc>
+      <content type="string" default="/usr/lib/jvm/jre"/>
+    </parameter>
+
+
+    <parameter name="jira_installation" unique="0" required="1">
+      <longdesc lang="en">
+      JIRA installation directory (binaries, ... etc)
+      </longdesc>
+      <shortdesc lang="en">JIRA installation directory</shortdesc>
+      <content type="string"/>
+    </parameter>
+
+    <parameter name="jira_user" unique="0" required="0">
+      <longdesc lang="en">
+      User to run Jira software with 
+      </longdesc>
+      <shortdesc lang="en">Jira user</shortdesc>
+      <content type="string" default="jira"/>
+    </parameter>
+
+  </parameters>
+  <actions>
+    <action name="start"        timeout="300s" />
+    <action name="stop"         timeout="300s" />
+    <action name="monitor"      timeout="30s"
+                                interval="10s" depth="0" />
+    <action name="meta-data"    timeout="5s" />
+    <action name="validate-all"   timeout="20s" />
+  </actions>
+</resource-agent>
+EOF
+}
+
+# Execution
+
+# Set vars from defined OCF env vars
+statusurl=${OCF_RESKEY_statusurl-http://localhost:8080/status}
+java_home=${OCF_RESKEY_java_home-/usr/lib/jvm/jre}
+jira_installation=${OCF_RESKEY_jira_installation}
+jira_user=${OCF_RESKEY_jira_user-jira}
+
+# Export JAVA_HOME env variable
+export JAVA_HOME=${OCF_RESKEY_java_home}
+
+# Make sure meta-data and usage always succeed
+case $__OCF_ACTION in
+meta-data)      jira_meta_data
+                exit $OCF_SUCCESS
+                ;;
+usage|help)     jira_usage
+                exit $OCF_SUCCESS
+                ;;
+esac
+
+# Anything other than meta-data and usage must pass validation
+jira_validate_all || exit $?
+
+# Translate each action into the appropriate function call
+case $__OCF_ACTION in
+start)          jira_start;;
+stop)           jira_stop;;
+status|monitor) jira_monitor;;
+validate-all)   ;;
+*)              jira_usage
+                exit $OCF_ERR_UNIMPLEMENTED
+                ;;
+esac
+rc=$?
+
+exit $rc
diff --git a/heartbeat/kamailio b/heartbeat/kamailio
index e05c3b6..12dcede 100755
--- a/heartbeat/kamailio
+++ b/heartbeat/kamailio
@@ -286,13 +286,13 @@ Parameters for a third Kamailio instance:
 </parameters>
 
  <actions>
-  <action name="start" timeout="60" />
-  <action name="stop" timeout="30" />
-  <action name="status" timeout="30" interval="10" />
-  <action name="monitor" timeout="30" interval="10" />
-  <action name="meta-data" timeout="5" />
-  <action name="validate-all" timeout="5" />
-  <action name="notify" timeout="5" />
+  <action name="start" timeout="60s" />
+  <action name="stop" timeout="30s" />
+  <action name="status" timeout="30s" interval="10s" />
+  <action name="monitor" timeout="30s" interval="10s" />
+  <action name="meta-data" timeout="5s" />
+  <action name="validate-all" timeout="5s" />
+  <action name="notify" timeout="5s" />
  </actions>
 </resource-agent>
 END
diff --git a/heartbeat/lvmlockd b/heartbeat/lvmlockd
index 645cf81..7fe73e3 100755
--- a/heartbeat/lvmlockd
+++ b/heartbeat/lvmlockd
@@ -49,6 +49,11 @@ dlm and sanlock. This agent only supports "dlm + lvmlockd". If dlm (or corosync)
 are already being used by other cluster software, you are advised to select
 dlm, then configure "controld" resource agent for dlm and this agent for "lvmlockd".
 Otherwise, consider sanlock for "lvmlockd" if dlm/corosync is not required.
+
+Using lvmlockd requires the settings in LVM configuration file (/etc/lvm/lvm.conf):
+"locking_type = 1" and "use_lvmlockd = 1". This RA will change the settings
+respectively if needed.
+
 For more information, refer to manpage lvmlockd.8.
 </longdesc>
 <shortdesc lang="en">This agent manages the lvmlockd daemon</shortdesc>
@@ -82,11 +87,11 @@ Adopt locks from a previous instance of lvmlockd.
 </parameters>
 
 <actions>
-<action name="start"		timeout="90" />
-<action name="stop"		timeout="90" />
-<action name="monitor"		timeout="90" interval="30" depth="0" />
-<action name="meta-data"	timeout="10" />
-<action name="validate-all"	timeout="20" />
+<action name="start"		timeout="90s" />
+<action name="stop"		timeout="90s" />
+<action name="monitor"		timeout="90s" interval="30s" depth="0" />
+<action name="meta-data"	timeout="10s" />
+<action name="validate-all"	timeout="20s" />
 </actions>
 </resource-agent>
 END
@@ -139,7 +144,8 @@ silent_status()
 	fi
 }
 
-check_config()
+# change /etc/lvm/lvm.conf to use lvmlockd
+setup_lvm_config()
 {
 	local out=""
 	local use_lvmlockd=""
@@ -155,15 +161,12 @@ check_config()
 	lock_type=$(echo "$out" | cut -d'=' -f2)
 
 	if [ "$use_lvmlockd" -ne 1 ] ; then
-		ocf_log info "lvmlockd is not enabled, please ensure \"use_lvmlockd=1\""
+		ocf_log info "setting \"use_lvmlockd=1\" in /etc/lvm/lvm.conf ..."
+		sed -i 's,^[[:blank:]]*use_lvmlockd[[:blank:]]*=.*,\ \ \ \ use_lvmlockd = 1,g' /etc/lvm/lvm.conf
 	fi
 	if [ "$lock_type" -ne 1 ] ; then
-		ocf_log info "locking type is wrong, please ensure \"locking_type=1\""
-	fi
-
-	if [ "$use_lvmlockd" -ne 1 ] || [ "$lock_type" -ne 1 ] ; then
-		ocf_exit_reason "Improper configuration to use lvmlockd."
-		exit $OCF_ERR_CONFIGURED
+		ocf_log info "setting \"locking_type=1\" in /etc/lvm/lvm.conf ..."
+		sed -i 's,^[[:blank:]]*locking_type[[:blank:]]*=.*,\ \ \ \ locking_type = 1,g' /etc/lvm/lvm.conf
 	fi
 
 	return $OCF_SUCCESS
@@ -186,8 +189,7 @@ check_dlm_controld()
 lvmlockd_start() {
 	local extras=""
 
-	ocf_log info "checking config settings for ${LOCKD}..."
-	check_config
+	setup_lvm_config
 
 	ocf_log info "checking if DLM is started first..."
 	check_dlm_controld
diff --git a/heartbeat/lxc b/heartbeat/lxc
index b582cb2..479e3ce 100755
--- a/heartbeat/lxc
+++ b/heartbeat/lxc
@@ -95,11 +95,11 @@ The default value is set to 'false', change to 'true' to activate this option</l
 </parameters>
 
 <actions>
-<action name="start"        timeout="10" />
-<action name="stop"         timeout="30" />
-<action name="monitor"      timeout="20" interval="60" depth="0"/>
-<action name="validate-all" timeout="20" />
-<action name="meta-data"    timeout="5" />
+<action name="start"        timeout="10s" />
+<action name="stop"         timeout="30s" />
+<action name="monitor"      timeout="20s" interval="60s" depth="0"/>
+<action name="validate-all" timeout="20s" />
+<action name="meta-data"    timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/lxd-info b/heartbeat/lxd-info
new file mode 100755
index 0000000..df11984
--- /dev/null
+++ b/heartbeat/lxd-info
@@ -0,0 +1,148 @@
+#!/bin/bash
+#
+#
+#	LXD Registration Service OCF Resource Agent
+#	It records (in the CIB) various attributes of a node
+#
+# Copyright (c) 2017 Mathieu Grzybek
+#                    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.
+#
+#######################################################################
+# Initialization:
+
+: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
+. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
+
+#######################################################################
+
+meta_data() {
+	cat <<END
+<?xml version="1.0"?>
+<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
+<resource-agent name="lxd-info">
+<version>1.0</version>
+
+<longdesc lang="en">
+This is a LXD Registration Service Resource Agent.
+It records (in the CIB) attributes about the number of running LXD containers
+running on the node.
+Sample output:
+   lxd_containers:   5
+</longdesc>
+<shortdesc lang="en">Records various node attributes in the CIB</shortdesc>
+
+<parameters>
+<parameter name="pidfile" unique="0">
+<longdesc lang="en">PID file</longdesc>
+<shortdesc lang="en">PID file</shortdesc>
+<content type="string" default="$OCF_RESKEY_pidfile" />
+</parameter>
+<parameter name="delay" unique="0">
+<longdesc lang="en">Interval to allow values to stabilize</longdesc>
+<shortdesc lang="en">Dampening Delay</shortdesc>
+<content type="string" default="0s" />
+</parameter>
+</parameters>
+
+<actions>
+<action name="start"   timeout="20s" />
+<action name="stop"    timeout="20s" />
+<action name="monitor" timeout="20s" interval="60s"/>
+<action name="meta-data"  timeout="5s" />
+<action name="validate-all"  timeout="20s" />
+</actions>
+</resource-agent>
+END
+}
+
+#######################################################################
+
+LXDInfoStats() {
+	value=$(lxc list|grep -ci RUNNING)
+	echo -e "lxd_containers:\t$value"
+	${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -S status -n lxd_containers -v $value
+}
+
+LXDInfo_usage() {
+	cat <<END
+usage: $0 {start|stop|monitor|validate-all|meta-data}
+
+Expects to have a fully populated OCF RA-compliant environment set.
+END
+}
+
+LXDInfo_start() {
+	echo $OCF_RESKEY_clone > $OCF_RESKEY_pidfile
+	LXDInfoStats
+	exit $OCF_SUCCESS
+}
+
+LXDInfo_stop() {
+	rm -f $OCF_RESKEY_pidfile
+	${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -D -S state -n lxd_containers
+	exit $OCF_SUCCESS
+}
+
+LXDInfo_monitor() {
+	if [ -f "$OCF_RESKEY_pidfile" ] ; then
+		LXDInfoStats
+		exit $OCF_RUNNING
+	fi
+	exit $OCF_NOT_RUNNING
+}
+
+LXDInfo_validate() {
+	return $OCF_SUCCESS
+}
+
+if [ $# -ne 1 ]; then
+    LXDInfo_usage
+    exit $OCF_ERR_ARGS
+fi
+
+: ${OCF_RESKEY_pidfile:="$HA_RSCTMP/LXDInfo-${OCF_RESOURCE_INSTANCE}"}
+: ${OCF_RESKEY_clone:="0"}
+if [ x != x${OCF_RESKEY_delay} ]; then
+	OCF_RESKEY_delay="-d ${OCF_RESKEY_delay}"
+fi
+
+case $__OCF_ACTION in
+meta-data)	meta_data
+		exit $OCF_SUCCESS
+		;;
+start)		LXDInfo_start
+		;;
+stop)		LXDInfo_stop
+		;;
+monitor)	LXDInfo_monitor
+		;;
+validate-all)	LXDInfo_validate
+		;;
+usage|help)	LXDInfo_usage
+		exit $OCF_SUCCESS
+		;;
+*)		LXDInfo_usage
+		exit $OCF_ERR_UNIMPLEMENTED
+		;;
+esac
+
+exit $?
diff --git a/heartbeat/machine-info b/heartbeat/machine-info
new file mode 100755
index 0000000..36f973c
--- /dev/null
+++ b/heartbeat/machine-info
@@ -0,0 +1,149 @@
+#!/bin/bash
+#
+#
+#	Virtual Machine and Container Registration Service OCF Resource Agent
+#	It records (in the CIB) various attributes of a node
+#
+# Copyright (c) 2017 Mathieu Grzybek
+#                    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.
+#
+#######################################################################
+# Initialization:
+
+: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
+. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
+
+#######################################################################
+
+meta_data() {
+	cat <<END
+<?xml version="1.0"?>
+<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
+<resource-agent name="machine-info">
+<version>1.0</version>
+
+<longdesc lang="en">
+This is a Virtual Machine and Container Registration Service Resource Agent.
+It records (in the CIB) attributes about the number of running virtual machines
+and containers running on the node.
+It uses systemd machinectl.
+Sample output:
+   machines:   5
+</longdesc>
+<shortdesc lang="en">Records various node attributes in the CIB</shortdesc>
+
+<parameters>
+<parameter name="pidfile" unique="0">
+<longdesc lang="en">PID file</longdesc>
+<shortdesc lang="en">PID file</shortdesc>
+<content type="string" default="$OCF_RESKEY_pidfile" />
+</parameter>
+<parameter name="delay" unique="0">
+<longdesc lang="en">Interval to allow values to stabilize</longdesc>
+<shortdesc lang="en">Dampening Delay</shortdesc>
+<content type="string" default="0s" />
+</parameter>
+</parameters>
+
+<actions>
+<action name="start"   timeout="20s" />
+<action name="stop"    timeout="20s" />
+<action name="monitor" timeout="20s" interval="60s"/>
+<action name="meta-data"  timeout="5s" />
+<action name="validate-all"  timeout="20s" />
+</actions>
+</resource-agent>
+END
+}
+
+#######################################################################
+
+MachineInfoStats() {
+	value=$(machinectl|awk '/machines listed/ {print $1}')
+	echo -e "machines:\t$value"
+	${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -S status -n machines -v $value
+}
+
+MachineInfo_usage() {
+	cat <<END
+usage: $0 {start|stop|monitor|validate-all|meta-data}
+
+Expects to have a fully populated OCF RA-compliant environment set.
+END
+}
+
+MachineInfo_start() {
+	echo $OCF_RESKEY_clone > $OCF_RESKEY_pidfile
+	MachineInfoStats
+	exit $OCF_SUCCESS
+}
+
+MachineInfo_stop() {
+	rm -f $OCF_RESKEY_pidfile
+	${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -D -S state -n machines
+	exit $OCF_SUCCESS
+}
+
+MachineInfo_monitor() {
+	if [ -f "$OCF_RESKEY_pidfile" ] ; then
+		MachineInfoStats
+		exit $OCF_RUNNING
+	fi
+	exit $OCF_NOT_RUNNING
+}
+
+MachineInfo_validate() {
+	return $OCF_SUCCESS
+}
+
+if [ $# -ne 1 ]; then
+    MachineInfo_usage
+    exit $OCF_ERR_ARGS
+fi
+
+: ${OCF_RESKEY_pidfile:="$HA_RSCTMP/MachineInfo-${OCF_RESOURCE_INSTANCE}"}
+: ${OCF_RESKEY_clone:="0"}
+if [ x != x${OCF_RESKEY_delay} ]; then
+	OCF_RESKEY_delay="-d ${OCF_RESKEY_delay}"
+fi
+
+case $__OCF_ACTION in
+meta-data)	meta_data
+		exit $OCF_SUCCESS
+		;;
+start)		MachineInfo_start
+		;;
+stop)		MachineInfo_stop
+		;;
+monitor)	MachineInfo_monitor
+		;;
+validate-all)	MachineInfo_validate
+		;;
+usage|help)	MachineInfo_usage
+		exit $OCF_SUCCESS
+		;;
+*)		MachineInfo_usage
+		exit $OCF_ERR_UNIMPLEMENTED
+		;;
+esac
+
+exit $?
diff --git a/heartbeat/mysql b/heartbeat/mariadb
similarity index 53%
copy from heartbeat/mysql
copy to heartbeat/mariadb
index 1b24248..b2635df 100755
--- a/heartbeat/mysql
+++ b/heartbeat/mariadb
@@ -1,9 +1,9 @@
-#!/bin/sh
+#!/bin/bash
 #
 #
-# MySQL
+# MariaDB
 #
-# Description:  Manages a MySQL database as Linux-HA resource
+# Description:  Manages a MariaDB Master/Slave database as Linux-HA resource
 #
 # Authors:  Alan Robertson:               DB2 Script
 #           Jakub Janczak:                rewrite as MySQL
@@ -12,6 +12,7 @@
 #           Narayan Newton:               add Gentoo/Debian defaults
 #           Marian Marinov, Florian Haas: add replication capability
 #           Yves Trudeau, Baron Schwartz: add VIP support and improve replication
+#           Nils Carlson:                 add GTID support and semi-sync support
 #
 # Support:  users at clusterlabs.org
 # License:  GNU General Public License (GPL)
@@ -19,9 +20,6 @@
 # (c) 2002-2005 International Business Machines, Inc.
 #     2005-2010 Linux-HA contributors
 #
-# An example usage in /etc/ha.d/haresources:
-#       node1  10.0.0.170 mysql
-#
 # See usage() function below for more details...
 #
 # OCF instance parameters:
@@ -31,6 +29,7 @@
 #   OCF_RESKEY_datadir
 #   OCF_RESKEY_user
 #   OCF_RESKEY_group
+#   OCF_RESKEY_node_list
 #   OCF_RESKEY_test_table
 #   OCF_RESKEY_test_user
 #   OCF_RESKEY_test_passwd
@@ -42,13 +41,11 @@
 #   OCF_RESKEY_replication_user
 #   OCF_RESKEY_replication_passwd
 #   OCF_RESKEY_replication_port
-#   OCF_RESKEY_max_slave_lag
-#   OCF_RESKEY_evict_outdated_slaves
-#   OCF_RESKEY_reader_attribute
-
 #######################################################################
 # Initialization:
 
+OCF_RESKEY_node_list_default=""
+
 : ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
 . ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
 . ${OCF_FUNCTIONS_DIR}/mysql-common.sh
@@ -58,7 +55,7 @@ usage() {
   cat <<UEND
 usage: $0 (start|stop|validate-all|meta-data|monitor|promote|demote|notify)
 
-$0 manages a MySQL Database as an HA resource.
+$0 manages a MariaDB Database as an HA resource.
 
 The 'start' operation starts the database.
 The 'stop' operation stops the database.
@@ -75,40 +72,41 @@ meta_data() {
    cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="mysql">
+<resource-agent name="mariadb">
 <version>1.0</version>
 
 <longdesc lang="en">
-Resource script for MySQL.
-May manage a standalone MySQL database, a clone set with externally
-managed replication, or a complete master/slave replication setup.
-Note, when master/slave replication is in use, the resource must
-be setup to use notifications. Set 'notify=true' in the metadata
-attributes when defining a MySQL master/slave instance.
-
-While managing replication, the default behavior is to use uname -n 
-values in the change master to command.  Other IPs can be specified 
-manually by adding a node attribute \${INSTANCE_ATTR_NAME}_mysql_master_IP
-giving the IP to use for replication.  For example, if the mysql primitive 
-you are using is p_mysql, the attribute to set will be 
-p_mysql_mysql_master_IP.
+Resource script for MariaDB.
+
+Manages a complete master/slave replication setup with GTID, for simpler
+uses look at the mysql resource agent which supports older replication
+forms which mysql and mariadb have in common.
+
+The resource must be setup to use notifications. Set 'notify=true' in the metadata
+attributes when defining a MariaDB master/slave instance.
+
+The default behavior is to use uname -n values in the change master to command.
+Other IPs can be specified manually by adding a node attribute
+\${INSTANCE_ATTR_NAME}_mysql_master_IP giving the IP to use for replication.
+For example, if the mariadb primitive you are using is p_mariadb, the
+attribute to set will be p_mariadb_mysql_master_IP.
 </longdesc>
-<shortdesc lang="en">Manages a MySQL database instance</shortdesc>
+<shortdesc lang="en">Manages a MariaDB master/slave instance</shortdesc>
 <parameters>
 
 <parameter name="binary" unique="0" required="0">
 <longdesc lang="en">
-Location of the MySQL server binary
+Location of the MariaDB server binary
 </longdesc>
-<shortdesc lang="en">MySQL server binary</shortdesc>
+<shortdesc lang="en">MariaDB server binary</shortdesc>
 <content type="string" default="${OCF_RESKEY_binary_default}" />
 </parameter>
 
 <parameter name="client_binary" unique="0" required="0">
 <longdesc lang="en">
-Location of the MySQL client binary
+Location of the MariaDB client binary
 </longdesc>
-<shortdesc lang="en">MySQL client binary</shortdesc>
+<shortdesc lang="en">MariaDB client binary</shortdesc>
 <content type="string" default="${OCF_RESKEY_client_binary_default}" />
 </parameter>
 
@@ -116,7 +114,7 @@ Location of the MySQL client binary
 <longdesc lang="en">
 Configuration file
 </longdesc>
-<shortdesc lang="en">MySQL config</shortdesc>
+<shortdesc lang="en">MariaDB config</shortdesc>
 <content type="string" default="${OCF_RESKEY_config_default}" />
 </parameter>
 
@@ -124,23 +122,23 @@ Configuration file
 <longdesc lang="en">
 Directory containing databases
 </longdesc>
-<shortdesc lang="en">MySQL datadir</shortdesc>
+<shortdesc lang="en">MariaDB datadir</shortdesc>
 <content type="string" default="${OCF_RESKEY_datadir_default}" />
 </parameter>
 
 <parameter name="user" unique="0" required="0">
 <longdesc lang="en">
-User running MySQL daemon
+User running MariaDB daemon
 </longdesc>
-<shortdesc lang="en">MySQL user</shortdesc>
+<shortdesc lang="en">MariaDB user</shortdesc>
 <content type="string" default="${OCF_RESKEY_user_default}" />
 </parameter>
 
 <parameter name="group" unique="0" required="0">
 <longdesc lang="en">
-Group running MySQL daemon (for logfile and directory permissions)
+Group running MariaDB daemon (for logfile and directory permissions)
 </longdesc>
-<shortdesc lang="en">MySQL group</shortdesc>
+<shortdesc lang="en">MariaDB group</shortdesc>
 <content type="string" default="${OCF_RESKEY_group_default}"/>
 </parameter>
 
@@ -148,15 +146,25 @@ Group running MySQL daemon (for logfile and directory permissions)
 <longdesc lang="en">
 The logfile to be used for mysqld.
 </longdesc>
-<shortdesc lang="en">MySQL log file</shortdesc>
+<shortdesc lang="en">MariaDB log file</shortdesc>
 <content type="string" default="${OCF_RESKEY_log_default}"/>
 </parameter>
 
+<parameter name="node_list" unique="0" required="1">
+<longdesc lang="en">
+All node names of nodes that will execute mariadb.
+Please separate each node name with a space.
+This is required for the master selection to function.
+</longdesc>
+<shortdesc lang="en">node list</shortdesc>
+<content type="string" default="${OCF_RESKEY_node_list_default}" />
+</parameter>
+
 <parameter name="pid" unique="0" required="0">
 <longdesc lang="en">
 The pidfile to be used for mysqld.
 </longdesc>
-<shortdesc lang="en">MySQL pid file</shortdesc>
+<shortdesc lang="en">MariaDB pid file</shortdesc>
 <content type="string" default="${OCF_RESKEY_pid_default}"/>
 </parameter>
 
@@ -164,7 +172,7 @@ The pidfile to be used for mysqld.
 <longdesc lang="en">
 The socket to be used for mysqld.
 </longdesc>
-<shortdesc lang="en">MySQL socket</shortdesc>
+<shortdesc lang="en">MariaDB socket</shortdesc>
 <content type="string" default="${OCF_RESKEY_socket_default}"/>
 </parameter>
 
@@ -172,29 +180,29 @@ The socket to be used for mysqld.
 <longdesc lang="en">
 Table to be tested in monitor statement (in database.table notation)
 </longdesc>
-<shortdesc lang="en">MySQL test table</shortdesc>
+<shortdesc lang="en">MariaDB test table</shortdesc>
 <content type="string" default="${OCF_RESKEY_test_table_default}" />
 </parameter>
 
 <parameter name="test_user" unique="0" required="0">
 <longdesc lang="en">
-MySQL test user, must have select privilege on test_table
+MariaDB test user, must have select privilege on test_table
 </longdesc>
-<shortdesc lang="en">MySQL test user</shortdesc>
+<shortdesc lang="en">MariaDB test user</shortdesc>
 <content type="string" default="${OCF_RESKEY_test_user_default}" />
 </parameter>
 
 <parameter name="test_passwd" unique="0" required="0">
 <longdesc lang="en">
-MySQL test user password
+MariaDB test user password
 </longdesc>
-<shortdesc lang="en">MySQL test user password</shortdesc>
+<shortdesc lang="en">MariaDB test user password</shortdesc>
 <content type="string" default="${OCF_RESKEY_test_passwd_default}" />
 </parameter>
 
 <parameter name="enable_creation" unique="0" required="0">
 <longdesc lang="en">
-If the MySQL database does not exist, it will be created
+If the MariaDB database does not exist, it will be created
 </longdesc>
 <shortdesc lang="en">Create the database if it does not exist</shortdesc>
 <content type="boolean" default="${OCF_RESKEY_enable_creation_default}"/>
@@ -211,76 +219,34 @@ Additional parameters which are passed to the mysqld on startup.
 
 <parameter name="replication_user" unique="0" required="0">
 <longdesc lang="en">
-MySQL replication user. This user is used for starting and stopping
-MySQL replication, for setting and resetting the master host, and for
+MariaDB replication user. This user is used for starting and stopping
+MariaDB replication, for setting and resetting the master host, and for
 setting and unsetting read-only mode. Because of that, this user must
 have SUPER, REPLICATION SLAVE, REPLICATION CLIENT, PROCESS and RELOAD
 privileges on all nodes within the cluster. Mandatory if you define a
 master-slave resource.
 </longdesc>
-<shortdesc lang="en">MySQL replication user</shortdesc>
+<shortdesc lang="en">MariaDB replication user</shortdesc>
 <content type="string" default="${OCF_RESKEY_replication_user_default}" />
 </parameter>
 
 <parameter name="replication_passwd" unique="0" required="0">
 <longdesc lang="en">
-MySQL replication password. Used for replication client and slave.
+MariaDB replication password. Used for replication client and slave.
 Mandatory if you define a master-slave resource.
 </longdesc>
-<shortdesc lang="en">MySQL replication user password</shortdesc>
+<shortdesc lang="en">MariaDB replication user password</shortdesc>
 <content type="string" default="${OCF_RESKEY_replication_passwd_default}" />
 </parameter>
 
 <parameter name="replication_port" unique="0" required="0">
 <longdesc lang="en">
-The port on which the Master MySQL instance is listening.
+The port on which the Master MariaDB instance is listening.
 </longdesc>
-<shortdesc lang="en">MySQL replication port</shortdesc>
+<shortdesc lang="en">MariaDB replication port</shortdesc>
 <content type="string" default="${OCF_RESKEY_replication_port_default}" />
 </parameter>
 
-<parameter name="max_slave_lag" unique="0" required="0">
-<longdesc lang="en">
-The maximum number of seconds a replication slave is allowed to lag
-behind its master. Do not set this to zero. What the cluster manager
-does in case a slave exceeds this maximum lag is determined by the
-evict_outdated_slaves parameter.
-</longdesc>
-<shortdesc lang="en">Maximum time (seconds) a MySQL slave is allowed
-to lag behind a master</shortdesc>
-<content type="integer" default="${OCF_RESKEY_max_slave_lag_default}"/>
-</parameter>
-
-<parameter name="evict_outdated_slaves" unique="0" required="0">
-<longdesc lang="en">
-If set to true, any slave which is more than max_slave_lag seconds
-behind the master has its MySQL instance shut down. If this parameter
-is set to false in a primitive or clone resource, it is simply
-ignored. If set to false in a master/slave resource, then exceeding
-the maximum slave lag will merely push down the master preference so
-the lagging slave is never promoted to the new master.
-</longdesc>
-<shortdesc lang="en">Determines whether to shut down badly lagging
-slaves</shortdesc>
-<content type="boolean" default="${OCF_RESKEY_evict_outdated_slaves_default}" />
-</parameter>
-
-<parameter name="reader_attribute" unique="1" required="0">
-<longdesc lang="en">
-An attribute that the RA can manage to specify whether a node
-can be read from. This node attribute will be 1 if it's fine to
-read from the node, and 0 otherwise (for example, when a slave
-has lagged too far behind the master).
-
-A typical example for the use of this attribute would be to tie
-a set of IP addresses to MySQL slaves that can be read from.
-
-This parameter is only meaningful in master/slave set configurations.
-</longdesc>
-<shortdesc lang="en">Sets the node attribute that determines
-whether a node is usable for clients to read from.</shortdesc>
-<content type="string" default="${OCF_RESKEY_reader_attribute_default}" />
-</parameter>
 </parameters>
 
 <actions>
@@ -302,6 +268,166 @@ END
 
 # Convenience functions
 
+greater_than_equal_long()
+{
+    # there are values we need to compare in this script
+    # that are too large for shell -gt to process
+    local true=$(echo "$1 > $2" | bc)
+    if [ "$true" -eq "1" ]; then
+        return 0
+    else
+        return 1
+    fi
+}
+
+greater_than_gtid()
+{
+    local gtid1_transaction_id=$(echo $1 | cut -d - -f 3)
+    local gtid2_transaction_id=$(echo $2 | cut -d - -f 3)
+
+    greater_than_equal_long $gtid1_transaction_id $gtid2_transaction_id
+    return $?
+}
+
+set_gtid() {
+    # Sets the GTID in CIB using attrd_updater for this node.
+
+    local gtid=$($MYSQL $MYSQL_OPTIONS_REPL \
+                        -s -N -e "show global variables like 'gtid_current_pos'" | cut -f 2)
+
+    # Ensure that we got somethine like a valid GTID
+    if ! echo $gtid | grep -q '-'; then
+        ocf_exit_reason "Unable to read GTID from MariaDB"
+        ocf_log err "Unable to read GTID from MariaDB"
+        return $OCF_ERR_GENERIC
+    fi
+
+    ${HA_SBIN_DIR}/attrd_updater -p -n ${OCF_RESOURCE_INSTANCE}-gtid -U $gtid
+}
+
+read_gtid() {
+    local node=$1
+    local query_result
+    local name
+    local host
+    local value
+
+    # This produces output of the form 'name="var-name" host="node2" value="val"'.
+    # This should be set at this point, because we have store our own GTID previously.
+    if ! query_result=$(${HA_SBIN_DIR}/attrd_updater -p -N $node -n ${OCF_RESOURCE_INSTANCE}-gtid -Q); then
+        ocf_exit_reason "Unable to read GTID from attrd"
+        ocf_log err "Unable to read GTID from attrd"
+        echo ""
+        return
+    fi
+
+    # Evaluate the query result to place the variables in the local scope.
+    eval ${query_result}
+
+    echo ${value}
+}
+
+clear_all_gtid() {
+    for node in $OCF_RESKEY_node_list; do
+        ${HA_SBIN_DIR}/attrd_updater -n ${OCF_RESOURCE_INSTANCE}-gtid -N $node -D
+    done
+}
+
+set_waiting_for_first_master() {
+    ${HA_SBIN_DIR}/attrd_updater -p -n ${OCF_RESOURCE_INSTANCE}-waiting-for-first-master -U true
+}
+
+waiting_for_first_master() {
+    local query_result
+    local name
+    local host
+    local value
+
+    if ! query_result=$(${HA_SBIN_DIR}/attrd_updater -p -n ${OCF_RESOURCE_INSTANCE}-waiting-for-first-master -Q); then
+        ocf_exit_reason "Unable to read waiting-for-first-master from attrd"
+        ocf_log err "Unable to read waiting-for-first-master from attrd"
+        return 1
+    fi
+
+    # Evaluate the query result to place the variables in the local scope.
+    eval ${query_result}
+
+    if [ "$value" = "true" ]; then
+        return 0
+    else
+        return 1
+    fi
+}
+
+clear_waiting_for_first_master() {
+    attrd_updater -n ${OCF_RESOURCE_INSTANCE}-waiting-for-first-master -D
+}
+
+have_master_with_priority() {
+    # Go through each node and validate that at least one has
+    # a set priority. Because we unset the priority on reboot
+    # a lack of priority indicates that we need to select a
+    # new master.
+    for node in $OCF_RESKEY_node_list; do
+        $CRM_MASTER -G -N $node >/dev/null 2>&1
+        rc=$?
+        if [ $rc -eq 0 ]; then
+            return 0
+        fi
+    done
+    return 1
+}
+
+attempt_to_set_master() {
+
+    ocf_log info "Attempting to set master"
+    
+    local expected_node_count
+    if waiting_for_first_master; then
+        # Wait for all nodes to come online
+        expected_node_count=$OCF_RESKEY_CRM_meta_clone_max
+    else
+        # We accept one node being down. This is not arbitrary,
+        # synchronous replication requires acknowledgement from
+        # at least one host, which means only two nodes must have
+        # the latest GTID. So a set of n - 1 ensures that we do
+        # not lose any writes.
+        expected_node_count=$(($OCF_RESKEY_CRM_meta_clone_max-1))
+    fi
+
+    # Set the gtid for this node, making it available to other nodes
+    set_gtid
+    
+    local node_count=0
+    local highest_gtid=0
+    local master_candidate=""
+    for node in $OCF_RESKEY_node_list; do
+
+        local node_gtid=$(read_gtid $node)
+        if [ -z "$node_gtid" ]; then
+            continue
+        fi
+
+        # Got a valid gtid, increment node count
+        node_count=$(($node_count+1))
+
+        # Check if this is a good master candidate
+        if greater_than_gtid $node_gtid $highest_gtid; then
+            master_candidate=$node
+            highest_gtid=$node_gtid
+        fi
+    done
+
+    # If we managed to query a sufficient number of nodes
+    # then set a master
+    if [ $node_count -ge $expected_node_count ]; then
+        ocf_log info "Promoting $master_candidate to master, highest gtid $highest_gtid, queried $node_count nodes."
+        $CRM_MASTER -v 100 -N $master_candidate
+    else
+        ocf_log info "Not enough nodes ($node_count) contributed to select a master, need $expected_node_count nodes."
+    fi
+}
+
 set_read_only() {
     # Sets or unsets read-only mode. Accepts one boolean as its
     # optional argument. If invoked without any arguments, defaults to
@@ -323,8 +449,8 @@ get_read_only() {
     # Check if read-only is set
     local read_only_state
 
-    read_only_state=`$MYSQL $MYSQL_OPTIONS_REPL \
-        --skip-column-names -e "SHOW VARIABLES LIKE 'read_only'" | awk '{print $2}'`
+    read_only_state=$($MYSQL $MYSQL_OPTIONS_REPL \
+        -e "SHOW VARIABLES" | grep -w read_only | awk '{print $2}')
 
     if [ "$read_only_state" = "ON" ]; then
         return 0
@@ -334,26 +460,20 @@ get_read_only() {
 }
 
 is_slave() {
-    # Determine whether the machine is currently running as a MySQL
+    # Determine whether the machine is currently running as a MariaDB
     # slave, as determined per SHOW SLAVE STATUS. Returns 1 if SHOW
     # SLAVE STATUS creates an empty result set, 0 otherwise.
     local rc
-    local tmpfile
 
     # Check whether this machine should be slave
-    if ! ocf_is_ms || ! get_read_only; then
+    if ! get_read_only; then
         return 1
     fi
    
-    get_slave_info
-    rc=$?
-    rm -f $tmpfile
-
-    if [ $rc -eq 0 ]; then
+    if get_slave_info; then
        # show slave status is not empty
-       # Is there a master_log_file defined?  (master_log_file is deleted 
-       # by reset slave
-       if [ "$master_log_file" ]; then
+       # Is the slave sql thread running, then we are a slave!
+       if [ "$slave_sql" == 'Yes' ]; then
           return 0
        else
           return 1
@@ -363,7 +483,6 @@ is_slave() {
        # replication slave
        return 1
     fi
-    
 }
 
 parse_slave_info() {
@@ -372,33 +491,35 @@ parse_slave_info() {
 }
 
 get_slave_info() {
-    # Warning: this sets $tmpfile and LEAVE this file! You must delete it after use!
-    local mysql_options
             
     if [ "$master_log_file" -a "$master_host" ]; then
         # variables are already defined, get_slave_info has been run before
         return $OCF_SUCCESS
     else
-        tmpfile=`mktemp ${HA_RSCTMP}/check_slave.${OCF_RESOURCE_INSTANCE}.XXXXXX`
+        local tmpfile=$(mktemp ${HA_RSCTMP}/check_slave.${OCF_RESOURCE_INSTANCE}.XXXXXX)
 
         $MYSQL $MYSQL_OPTIONS_REPL \
         -e 'SHOW SLAVE STATUS\G' > $tmpfile
 
         if [ -s $tmpfile ]; then
-            master_host=`parse_slave_info Master_Host $tmpfile`
-            master_user=`parse_slave_info Master_User $tmpfile`
-            master_port=`parse_slave_info Master_Port $tmpfile`
-            master_log_file=`parse_slave_info Master_Log_File $tmpfile`
-            master_log_pos=`parse_slave_info Read_Master_Log_Pos $tmpfile`
-            slave_sql=`parse_slave_info Slave_SQL_Running $tmpfile`
-            slave_io=`parse_slave_info Slave_IO_Running $tmpfile`
-            last_errno=`parse_slave_info Last_Errno $tmpfile`
-            secs_behind=`parse_slave_info Seconds_Behind_Master $tmpfile`
-            ocf_log debug "MySQL instance running as a replication slave"
+            master_host=$(parse_slave_info Master_Host $tmpfile)
+            master_user=$(parse_slave_info Master_User $tmpfile)
+            master_port=$(parse_slave_info Master_Port $tmpfile)
+            master_using_gtid=$(parse_slave_info Using_Gtid $tmpfile)
+            master_log_file=$(parse_slave_info Master_Log_File $tmpfile)
+            slave_sql=$(parse_slave_info Slave_SQL_Running $tmpfile)
+            slave_io=$(parse_slave_info Slave_IO_Running $tmpfile)
+            last_errno=$(parse_slave_info Last_Errno $tmpfile)
+            last_error=$(parse_slave_info Last_Error $tmpfile)
+            secs_behind=$(parse_slave_info Seconds_Behind_Master $tmpfile)
+            last_io_errno=$(parse_slave_info Last_IO_Errno $tmpfile)
+            last_io_error=$(parse_slave_info Last_IO_Error $tmpfile)
+            ocf_log debug "MariaDB instance running as a replication slave"
+            rm "$tmpfile"
         else
             # Instance produced an empty "SHOW SLAVE STATUS" output --
             # instance is not a slave
-            ocf_exit_reason "check_slave invoked on an instance that is not a replication slave."
+            rm "$tmpfile"
             return $OCF_ERR_GENERIC
         fi
 
@@ -414,36 +535,33 @@ check_slave() {
     rc=$?
 
     if [ $rc -eq 0 ]; then
-        # Did we receive an error other than max_connections?
-        if [ $last_errno -ne 0 -a $last_errno -ne "$MYSQL_TOO_MANY_CONN_ERR" ]; then
-            # Whoa. Replication ran into an error. This slave has
-            # diverged from its master. Make sure this resource
-            # doesn't restart in place.
-            ocf_exit_reason "MySQL instance configured for replication, but replication has failed."
-            ocf_log err "See $tmpfile for details"
 
-            # Just pull the reader VIP away, killing MySQL here would be pretty evil
-            # on a loaded server
-
-            set_reader_attr 0
-            exit $OCF_SUCCESS
+        # Check normal errors
+        if [ $last_errno -ne 0 ]; then
+            ocf_exit_reason "MariaDB slave replication has failed ($last_errno): $last_error"
 
+            exit $OCF_ERR_GENERIC
         fi
 
-        # If we got max_connections, let's remove the vip
-        if [ $last_errno -eq "$MYSQL_TOO_MANY_CONN_ERR" ]; then
-            set_reader_attr 0
-            exit $OCF_SUCCESS
+        # Check IO Errors, ignore 2003 which indicates a connection failure to the master
+        if [ $last_io_errno -ne 0 ] && [ $last_io_errno -ne 2003 ]; then
+            ocf_exit_reason "MariaDB slave io has failed ($last_io_errno): $last_io_error"
+
+            exit $OCF_ERR_GENERIC
         fi
 
+        if [ $last_io_errno -eq 2003 ]; then
+            ocf_log warn "MariaDB master not reachable from slave"
+        fi
+        
         if [ "$slave_io" != 'Yes' ]; then
             # Not necessarily a bad thing. The master may have
             # temporarily shut down, and the slave may just be
             # reconnecting. A warning can't hurt, though.
-            ocf_log warn "MySQL Slave IO threads currently not running."
+            ocf_log warn "MariaDB Slave IO threads currently not running."
 
             # Sanity check, are we at least on the right master
-            new_master=`$CRM_ATTR_REPL_INFO --query  -q | cut -d'|' -f1`
+            new_master=$($CRM_ATTR_REPL_INFO --query  -q)
 
             if [ "$master_host" != "$new_master" ]; then
                # Not pointing to the right master, not good, removing the VIPs
@@ -457,9 +575,8 @@ check_slave() {
         if [ "$slave_sql" != 'Yes' ]; then
             # We don't have a replication SQL thread running. Not a
             # good thing. Try to recoved by restarting the SQL thread
-            # and remove reader vip.  Prevent MySQL restart.
-            ocf_exit_reason "MySQL Slave SQL threads currently not running."
-            ocf_log err "See $tmpfile for details"
+            # and remove reader vip.  Prevent MariaDB restart.
+            ocf_exit_reason "MariaDB Slave SQL threads currently not running."
 
             # Remove reader vip
             set_reader_attr 0
@@ -472,131 +589,48 @@ check_slave() {
             exit $OCF_SUCCESS
         fi
 
-        if ocf_is_true $OCF_RESKEY_evict_outdated_slaves; then
-            # We're supposed to bail out if we lag too far
-            # behind. Let's check our lag.
-            if [ "$secs_behind" = "NULL" ] || [ $secs_behind -gt $OCF_RESKEY_max_slave_lag ]; then
-                ocf_exit_reason "MySQL Slave is $secs_behind seconds behind master (allowed maximum: $OCF_RESKEY_max_slave_lag)."
-                ocf_log err "See $tmpfile for details"
-
-                # Remove reader vip
-                set_reader_attr 0
-
-                exit $OCF_ERR_INSTALLED
-            fi
-        elif ocf_is_ms; then
-            # Even if we're not set to evict lagging slaves, we can
-            # still use the seconds behind master value to set our
-            # master preference.
-            local master_pref
-            master_pref=$((${OCF_RESKEY_max_slave_lag}-${secs_behind}))
-            if [ $master_pref -lt 0 ]; then
-                # Sanitize a below-zero preference to just zero
-                master_pref=0
-            fi
-            $CRM_MASTER -v $master_pref
-        fi
-
-        # is the slave ok to have a VIP on it
-        if [ "$secs_behind" = "NULL" ] || [ $secs_behind -gt $OCF_RESKEY_max_slave_lag ]; then
-            set_reader_attr 0
-        else
-            set_reader_attr 1
-        fi
-
-        ocf_log debug "MySQL instance running as a replication slave"
-        rm -f $tmpfile
+        ocf_log debug "MariaDB instance running as a replication slave"
     else
         # Instance produced an empty "SHOW SLAVE STATUS" output --
         # instance is not a slave
         # TODO: Needs to handle when get_slave_info will return too many connections error
-        rm -f $tmpfile
         ocf_exit_reason "check_slave invoked on an instance that is not a replication slave."
         exit $OCF_ERR_GENERIC
     fi
 }
 
 set_master() {
-    local new_master master_log_file master_log_pos
-    local master_params
+    local new_master=$($CRM_ATTR_REPL_INFO --query  -q)
 
-    new_master=`$CRM_ATTR_REPL_INFO --query  -q | cut -d'|' -f1`
-
-    # Keep replication position
-    get_slave_info
-
-    if [ "$master_log_file" -a "$new_master" = "$master_host" ]; then
-        #	master_params=", MASTER_LOG_FILE='$master_log_file', \
-        #	    MASTER_LOG_POS=$master_log_pos"
-        ocf_log info "Kept master pos for $master_host : $master_log_file:$master_log_pos"
-        rm -f $tmpfile
-        return
-    else
-        master_log_file=`$CRM_ATTR_REPL_INFO --query  -q | cut -d'|' -f2`
-        master_log_pos=`$CRM_ATTR_REPL_INFO --query  -q | cut -d'|' -f3`
-        if [ -n "$master_log_file" -a -n "$master_log_pos" ]; then
-            master_params=", MASTER_LOG_FILE='$master_log_file', \
-            MASTER_LOG_POS=$master_log_pos"
-            ocf_log info "Restored master pos for $new_master : $master_log_file:$master_log_pos"
-        fi
-    fi
-
-    # Informs the MySQL server of the master to replicate
+    # Informs the MariaDB server of the master to replicate
     # from. Accepts one mandatory argument which must contain the host
     # name of the new master host. The master must either be unchanged
     # from the laste master the slave replicated from, or freshly
     # reset with RESET MASTER.
+    ocf_log info "Changing MariaDB configuration to replicate from $new_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
+        MASTER_PASSWORD='$OCF_RESKEY_replication_passwd', \
+        MASTER_USE_GTID=current_pos";
 }
 
 unset_master(){
-    # Instructs the MySQL server to stop replicating from a master
+    # Instructs the MariaDB server to stop replicating from a master
     # host.
 
     # If we're currently not configured to be replicating from any
     # host, then there's nothing to do. But we do log a warning as
-    # no-one but the CRM should be touching the MySQL master/slave
+    # no-one but the CRM should be touching the MariaDB master/slave
     # configuration.
     if ! is_slave; then
         ocf_log warn "Attempted to unset the replication master on an instance that is not configured as a replication slave"
         return $OCF_SUCCESS
     fi
 
-    local tmpfile
-    tmpfile=`mktemp ${HA_RSCTMP}/unset_master.${OCF_RESOURCE_INSTANCE}.XXXXXX`
-
-    # At this point, the master is read only so there should not be much binlogs to transfer
-    # Let's wait for the last bits
-    while true; do
-        $MYSQL $MYSQL_OPTIONS_REPL \
-        -e 'SHOW PROCESSLIST\G' > $tmpfile
-        if grep -i 'Waiting for master to send event' $tmpfile >/dev/null; then
-            ocf_log info "MySQL slave has finished reading master binary log"
-            break
-        fi
-        if grep -i 'Reconnecting after a failed master event read' $tmpfile >/dev/null; then
-            ocf_log info "Master is down, no more binary logs to come"
-            break
-        fi
-        if grep -i 'Connecting to master' $tmpfile >/dev/null; then
-            ocf_log info "Master is down, no more binary logs to come"
-            break
-        fi
-        if ! grep 'system user' $tmpfile >/dev/null; then
-            ocf_log info "Slave is not running - not waiting to finish"
-            break
-        fi
-
-        sleep 1
-    done
-
-    # Now, stop the slave I/O thread and wait for relay log
+    # Stop the slave I/O thread and wait for relay log
     # processing to complete
     ocf_run $MYSQL $MYSQL_OPTIONS_REPL \
         -e "STOP SLAVE IO_THREAD"
@@ -605,18 +639,19 @@ unset_master(){
         exit $OCF_ERR_GENERIC
     fi
 
+    local tmpfile=$(mktemp ${HA_RSCTMP}/threads.${OCF_RESOURCE_INSTANCE}.XXXXXX)
     while true; do
         $MYSQL $MYSQL_OPTIONS_REPL \
             -e 'SHOW PROCESSLIST\G' > $tmpfile
         if grep -i 'Has read all relay log' $tmpfile >/dev/null; then
-            ocf_log info "MySQL slave has finished processing relay log"
+            ocf_log info "MariaDB slave has finished processing relay log"
             break
         fi
         if ! grep -q 'system user' $tmpfile; then
             ocf_log info "Slave not runnig - not waiting to finish"
             break
         fi
-        ocf_log info "Waiting for MySQL slave to finish processing relay log"
+        ocf_log info "Waiting for MariaDB slave to finish processing relay log"
         sleep 1
     done
     rm -f $tmpfile
@@ -639,7 +674,6 @@ unset_master(){
 
 # Start replication as slave
 start_slave() {
-
     ocf_run $MYSQL $MYSQL_OPTIONS_REPL \
         -e "START SLAVE"
 }
@@ -661,34 +695,15 @@ get_reader_attr() {
     local attr_value
     local rc
 
-    attr_value=`$CRM_ATTR -l reboot --name ${OCF_RESKEY_reader_attribute} --query -q`
+    attr_value=$($CRM_ATTR -l reboot --name ${OCF_RESKEY_reader_attribute} --query -q)
     rc=$?
     if [ "$rc" -eq "0" ]; then
         echo $attr_value
     else
         echo -1
     fi
-
-}
-
-# Stores data for MASTER STATUS from MySQL
-update_data_master_status() {
-
-   master_status_file="${HA_RSCTMP}/master_status.${OCF_RESOURCE_INSTANCE}"
-
-   $MYSQL $MYSQL_OPTIONS_REPL -e "SHOW MASTER STATUS\G" > $master_status_file
 }
 
-
-# Returns the specified value from the stored copy of SHOW MASTER STATUS.
-# should be call after update_data_master_status for tmpfile
-# Arguments:
-#  $1 The value to get.
-get_master_status() {
-   awk -v var="$1" '$1 == var ":" {print substr($0, index($0, ":") + 2)}' "$master_status_file"
-}
-
-
 # Determines what IP address is attached to the current host.  The output of the
 # crm_attribute command looks like this:
 # scope=nodes  name=IP value=10.2.2.161
@@ -697,7 +712,7 @@ get_master_status() {
 # change master to command.
 get_local_ip() {
    local IP
-   IP=`$CRM_ATTR -l forever -n ${INSTANCE_ATTR_NAME}_mysql_master_IP -q -G`
+   IP=$($CRM_ATTR -l forever -n ${INSTANCE_ATTR_NAME}_mysql_master_IP -q -G 2>/dev/null)
    if [ ! $? -eq 0 ]; then
       uname -n
    else
@@ -720,30 +735,21 @@ mysql_monitor() {
  
     mysql_common_status $status_loglevel
     rc=$?
-
-    # TODO: check max connections error
-
+    
     # If status returned an error, return that immediately
     if [ $rc -ne $OCF_SUCCESS ]; then
-        if ocf_is_ms ; then
-            # This is a master slave setup but monitored host returned some errors.
-            # Immediately remove it from the pool of possible masters by erasing its master-mysql key
-            # When new mysql master election is started and node got no or negative master-mysql attribute the following is logged
-            #   nodename.com pengine: debug: master_color: mysql:0 master score: -1
-            # If there are NO nodes with positive vaule election of mysql master will fail with
-            #   nodename.com pengine: info: master_color: ms_mysql: Promoted 0 instances of a possible 1 to master
-            $CRM_MASTER -D
-        fi
-
         return $rc
     fi
 
-    if [ $OCF_CHECK_LEVEL -gt 0 -a -n "$OCF_RESKEY_test_table" ]; then
-        # Check if this instance is configured as a slave, and if so
-        # check slave status
-        if is_slave; then
-            check_slave
+    # Check if this instance is configured as a slave, and if so
+    # check slave status
+    if is_slave; then
+        if ! check_slave; then
+            return $OCF_ERR_GENERIC
         fi
+    fi
+    
+    if [ -n "$OCF_RESKEY_test_table" ]; then
 
         # Check for test table
         ocf_run -q $MYSQL $MYSQL_OPTIONS_TEST \
@@ -751,96 +757,96 @@ mysql_monitor() {
         rc=$?
 
         if [ $rc -ne 0 ]; then
-            # We are master/slave and test failed. Delete master score for this node as it is considered unhealthy because of this particular failed check.
-            ocf_is_ms && $CRM_MASTER -D
             ocf_exit_reason "Failed to select from $test_table";
             return $OCF_ERR_GENERIC;
         fi
-    else
-        # In case no exnteded tests are enabled and we are in master/slave mode _always_ set the master score to 1 if we reached this point
-        ocf_is_ms && $CRM_MASTER -v 1
     fi
 
-    if ocf_is_ms && ! get_read_only; then
-        ocf_log debug "MySQL monitor succeeded (master)";
-        # Always set master score for the master
-        $CRM_MASTER -v 2
+    # Check if we are in read-only mode and there is no master
+    # with priority then we attempt to select a master
+    if get_read_only && ! have_master_with_priority; then
+        attempt_to_set_master
+    fi
+    
+    if ! get_read_only; then
+        ocf_log debug "MariaDB monitor succeeded (master)";
         return $OCF_RUNNING_MASTER
     else
-        ocf_log debug "MySQL monitor succeeded";
+        ocf_log debug "MariaDB monitor succeeded";
         return $OCF_SUCCESS
     fi
 }
 
 mysql_start() {
     local rc
-
-    if ocf_is_ms; then
-        # Initialize the ReaderVIP attribute, monitor will enable it
-        set_reader_attr 0
+    
+    if ! ocf_is_ms; then
+        ocf_exit_reason "Resource is not configured as master/slave"
+        return $OCF_ERR_GENERIC
     fi
+    
+    # Initialize the ReaderVIP attribute, monitor will enable it
+    set_reader_attr 0
 
     mysql_common_status info
     if [ $? = $OCF_SUCCESS ]; then
-        ocf_log info "MySQL already running"
+        ocf_log info "MariaDB already running"
         return $OCF_SUCCESS
     fi
 
     mysql_common_prepare_dirs
 
-    # Uncomment to perform permission clensing
-    # - not convinced this should be enabled by default
-    #
-    #chmod 0755 $OCF_RESKEY_datadir
-    #chown -R $OCF_RESKEY_user $OCF_RESKEY_datadir
-    #chgrp -R $OCF_RESKEY_group $OCF_RESKEY_datadir
-    mysql_extra_params=
-    if ocf_is_ms; then
-        mysql_extra_params="--skip-slave-start"
-    fi
-
-    mysql_common_start $mysql_extra_params
+    mysql_common_start --skip-slave-start --log-slave-updates
     rc=$?
     if [ $rc != $OCF_SUCCESS ]; then
         return $rc
     fi
 
-    if ocf_is_ms; then
-        # We're configured as a stateful resource. We must start as
-        # slave by default. At this point we don't know if the CRM has
-        # already promoted a master. So, we simply start in read only
-        # mode.
-        set_read_only on
-
-        # Now, let's see whether there is a master. We might be a new
-        # node that is just joining the cluster, and the CRM may have
-        # promoted a master before.
-        master_host=`echo $OCF_RESKEY_CRM_meta_notify_master_uname|tr -d " "`
-        if [ "$master_host" -a "$master_host" != ${NODENAME} ]; then
-            ocf_log info "Changing MySQL configuration to replicate from $master_host."
-            set_master
-            start_slave
-            if [ $? -ne 0 ]; then
-                ocf_exit_reason "Failed to start slave"
-                return $OCF_ERR_GENERIC
-            fi
-        else
-            ocf_log info "No MySQL master present - clearing replication state"
-            unset_master
+    # Enable semi-sync
+    ocf_run -q $MYSQL $MYSQL_OPTIONS_TEST \
+            -e "SET GLOBAL rpl_semi_sync_slave_enabled='ON', \
+                           rpl_semi_sync_master_enabled='ON', \
+                           rpl_semi_sync_master_wait_no_slave='OFF', \
+                           rpl_semi_sync_master_wait_point='AFTER_SYNC', \
+                           gtid_strict_mode='ON', \
+                           sync_binlog=1, \
+                           sync_master_info=1, \
+                           innodb_flush_log_at_trx_commit=1;"
+    rc=$?
+    if [ $rc -ne 0 ]; then
+        ocf_exit_reason "Failed to enable semi-sync and set variables";
+        return $OCF_ERR_GENERIC;
+    fi
+    
+    # We're configured as a stateful resource. We must start as
+    # slave by default. At this point we don't know if the CRM has
+    # already promoted a master. So, we simply start in read only
+    # mode and make sure our old score is invalidated.
+    set_read_only on
+    $CRM_MASTER -D
+
+    # Now, let's see whether there is a master. We might be a new
+    # node that is just joining the cluster, and the CRM may have
+    # promoted a master before.
+    new_master_host=$(echo $OCF_RESKEY_CRM_meta_notify_master_uname|tr -d " ")
+    if [ "$new_master_host" -a "$new_master_host" != ${NODENAME} ]; then
+        set_master
+        start_slave
+        if [ $? -ne 0 ]; then
+            ocf_exit_reason "Failed to start slave"
+            return $OCF_ERR_GENERIC
         fi
-
-        # We also need to set a master preference, otherwise Pacemaker
-        # won't ever promote us in the absence of any explicit
-        # preference set by the administrator. We choose a low
-        # greater-than-zero preference.
-        $CRM_MASTER -v 1
-
+    else
+        ocf_log info "No MariaDB master present - clearing replication state, setting gtid in attrd, waiting for first master"
+        unset_master
+        set_waiting_for_first_master
     fi
-
+    
     # Initial monitor action
     if [ -n "$OCF_RESKEY_test_table" -a -n "$OCF_RESKEY_test_user" -a -n "$OCF_RESKEY_test_passwd" ]; then
         OCF_CHECK_LEVEL=10
     fi
+
     mysql_monitor
     rc=$?
     if [ $rc != $OCF_SUCCESS -a $rc != $OCF_RUNNING_MASTER ]; then
@@ -848,18 +854,16 @@ mysql_start() {
         return $rc
     fi
 
-    ocf_log info "MySQL started"
+    ocf_log info "MariaDB started"
     return $OCF_SUCCESS
 }
 
 mysql_stop() {
-    if ocf_is_ms; then
-        # clear preference for becoming master
-        $CRM_MASTER -D
+    # clear preference for becoming master
+    $CRM_MASTER -D
 
-        # Remove VIP capability
-        set_reader_attr 0
-    fi
+    # Remove VIP capability
+    set_reader_attr 0
 
     mysql_common_stop
 }
@@ -873,22 +877,21 @@ mysql_promote() {
     ocf_run $MYSQL $MYSQL_OPTIONS_REPL \
         -e "STOP SLAVE"
 
+    set_read_only off || return $OCF_ERR_GENERIC
+    # Force the master to wait for timeout period on slave disconnect
+    ocf_run -q $MYSQL $MYSQL_OPTIONS_TEST \
+            -e "SET GLOBAL rpl_semi_sync_master_wait_no_slave='ON';"
+    
     # Set Master Info in CIB, cluster level attribute
-    update_data_master_status
-    master_info="$(get_local_ip)|$(get_master_status File)|$(get_master_status Position)"
+    master_info="$(get_local_ip)"
     ${CRM_ATTR_REPL_INFO} -v "$master_info"
-    rm -f $tmpfile
-
-    set_read_only off || return $OCF_ERR_GENERIC
-
-    # Existing master gets a higher-than-default master preference, so
-    # the cluster manager does not shuffle the master role around
-    # unnecessarily
-    $CRM_MASTER -v $((${OCF_RESKEY_max_slave_lag}+1))
-
+    
     # A master can accept reads
     set_reader_attr 1
 
+    # Clear the gtids in attrd now that there is a master
+    clear_all_gtid
+
     return $OCF_SUCCESS
 }
 
@@ -897,19 +900,16 @@ mysql_demote() {
         return $OCF_NOT_RUNNING
     fi
 
+    # Return to default no wait setting.
+    ocf_run -q $MYSQL $MYSQL_OPTIONS_TEST \
+            -e "SET GLOBAL rpl_semi_sync_master_wait_no_slave='OFF';"
+
     # Return master preference to default, so the cluster manager gets
     # a chance to select a new master
-    $CRM_MASTER -v 1
+    $CRM_MASTER -D
 }
 
 mysql_notify() {
-    # If not configured as a Stateful resource, we make no sense of
-    # notifications.
-    if ! ocf_is_ms; then
-        ocf_log info "This agent makes no use of notifications unless running in master/slave mode."
-        return $OCF_SUCCESS
-    fi
-
     local type_op
     type_op="${OCF_RESKEY_CRM_meta_notify_type}-${OCF_RESKEY_CRM_meta_notify_operation}"
 
@@ -917,24 +917,23 @@ mysql_notify() {
 
     case "$type_op" in
         'pre-promote')
-            # Nothing to do now here, new replication info not yet published
-
+            # A master is now being promoted, remove the waiting-for-first-master flag
+            clear_waiting_for_first_master
         ;;
         'post-promote')
             # The master has completed its promotion. Now is a good
             # time to check whether our replication slave is working
             # correctly.
-            master_host=`echo $OCF_RESKEY_CRM_meta_notify_promote_uname|tr -d " "`
-            if [ "$master_host" = ${NODENAME} ]; then
+            new_master_host=$(echo $OCF_RESKEY_CRM_meta_notify_promote_uname|tr -d " ")
+            if [ "$new_master_host" = ${NODENAME} ]; then
                 ocf_log info "This will be the new master, ignoring post-promote notification."
             else
-                ocf_log info "Resetting replication"
+                ocf_log info "Resetting replication, uname of master: $new_master_host"
                 unset_master
                 if [ $? -ne 0 ]; then
                     return $OCF_ERR_GENERIC
                 fi
 
-                ocf_log info "Changing MySQL configuration to replicate from $master_host"
                 set_master
                 if [ $? -ne 0 ]; then
                     return $OCF_ERR_GENERIC
@@ -949,9 +948,9 @@ mysql_notify() {
             return $OCF_SUCCESS
         ;;
         'pre-demote')
-            demote_host=`echo $OCF_RESKEY_CRM_meta_notify_demote_uname|tr -d " "`
+            demote_host=$(echo $OCF_RESKEY_CRM_meta_notify_demote_uname|tr -d " ")
             if [ $demote_host = ${NODENAME} ]; then
-                ocf_log info "post-demote notification for $demote_host"
+                ocf_log info "pre-demote notification for $demote_host"
                 set_read_only on
                 if [ $? -ne 0 ]; then
                     ocf_exit_reason "Failed to set read-only";
@@ -960,23 +959,21 @@ mysql_notify() {
 
                 # Must kill all existing user threads because they are still Read/write
                 # in order for the slaves to complete the read of binlogs
-                local tmpfile
-                tmpfile=`mktemp ${HA_RSCTMP}/threads.${OCF_RESOURCE_INSTANCE}.XXXXXX`
-                $MYSQL $MYSQL_OPTIONS_REPL \
-                -e "SHOW PROCESSLIST" > $tmpfile
-
-                for thread in `awk '$0 !~ /Binlog Dump|system user|event_scheduler|SHOW PROCESSLIST/ && $0 ~ /^[0-9]/ {print $1}' $tmpfile`
+                local tmpfile=$(mktemp ${HA_RSCTMP}/threads.${OCF_RESOURCE_INSTANCE}.XXXXXX)
+                $MYSQL $MYSQL_OPTIONS_REPL -e "SHOW PROCESSLIST" > $tmpfile
+                for thread in $(awk '$0 !~ /Binlog Dump|system user|event_scheduler|SHOW PROCESSLIST/ && $0 ~ /^[0-9]/ {print $1}' $tmpfile)
                 do
                     ocf_run $MYSQL $MYSQL_OPTIONS_REPL \
                         -e "KILL ${thread}"
                 done
+                rm -f $tmpfile
             else
                ocf_log info "Ignoring post-demote notification execpt for my own demotion."
             fi
             return $OCF_SUCCESS
         ;;
         'post-demote')
-            demote_host=`echo $OCF_RESKEY_CRM_meta_notify_demote_uname|tr -d " "`
+            demote_host=$(echo $OCF_RESKEY_CRM_meta_notify_demote_uname|tr -d " ")
             if [ $demote_host = ${NODENAME} ]; then
                 ocf_log info "Ignoring post-demote notification for my own demotion."
                 return $OCF_SUCCESS
diff --git a/heartbeat/minio b/heartbeat/minio
index 6d11956..8b47561 100755
--- a/heartbeat/minio
+++ b/heartbeat/minio
@@ -99,11 +99,11 @@ For example, "/etc/minio"
 </parameters>
 
 <actions>
-<action name="start"   timeout="20" />
-<action name="stop"    timeout="20" />
-<action name="monitor" depth="0"  timeout="20" interval="60" />
-<action name="validate-all"  timeout="2" />
-<action name="meta-data"  timeout="5" />
+<action name="start"   timeout="20s" />
+<action name="stop"    timeout="20s" />
+<action name="monitor" depth="0"  timeout="20s" interval="60s" />
+<action name="validate-all"  timeout="2s" />
+<action name="meta-data"  timeout="5s" />
 </actions>
 
 </resource-agent>
diff --git a/heartbeat/sg_persist b/heartbeat/mpathpersist
similarity index 62%
copy from heartbeat/sg_persist
copy to heartbeat/mpathpersist
index 7800474..beada54 100755
--- a/heartbeat/sg_persist
+++ b/heartbeat/mpathpersist
@@ -1,13 +1,14 @@
 #!/bin/bash
 #
 #
-#   OCF Resource Agent compliant PERSISTENT SCSI RESERVATION resource script.
+#   OCF Resource Agent compliant PERSISTENT SCSI RESERVATION on multipath devices resource script.
+#   Testversion for a mpathpersist implementation for demo purposes by Andreas Thomas
 #
+# Copyright (c) 2017 Evgeny Nifontov, lwang at suse.com, 
+#                    Andreas Tomas<Andreas.Tomas at suse.com>,
+#                    Zhu Lingshan<lszhu at suse.com> 
+#                    All Rights Reserved.
 #
-# Copyright (c) 2011 Evgeny Nifontov and lwang at suse.com All Rights Reserved.
-#
-# "Heartbeat drbd OCF Resource Agent: 2007, Lars Marowsky-Bree" was used 
-# as example of multistate OCF Resource Agent.
 #
 # 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
@@ -32,7 +33,7 @@
 # OCF instance parameters
 #    OCF_RESKEY_binary
 #    OCF_RESKEY_devs
-#    OCF_RESKEY_required_devs_nof
+#    OCF_RESKEY_required_devs_no
 #    OCF_RESKEY_reservation_type
 #    OCF_RESKEY_master_score_base
 #    OCF_RESKEY_master_score_dev_factor
@@ -41,9 +42,17 @@
 # TODO
 # 
 # 1) PROBLEM: devices which were not accessible during 'start' action, will be never registered/reserved 
-#    TODO:    'Master' and 'Salve' registers new devs in 'monitor' action
+#    TODO:    'Master' and 'Slave' registers new devs in 'monitor' action
 #    TODO:    'Master' reserves new devs in 'monitor' action
 
+#Defaults
+OCF_RESKEY_mpathpersist_binary_default="mpathpersist"
+OCF_RESKEY_required_devs_no_default=1
+OCF_RESKEY_reservation_type_default=1
+OCF_RESKEY_master_score_base_default=0
+OCF_RESKEY_master_score_dev_factor_default=100
+OCF_RESKEY_master_score_delay_default=30
+
 #######################################################################
 # Initialization:
 
@@ -51,13 +60,12 @@
 . ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
 
 # set default values
-    : ${sg_persist_binary="sg_persist"}     # binary name for the resource
-    : ${devs=""}                            # device list
-    : ${required_devs_nof=1}                # number of required devices
-    : ${reservation_type=1}                 # reservation type
-    : ${master_score_base=0}                # master score base 
-    : ${master_score_dev_factor=100}        # device factor for master score
-    : ${master_score_delay=30}              # delay for master score
+: ${OCF_RESKEY_mpathpersist_binary=${OCF_RESKEY_mpathpersist_binary_default}}		# binary name for the resource
+: ${OCF_RESKEY_required_devs_no=${OCF_RESKEY_required_devs_no_default}}			# number of required devices
+: ${OCF_RESKEY_reservation_type=${OCF_RESKEY_reservation_type_default}}			# reservation type
+: ${OCF_RESKEY_master_score_base=${OCF_RESKEY_master_score_base_default}}		# master score base
+: ${OCF_RESKEY_master_score_dev_factor=${OCF_RESKEY_master_score_dev_factor_default}}	# device factor for master score
+: ${OCF_RESKEY_master_score_delay=${OCF_RESKEY_master_score_delay_default}}		# delay for master score
 
 #######################################################################
 
@@ -66,17 +74,18 @@ meta_data() {
     cat <<END
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="sg_persist">
+<resource-agent name="mpathpersist">
 <version>1.1</version>
 
 <longdesc lang="en">
-This resource agent manages SCSI PERSISTENT RESERVATIONS.
-"sg_persist" from sg3_utils is used, please see its documentation.
+This resource agent manages SCSI persistent reservations on multipath devices.
+"mpathpersist" from multipath-tools is used, please see its documentation.
 Should be used as multistate (Master/Slave) resource
-Slave registers its node id ("crm_node -i") as reservation key ( --param-rk ) on each device in the "devs" list.
-Master reservs all devices from "devs" list with reservation "--prout-type" value from "reservation_type" parameter.
+Slave registers its node id ("crm_node -i") as reservation key ( --param-sark ) on each device in the params "devs" list.
+Master reservs all devices from params "devs" list with reservation "--prout-type" value from "reservation_type" parameter.
+Please see man sg_persist(8) and mpathpersist(8) for reservation_type details.
 </longdesc>
-<shortdesc lang="en">Manages SCSI PERSISTENT RESERVATIONS</shortdesc>
+<shortdesc lang="en">Manages SCSI persistent reservations on multipath devices</shortdesc>
 
 <parameters>
 <parameter name="binary" unique="0">
@@ -84,7 +93,7 @@ Master reservs all devices from "devs" list with reservation "--prout-type" valu
 The name of the binary that manages the resource.
 </longdesc>
 <shortdesc lang="en">the binary name of the resource</shortdesc>
-<content type="string" default="$sg_persist_binary"/>
+<content type="string" default="${OCF_RESKEY_mpathpersist_binary_default}"/>
 </parameter>
 
 <parameter name="devs" unique="0" required="1">
@@ -96,18 +105,18 @@ Shell wildcars are allowed.
 <content type="string"/>
 </parameter>
 
-<parameter name="required_devs_nof" unique="0" required="0">
+<parameter name="required_devs_no" unique="0" required="0">
 <longdesc lang="en">
 Minimum number of "working" devices from device list
       1) existing 
-      2) "sg_persist --read-keys \$device" works (Return code 0)
-resource actions "start","monitor","promote" and "validate-all" return "\$OCF_ERR_INSTALLED"
-if the actual number of "working" devices is less then "required_devs_nof".
+      2) "mpathpersist --in --read-keys <device>" works (Return code 0)
+resource actions "start","monitor","promote" and "validate-all" return "OCF_ERR_INSTALLED"
+if the actual number of "working" devices is less than "required_devs_no".
 resource actions "stop" and "demote" tries to remove reservations and registration keys from 
-all working devices, but always return "\$OCF_SUCCESS"
+all working devices, but always return "OCF_SUCCESS"
 </longdesc>
 <shortdesc lang="en">minimum number of working devices</shortdesc>
-<content type="string" default="1"/>
+<content type="string" default="${OCF_RESKEY_required_devs_no_default}"/>
 </parameter>
 
 <parameter name="reservation_type" unique="0" required="0">
@@ -115,18 +124,18 @@ all working devices, but always return "\$OCF_SUCCESS"
 reservation type 
 </longdesc>
 <shortdesc lang="en">reservation type</shortdesc>
-<content type="string" default="1" />
+<content type="string" default="${OCF_RESKEY_reservation_type_default}" />
 </parameter>
 
 <parameter name="master_score_base" unique="0" required="0">
 <longdesc lang="en">
 master_score_base value
 "master_score_base" value is used in "master_score" calculation:
-master_score = \$master_score_base + \$master_score_dev_factor * \$working_devs  
-if set to bigger value in sg_persist resource configuration on some node, this node will be "preferred" for master role. 
+master_score = master_score_base + master_score_dev_factor * working_devs
+if set to bigger value in mpathpersist resource configuration on some node, this node will be "preferred" for master role. 
 </longdesc>
 <shortdesc lang="en">base master_score value</shortdesc>
-<content type="string" default="0" />
+<content type="string" default="${OCF_RESKEY_master_score_base_default}" />
 </parameter>
 
 <parameter name="master_score_dev_factor" unique="0" required="0">
@@ -137,32 +146,32 @@ so the node that sees more devices will be preferred for the "Master"-role
 Setting it to 0 will disable this behavior. 
 </longdesc>
 <shortdesc lang="en">working device factor in master_score calculation</shortdesc>
-<content type="string" default="100" />
+<content type="string" default="${OCF_RESKEY_master_score_dev_factor_default}" />
 </parameter>
 
 <parameter name="master_score_delay" unique="0" required="0">
 <longdesc lang="en">
-master/slave decreases/increases its master_score after delay of \$master_score_delay seconds
+master/slave decreases/increases its master_score after delay of "master_score_delay" seconds
 so if some device gets inaccessible, the slave decreases its master_score first and the resource will no be watched
 and after this device reappears again the master increases its master_score first
 this can work only if the master_score_delay is bigger then monitor interval on both master and slave
 Setting it to 0 will disable this behavior.
 </longdesc>
 <shortdesc lang="en">master_score decrease/increase delay time</shortdesc>
-<content type="string" default="30" />
+<content type="string" default="${OCF_RESKEY_master_score_delay_default}" />
 </parameter>
 </parameters>
 
 <actions>
-<action name="start"   timeout="30" />
-<action name="promote"   timeout="30" />
-<action name="demote"   timeout="30" />
-<action name="notify"   timeout="30" />
-<action name="stop"    timeout="30" />
-<action name="monitor" depth="0"  timeout="20" interval="29" role="Slave" />
-<action name="monitor" depth="0"  timeout="20" interval="60" role="Master" />
-<action name="meta-data"  timeout="5" />
-<action name="validate-all"  timeout="30" />
+<action name="start"   timeout="30s" />
+<action name="promote"   timeout="30s" />
+<action name="demote"   timeout="30s" />
+<action name="notify"   timeout="30s" />
+<action name="stop"    timeout="30s" />
+<action name="monitor" depth="0"  timeout="20s" interval="29s" role="Slave" />
+<action name="monitor" depth="0"  timeout="20s" interval="60s" role="Master" />
+<action name="meta-data"  timeout="5s" />
+<action name="validate-all"  timeout="30s" />
 </actions>
 </resource-agent>
 END
@@ -170,21 +179,21 @@ END
     exit $OCF_SUCCESS
 }
 
-sg_persist_init() {
+mpathpersist_init() {
     
     if ! ocf_is_root ; then
         ocf_log err "You must be root to perform this operation."
         exit $OCF_ERR_PERM
     fi 
 
-    SG_PERSIST=${OCF_RESKEY_binary:-"$sg_persist_binary"}
-    check_binary $SG_PERSIST
+    MPATHPERSIST="${OCF_RESKEY_mpathpersist_binary}"
+    check_binary $MPATHPERSIST
     
     ROLE=$OCF_RESKEY_CRM_meta_role
     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 
@@ -208,15 +217,15 @@ sg_persist_init() {
 
     ocf_log debug "$RESOURCE: NODE:$NODE, ROLE:$ROLE, NODE_ID DEC:$NODE_ID_DEC HEX:$NODE_ID_HEX"
 
-    DEVS=${OCF_RESKEY_devs:=$devs}
-    REQUIRED_DEVS_NOF=${OCF_RESKEY_required_devs_nof:=$required_devs_nof}
-    RESERVATION_TYPE=${OCF_RESKEY_reservation_type:=$reservation_type}
-    MASTER_SCORE_BASE=${OCF_RESKEY_master_score_base:=$master_score_base}
-    MASTER_SCORE_DEV_FACTOR=${OCF_RESKEY_master_score_dev_factor:=$master_score_dev_factor}
-    MASTER_SCORE_DELAY=${OCF_RESKEY_master_score_delay:=$master_score_delay}
+    DEVS="${OCF_RESKEY_devs}"
+    REQUIRED_DEVS_NO="${OCF_RESKEY_required_devs_no}"
+    RESERVATION_TYPE="${OCF_RESKEY_reservation_type}"
+    MASTER_SCORE_BASE="${OCF_RESKEY_master_score_base}"
+    MASTER_SCORE_DEV_FACTOR="${OCF_RESKEY_master_score_dev_factor}"
+    MASTER_SCORE_DELAY="${OCF_RESKEY_master_score_delay}"
 
     ocf_log debug "$RESOURCE: DEVS=$DEVS"
-    ocf_log debug "$RESOURCE: REQUIRED_DEVS_NOF=$REQUIRED_DEVS_NOF"
+    ocf_log debug "$RESOURCE: REQUIRED_DEVS_NO=$REQUIRED_DEVS_NO"
     ocf_log debug "$RESOURCE: RESERVATION_TYPE=$RESERVATION_TYPE"
     ocf_log debug "$RESOURCE: MASTER_SCORE_BASE=$MASTER_SCORE_BASE"
     ocf_log debug "$RESOURCE: MASTER_SCORE_DEV_FACTOR=$MASTER_SCORE_DEV_FACTOR"
@@ -230,11 +239,11 @@ sg_persist_init() {
         exit $OCF_ERR_INSTALLED
     fi
  
-    sg_persist_check_devs
-    sg_persist_get_status
+    mpathpersist_check_devs
+    mpathpersist_get_status
 }
 
-sg_persist_action_usage() {
+mpathpersist_action_usage() {
     cat <<END
     usage: $0 {start|stop|monitor|validate-all|promote|demote|notify|meta-data}
 
@@ -242,53 +251,52 @@ sg_persist_action_usage() {
 END
 }
 
-sg_persist_get_status() {
+mpathpersist_get_status() {
 
     unset WORKING_DEVS[*]
     
     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\$
+        READ_KEYS=`$MPATHPERSIST --in --read-keys $dev 2>&1`
         if [ $? -eq 0 ]; then
-            RESERVED_DEVS+=($dev)
-        fi
+            WORKING_DEVS+=($dev)
+            echo "$READ_KEYS" | $GREP -w $NODE_ID_HEX\$ >/dev/null
+            if [ $? -eq 0 ]; then 
+                REGISTERED_DEVS+=($dev)
+
+                READ_RESERVATION=`$MPATHPERSIST --in --read-reservation $dev 2>&1`
+                if [ $? -eq 0 ]; then
+                    echo "$READ_RESERVATION" | $GREP -w $NODE_ID_HEX\$ >/dev/null
+                    if [ $? -eq 0 ]; then 
+                        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)
+                    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
         fi
     done
 
-    WORKING_DEVS_NOF=${#WORKING_DEVS[*]}
+    WORKING_DEVS_NO=${#WORKING_DEVS[*]}
 
-    ocf_log debug "$RESOURCE: working devices: `sg_persist_echo_array ${WORKING_DEVS[*]}`"
-    ocf_log debug "$RESOURCE: number of working devices: $WORKING_DEVS_NOF"
+    ocf_log debug "$RESOURCE: working devices: `mpathpersist_echo_array ${WORKING_DEVS[*]}`"
+    ocf_log debug "$RESOURCE: number of working devices: $WORKING_DEVS_NO"
     
-    ocf_log debug "$RESOURCE: registered devices: `sg_persist_echo_array ${REGISTERED_DEVS[*]}`"
-    ocf_log debug "$RESOURCE: reserved devices: `sg_persist_echo_array ${RESERVED_DEVS[*]}`"
-    ocf_log debug "$RESOURCE: devices with reservation: `sg_persist_echo_array ${DEVS_WITH_RESERVATION[*]}`"
-    ocf_log debug "$RESOURCE: reservation keys: `sg_persist_echo_array ${RESERVATION_KEYS[*]}`"
+    ocf_log debug "$RESOURCE: registered devices: `mpathpersist_echo_array ${REGISTERED_DEVS[*]}`"
+    ocf_log debug "$RESOURCE: reserved devices: `mpathpersist_echo_array ${RESERVED_DEVS[*]}`"
+    ocf_log debug "$RESOURCE: devices with reservation: `mpathpersist_echo_array ${DEVS_WITH_RESERVATION[*]}`"
+    ocf_log debug "$RESOURCE: reservation keys: `mpathpersist_echo_array ${RESERVATION_KEYS[*]}`"
     
-    MASTER_SCORE=$(($MASTER_SCORE_BASE + $MASTER_SCORE_DEV_FACTOR*$WORKING_DEVS_NOF))
-    ocf_log debug "$RESOURCE: master_score: $MASTER_SCORE_BASE + $MASTER_SCORE_DEV_FACTOR*$WORKING_DEVS_NOF = $MASTER_SCORE"
+    MASTER_SCORE=$(($MASTER_SCORE_BASE + $MASTER_SCORE_DEV_FACTOR*$WORKING_DEVS_NO))
+    ocf_log debug "$RESOURCE: master_score: $MASTER_SCORE_BASE + $MASTER_SCORE_DEV_FACTOR*$WORKING_DEVS_NO = $MASTER_SCORE"
 
 }
 
-sg_persist_check_devs() {
+mpathpersist_check_devs() {
 
     for dev in $DEVS 
     do
@@ -297,15 +305,15 @@ sg_persist_check_devs() {
         fi
     done
 
-    EXISTING_DEVS_NOF=${#EXISTING_DEVS[*]}
-    if [ $EXISTING_DEVS_NOF -lt $REQUIRED_DEVS_NOF ]; then 
-        ocf_log err "Number of existing devices=$EXISTING_DEVS_NOF less then required_devs_nof=$REQUIRED_DEVS_NOF"
+    EXISTING_DEVS_NO=${#EXISTING_DEVS[*]}
+    if [ $EXISTING_DEVS_NO -lt $REQUIRED_DEVS_NO ]; then 
+        ocf_log err "Number of existing devices=$EXISTING_DEVS_NO less then required_devs_no=$REQUIRED_DEVS_NO"
         exit $OCF_ERR_INSTALLED
     fi
 
 }
 
-sg_persist_is_registered() {
+mpathpersist_is_registered() {
     for registered_dev in ${REGISTERED_DEVS[*]}
     do
         if [ "$registered_dev" == "$1" ]; then
@@ -315,7 +323,7 @@ sg_persist_is_registered() {
     return 1
 }
 
-sg_persist_get_reservation_key() {
+mpathpersist_get_reservation_key() {
     for array_index in ${!DEVS_WITH_RESERVATION[*]}
     do
         if [ "${DEVS_WITH_RESERVATION[$array_index]}" == "$1" ]; then
@@ -326,7 +334,7 @@ sg_persist_get_reservation_key() {
     echo ""
 }
 
-sg_persist_echo_array() {
+mpathpersist_echo_array() {
     str_count=0
     arr_str=""
 
@@ -338,7 +346,7 @@ sg_persist_echo_array() {
     echo $arr_str
 }
 
-sg_persist_parse_act_pending() {
+mpathpersist_parse_act_pending() {
     
     ACT_PENDING_TS=0
     ACT_PENDING_SCORE=0
@@ -349,19 +357,19 @@ sg_persist_parse_act_pending() {
     fi
 }
 
-sg_persist_clear_pending() {
+mpathpersist_clear_pending() {
     if [ -n "$ACT_PENDING" ]; then 
         DO_PENDING_UPDATE="YES"
         NEW_PENDING=""
     fi
 }
 
-sg_persist_new_master_score() {
+mpathpersist_new_master_score() {
     DO_MASTER_SCORE_UPDATE="YES"
     NEW_MASTER_SCORE=$1
 }
 
-sg_persist_new_pending() {
+mpathpersist_new_pending() {
     DO_PENDING_UPDATE="YES"
     NEW_PENDING=$1
 }
@@ -369,22 +377,22 @@ sg_persist_new_pending() {
 
 # Functions invoked by resource manager actions
 
-sg_persist_action_start() {
+mpathpersist_action_start() {
 
     ocf_run $MASTER_SCORE_ATTRIBUTE --update=$MASTER_SCORE
     ocf_run $PENDING_ATTRIBUTE --update=""
 
-    if [ $WORKING_DEVS_NOF -lt $REQUIRED_DEVS_NOF ]; then
-        ocf_log err "$RESOURCE: Number of working devices=$WORKING_DEVS_NOF less then required_devs_nof=$REQUIRED_DEVS_NOF"
+    if [ $WORKING_DEVS_NO -lt $REQUIRED_DEVS_NO ]; then
+        ocf_log err "$RESOURCE: Number of working devices=$WORKING_DEVS_NO less then required_devs_no=$REQUIRED_DEVS_NO"
         exit $OCF_ERR_GENERIC
     fi
 
     for dev in ${WORKING_DEVS[*]}
     do
-        if sg_persist_is_registered $dev ; then
+        if mpathpersist_is_registered $dev ; then
             : OK
         else
-            ocf_run $SG_PERSIST --out --no-inquiry --register --param-rk=0 --param-sark=$NODE_ID_HEX $dev
+            ocf_run $MPATHPERSIST --out --register --param-sark=$NODE_ID_HEX $dev
             if [ $? -ne $OCF_SUCCESS ]
             then
                 return $OCF_ERR_GENERIC
@@ -395,7 +403,7 @@ sg_persist_action_start() {
     return $OCF_SUCCESS
 }
 
-sg_persist_action_stop() {
+mpathpersist_action_stop() {
 
     if [ ${#REGISTERED_DEVS[*]} -eq 0 ]; then
         ocf_log debug "$RESOURCE stop: already no registrations"
@@ -406,22 +414,22 @@ sg_persist_action_stop() {
 
         for dev in ${REGISTERED_DEVS[*]}
         do
-            ocf_run $SG_PERSIST --out --no-inquiry --register --param-rk=$NODE_ID_HEX --param-sark=0 $dev
+            ocf_run $MPATHPERSIST --out --register --param-rk=$NODE_ID_HEX $dev
         done
     fi
 
     return $OCF_SUCCESS
 }
 
-sg_persist_action_monitor() {
+mpathpersist_action_monitor() {
 
-    ACT_MASTER_SCORE=`$MASTER_SCORE_ATTRIBUTE --query --quiet 2>/dev/null`
+    ACT_MASTER_SCORE=`$MASTER_SCORE_ATTRIBUTE --query --quiet 2>&1`
     ocf_log debug "$RESOURCE monitor: ACT_MASTER_SCORE=$ACT_MASTER_SCORE"
     
-    ACT_PENDING=`$PENDING_ATTRIBUTE --query --quiet 2>/dev/null`
+    ACT_PENDING=`$PENDING_ATTRIBUTE --query --quiet 2>&1`
     ocf_log debug "$RESOURCE monitor: ACT_PENDING=$ACT_PENDING"
 
-    sg_persist_parse_act_pending
+    mpathpersist_parse_act_pending
     ocf_log debug "$RESOURCE monitor: ACT_PENDING_TS=$ACT_PENDING_TS"
     ocf_log debug "$RESOURCE monitor: ACT_PENDING_VAL=$ACT_PENDING_SCORE"
    
@@ -432,7 +440,7 @@ sg_persist_action_monitor() {
     if [ -n "$ACT_MASTER_SCORE" ] 
     then
         if [ $ACT_MASTER_SCORE -eq $MASTER_SCORE ]; then
-            sg_persist_clear_pending
+            mpathpersist_clear_pending
         else
             case $ROLE in
             Master)  
@@ -440,20 +448,20 @@ sg_persist_action_monitor() {
                     if [ -n "$ACT_PENDING" ] 
                     then
                         if [ $(($NOW-$ACT_PENDING_TS-$MASTER_SCORE_DELAY)) -ge 0 ]; then
-                            sg_persist_new_master_score $MASTER_SCORE
-                            sg_persist_clear_pending
+                            mpathpersist_new_master_score $MASTER_SCORE
+                            mpathpersist_clear_pending
                         fi
                     else
                         if [ $MASTER_SCORE_DELAY -eq 0 ]; then
-                            sg_persist_new_master_score $MASTER_SCORE
-                            sg_persist_clear_pending
+                            mpathpersist_new_master_score $MASTER_SCORE
+                            mpathpersist_clear_pending
                         else
-                            sg_persist_new_pending "${NOW}_${MASTER_SCORE}"
+                            mpathpersist_new_pending "${NOW}_${MASTER_SCORE}"
                         fi
                     fi
                 else
-                    sg_persist_new_master_score $MASTER_SCORE
-                    sg_persist_clear_pending
+                    mpathpersist_new_master_score $MASTER_SCORE
+                    mpathpersist_clear_pending
                 fi
                 ;;
 
@@ -461,20 +469,20 @@ sg_persist_action_monitor() {
                 if [ $MASTER_SCORE -gt $ACT_MASTER_SCORE ]; then
                     if [ -n "$ACT_PENDING" ]; then 
                         if [ $(($NOW-$ACT_PENDING_TS-$MASTER_SCORE_DELAY)) -ge 0 ]; then
-                            sg_persist_new_master_score $MASTER_SCORE
-                            sg_persist_clear_pending
+                            mpathpersist_new_master_score $MASTER_SCORE
+                            mpathpersist_clear_pending
                         fi
                     else
                         if [ $MASTER_SCORE_DELAY -eq 0 ]; then
-                            sg_persist_new_master_score $MASTER_SCORE
-                            sg_persist_clear_pending
+                            mpathpersist_new_master_score $MASTER_SCORE
+                            mpathpersist_clear_pending
                         else
-                            sg_persist_new_pending "${NOW}_${MASTER_SCORE}"
+                            mpathpersist_new_pending "${NOW}_${MASTER_SCORE}"
                         fi
                     fi
                 else
-                    sg_persist_new_master_score $MASTER_SCORE
-                    sg_persist_clear_pending
+                    mpathpersist_new_master_score $MASTER_SCORE
+                    mpathpersist_clear_pending
                 fi
                 ;;
 
@@ -519,7 +527,7 @@ sg_persist_action_monitor() {
     return $OCF_ERR_GENERIC
 }
 
-sg_persist_action_promote() {
+mpathpersist_action_promote() {
 
     if [ ${#RESERVED_DEVS[*]} -gt 0 ]; then 
         ocf_log info "$RESOURCE promote: already master"
@@ -528,16 +536,16 @@ sg_persist_action_promote() {
 
     for dev in ${WORKING_DEVS[*]}
     do
-        reservation_key=`sg_persist_get_reservation_key $dev`
+        reservation_key=`mpathpersist_get_reservation_key $dev`
         case $RESERVATION_TYPE in
         1|3|5|6)        
             if [ -z "$reservation_key" ]; then
-                ocf_run $SG_PERSIST --out --no-inquiry --reserve --param-rk=$NODE_ID_HEX --prout-type=$RESERVATION_TYPE $dev
+                ocf_run $MPATHPERSIST --out --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 --no-inquiry --preempt --param-sark=$reservation_key --param-rk=$NODE_ID_HEX --prout-type=$RESERVATION_TYPE $dev
+                ocf_run $MPATHPERSIST --out --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
@@ -546,7 +554,7 @@ sg_persist_action_promote() {
 
         7|8) 
             if [ -z "$reservation_key" ]; then
-                ocf_run $SG_PERSIST --out --no-inquiry --reserve --param-rk=$NODE_ID_HEX --prout-type=$RESERVATION_TYPE $dev
+                ocf_run $MPATHPERSIST --out --reserve --param-rk=$NODE_ID_HEX --prout-type=$RESERVATION_TYPE $dev
                 if [ $? -ne $OCF_SUCCESS ]
                 then
                     return $OCF_ERR_GENERIC
@@ -567,7 +575,7 @@ sg_persist_action_promote() {
     return $OCF_SUCCESS
 }
 
-sg_persist_action_demote() {
+mpathpersist_action_demote() {
     case $RESERVATION_TYPE in
     1|3|5|6)
         if [ ${#RESERVED_DEVS[*]} -eq 0 ]; then 
@@ -577,7 +585,7 @@ sg_persist_action_demote() {
 
         for dev in ${RESERVED_DEVS[*]}
         do
-            ocf_run $SG_PERSIST --out --no-inquiry --release --param-rk=$NODE_ID_HEX --prout-type=$RESERVATION_TYPE $dev
+            ocf_run $MPATHPERSIST --out --release --param-rk=$NODE_ID_HEX --prout-type=$RESERVATION_TYPE $dev
             if [ $? -ne  $OCF_SUCCESS ]; then
                return $OCF_ERR_GENERIC
             fi
@@ -592,7 +600,7 @@ sg_persist_action_demote() {
 
         for dev in ${REGISTERED_DEVS[*]}
         do
-            ocf_run $SG_PERSIST --out --no-inquiry --register --param-rk=$NODE_ID_HEX --param-sark=0 $dev
+            ocf_run $MPATHPERSIST --out --register --param-rk=$NODE_ID_HEX --param-sark=0 $dev
             if [ $? -ne $OCF_SUCCESS ]; then
                return $OCF_ERR_GENERIC
             fi
@@ -607,7 +615,7 @@ sg_persist_action_demote() {
     return $OCF_SUCCESS
 }
 
-sg_persist_action_notify() {
+mpathpersist_action_notify() {
     local n_type="$OCF_RESKEY_CRM_meta_notify_type"
     local n_op="$OCF_RESKEY_CRM_meta_notify_operation"
     set -- $OCF_RESKEY_CRM_meta_notify_active_resource
@@ -622,7 +630,7 @@ sg_persist_action_notify() {
     return $OCF_SUCCESS
 }
 
-sg_persist_action_validate_all () {
+mpathpersist_action_validate_all () {
 
     if [ "$OCF_RESKEY_CRM_meta_master_max" != "1" ] && [ "$RESERVATION_TYPE"  != "7" ] && [ "$RESERVATION_TYPE" != "8" ]; then
         ocf_log err "Master options misconfigured."
@@ -634,7 +642,7 @@ sg_persist_action_validate_all () {
 
 if [ $# -ne 1 ]; then
     echo "Incorrect parameter count."
-    sg_persist_action_usage
+    mpathpersist_action_usage
     exit $OCF_ERR_ARGS
 fi
 
@@ -645,29 +653,29 @@ case $ACTION in
         ;;
         
     validate-all)    
-        sg_persist_init
-        sg_persist_action_validate_all
+        mpathpersist_init
+        mpathpersist_action_validate_all
         ;;
 
     start|promote|monitor|stop|demote)
         ocf_log debug "$RESOURCE: starting action \"$ACTION\""
-        sg_persist_init
-        sg_persist_action_$ACTION
+        mpathpersist_init
+        mpathpersist_action_$ACTION
         exit $?
         ;;
         
     notify)    
-        sg_persist_action_notify
+        mpathpersist_action_notify
         exit $?
         ;;
 
     usage|help)    
-        sg_persist_action_usage
+        mpathpersist_action_usage
         exit $OCF_SUCCESS
         ;;
 
     *)  
-        sg_persist_action_usage
+        mpathpersist_action_usage
         exit $OCF_ERR_ARGS
         ;;
 
diff --git a/heartbeat/mysql b/heartbeat/mysql
index 1b24248..ea674ec 100755
--- a/heartbeat/mysql
+++ b/heartbeat/mysql
@@ -284,17 +284,17 @@ whether a node is usable for clients to read from.</shortdesc>
 </parameters>
 
 <actions>
-<action name="start" timeout="120" />
-<action name="stop" timeout="120" />
-<action name="status" timeout="60" />
-<action name="monitor" depth="0" timeout="30" interval="20" />
-<action name="monitor" role="Master" depth="0" timeout="30" interval="10" />
-<action name="monitor" role="Slave" depth="0" timeout="30" interval="30" />
-<action name="promote" timeout="120" />
-<action name="demote" timeout="120" />
-<action name="notify" timeout="90" />
-<action name="validate-all" timeout="5" />
-<action name="meta-data" timeout="5" />
+<action name="start" timeout="120s" />
+<action name="stop" timeout="120s" />
+<action name="status" timeout="60s" />
+<action name="monitor" depth="0" timeout="30s" interval="20s" />
+<action name="monitor" role="Master" depth="0" timeout="30s" interval="10s" />
+<action name="monitor" role="Slave" depth="0" timeout="30s" interval="30s" />
+<action name="promote" timeout="120s" />
+<action name="demote" timeout="120s" />
+<action name="notify" timeout="90s" />
+<action name="validate-all" timeout="5s" />
+<action name="meta-data" timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/nagios b/heartbeat/nagios
index d2067bc..4cb462f 100755
--- a/heartbeat/nagios
+++ b/heartbeat/nagios
@@ -111,12 +111,12 @@ nagios_meta_data() {
 </parameters>
 
 <actions>
-<action name="start" timeout="20" />
-<action name="stop" timeout="20" />
-<action name="status" timeout="20" />
-<action name="monitor" depth="0" timeout="20" interval="10" start-delay="10" />
-<action name="validate-all" timeout="20" />
-<action name="meta-data" timeout="20" />
+<action name="start" timeout="20s" />
+<action name="stop" timeout="20s" />
+<action name="status" timeout="20s" />
+<action name="monitor" depth="0" timeout="20s" interval="10s" start-delay="10" />
+<action name="validate-all" timeout="20s" />
+<action name="meta-data" timeout="20s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/named b/heartbeat/named
index 4856cdc..a976b4a 100755
--- a/heartbeat/named
+++ b/heartbeat/named
@@ -180,14 +180,14 @@ IP Address where named listens.
 </parameters>
 
 <actions>
-<action name="start" timeout="60" />
-<action name="stop" timeout="60" />
-<action name="reload" timeout="60" />
-<action name="status" timeout="10" />
-<action name="monitor" depth="0" timeout="30" interval="30"/>
-<action name="meta-data" timeout="5" />
-<action name="validate-all" timeout="5" />
-<action name="methods" timeout="5" />
+<action name="start" timeout="60s" />
+<action name="stop" timeout="60s" />
+<action name="reload" timeout="60s" />
+<action name="status" timeout="10s" />
+<action name="monitor" depth="0" timeout="30s" interval="30s"/>
+<action name="meta-data" timeout="5s" />
+<action name="validate-all" timeout="5s" />
+<action name="methods" timeout="5s" />
 </actions>
 </resource-agent>
 
diff --git a/heartbeat/nfsnotify b/heartbeat/nfsnotify
index 6d4961f..20c03c4 100755
--- a/heartbeat/nfsnotify
+++ b/heartbeat/nfsnotify
@@ -86,12 +86,12 @@ arguments.
 </parameters>
 
 <actions>
-<action name="start"        timeout="90" />
-<action name="stop"         timeout="90" />
-<action name="monitor"      timeout="90" interval="30" depth="0" />
-<action name="reload"       timeout="90" />
-<action name="meta-data"    timeout="10" />
-<action name="validate-all"   timeout="20" />
+<action name="start"        timeout="90s" />
+<action name="stop"         timeout="90s" />
+<action name="monitor"      timeout="90s" interval="30s" depth="0" />
+<action name="reload"       timeout="90s" />
+<action name="meta-data"    timeout="10s" />
+<action name="validate-all"   timeout="20s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/nfsserver b/heartbeat/nfsserver
index 9ce465c..3d036a9 100755
--- a/heartbeat/nfsserver
+++ b/heartbeat/nfsserver
@@ -140,11 +140,11 @@ is_redhat_based && nfsserver_redhat_meta_data
 </parameters>
 
 <actions>
-<action name="start"   timeout="40" />
+<action name="start"   timeout="40s" />
 <action name="stop"    timeout="20s" />
-<action name="monitor" depth="0"  timeout="20s" interval="10" />
-<action name="meta-data"  timeout="5" />
-<action name="validate-all"  timeout="30" />
+<action name="monitor" depth="0"  timeout="20s" interval="10s" />
+<action name="meta-data"  timeout="5s" />
+<action name="validate-all"  timeout="30s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/nginx b/heartbeat/nginx
index ec9f702..020c797 100755
--- a/heartbeat/nginx
+++ b/heartbeat/nginx
@@ -793,8 +793,8 @@ Extra options to apply when starting nginx.
 <action name="monitor" timeout="30s" depth="10" interval="30s" />
 <action name="monitor" timeout="45s" depth="20" />
 <action name="monitor" timeout="60s" depth="30" />
-<action name="meta-data"  timeout="5" />
-<action name="validate-all"  timeout="5" />
+<action name="meta-data"  timeout="5s" />
+<action name="validate-all"  timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/ocf-binaries.in b/heartbeat/ocf-binaries.in
index cbf70db..db9912e 100644
--- a/heartbeat/ocf-binaries.in
+++ b/heartbeat/ocf-binaries.in
@@ -33,7 +33,6 @@ export PATH
 : ${MSGFMT:=msgfmt}
 : ${NETSTAT:=netstat}
 : ${PERL:=perl}
-: ${PYTHON:=python}
 : ${RAIDSTART:=raidstart}
 : ${RAIDSTOP:=raidstop}
 : ${ROUTE:=route}
diff --git a/heartbeat/ocf-shellfuncs.in b/heartbeat/ocf-shellfuncs.in
index adf2c1f..06cb203 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: 539ed604e3d6121d11fe4476d9d19e02699dd657
+# Build version: 5a1edf2b9d514a6526cdc2ae7218b6e75be2583a
 
 # 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
@@ -668,6 +668,15 @@ dirname()
 	return 0
 }
 
+# usage: systemd_is_running
+# returns:
+#    0  PID 1 is systemd
+#    1  otherwise
+systemd_is_running()
+{
+	[ "$(cat /proc/1/comm 2>/dev/null)" = "systemd" ]
+}
+
 # usage: systemd_drop_in <name> <After|Before> <dependency.service>
 systemd_drop_in()
 {
@@ -1010,7 +1019,11 @@ ocf_attribute_target() {
 		if [ x$OCF_RESKEY_CRM_meta_container_attribute_target = xhost -a x$OCF_RESKEY_CRM_meta_physical_host != x ]; then
 			echo $OCF_RESKEY_CRM_meta_physical_host
 		else
-			echo $OCF_RESKEY_CRM_meta_on_node
+			if [ x$OCF_RESKEY_CRM_meta_on_node != x ]; then
+				echo $OCF_RESKEY_CRM_meta_on_node
+			else
+				ocf_local_nodename
+			fi
 		fi
 		return
 	elif [ x"$OCF_RESKEY_CRM_meta_notify_all_uname" != x ]; then
diff --git a/heartbeat/oraasm b/heartbeat/oraasm
index 22b88ea..82aa165 100755
--- a/heartbeat/oraasm
+++ b/heartbeat/oraasm
@@ -70,12 +70,12 @@ If not specified, then the Disk Group along with its home should be listed in /e
 </parameters>
 
 <actions>
-<action name="start" timeout="60" />
-<action name="stop" timeout="60" />
-<action name="status" timeout="30" />
-<action name="monitor" depth="0" timeout="30" interval="10" />
-<action name="validate-all" timeout="5" />
-<action name="meta-data" timeout="5" />
+<action name="start" timeout="60s" />
+<action name="stop" timeout="60s" />
+<action name="status" timeout="30s" />
+<action name="monitor" depth="0" timeout="30s" interval="10s" />
+<action name="validate-all" timeout="5s" />
+<action name="meta-data" timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/oracle b/heartbeat/oracle
index 67e4385..9c190f9 100755
--- a/heartbeat/oracle
+++ b/heartbeat/oracle
@@ -218,13 +218,13 @@ Oracle instance we are willing to listen.
 </parameters>
 
 <actions>
-<action name="start" timeout="120" />
-<action name="stop" timeout="120" />
-<action name="status" timeout="5" />
-<action name="monitor" depth="0" timeout="30" interval="120" />
-<action name="validate-all" timeout="5" />
-<action name="methods" timeout="5" />
-<action name="meta-data" timeout="5" />
+<action name="start" timeout="120s" />
+<action name="stop" timeout="120s" />
+<action name="status" timeout="5s" />
+<action name="monitor" depth="0" timeout="30s" interval="120s" />
+<action name="validate-all" timeout="5s" />
+<action name="methods" timeout="5s" />
+<action name="meta-data" timeout="5s" />
 </actions>
 </resource-agent>
 END
@@ -388,7 +388,7 @@ 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";"
@@ -546,6 +546,7 @@ is_proc_running() {
 instance_live() {
 	local status=`monsql_one dbstat`
 	[ "$status" = OPEN ] && return 0
+	ocf_log warn "Unable to login as \"$MONUSR\", using \"sysdba\" user instead"
 	status=`dbasql_one dbstat`
 	if [ "$status" = OPEN ]; then
 		return 0
diff --git a/heartbeat/oralsnr b/heartbeat/oralsnr
index 83c5128..f415956 100755
--- a/heartbeat/oralsnr
+++ b/heartbeat/oralsnr
@@ -119,13 +119,13 @@ Defaults to LISTENER.
 </parameters>
 
 <actions>
-<action name="start" timeout="120" />
-<action name="stop" timeout="120" />
-<action name="status" timeout="60" />
-<action name="monitor" depth="0" timeout="30" interval="10" />
-<action name="validate-all" timeout="5" />
-<action name="meta-data" timeout="5" />
-<action name="methods" timeout="5" />
+<action name="start" timeout="120s" />
+<action name="stop" timeout="120s" />
+<action name="status" timeout="60s" />
+<action name="monitor" depth="0" timeout="30s" interval="10s" />
+<action name="validate-all" timeout="5s" />
+<action name="meta-data" timeout="5s" />
+<action name="methods" timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/pgagent b/heartbeat/pgagent
index cb51895..eea80fe 100755
--- a/heartbeat/pgagent
+++ b/heartbeat/pgagent
@@ -101,11 +101,11 @@ meta_data() {
 </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" />
+<action name="start" timeout="5s" />
+<action name="stop" timeout="5s" />
+<action name="monitor" timeout="20s" interval="10s" depth="0" />
+<action name="meta-data" timeout="5s" />
+<action name="validate-all" timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/pgsql b/heartbeat/pgsql
index 07d0507..637b3c8 100755
--- a/heartbeat/pgsql
+++ b/heartbeat/pgsql
@@ -452,17 +452,17 @@ wal receiver is not running in the master and the attribute shows status as
 </parameters>
 
 <actions>
-<action name="start" timeout="120" />
-<action name="stop" timeout="120" />
-<action name="status" timeout="60" />
-<action name="monitor" depth="0" timeout="30" interval="30"/>
-<action name="monitor" depth="0" timeout="30" interval="29" role="Master" />
-<action name="promote" timeout="120" />
-<action name="demote" timeout="120" />
-<action name="notify"   timeout="90" />
-<action name="meta-data" timeout="5" />
-<action name="validate-all" timeout="5" />
-<action name="methods" timeout="5" />
+<action name="start" timeout="120s" />
+<action name="stop" timeout="120s" />
+<action name="status" timeout="60s" />
+<action name="monitor" depth="0" timeout="30s" interval="30s"/>
+<action name="monitor" depth="0" timeout="30s" interval="29s" role="Master" />
+<action name="promote" timeout="120s" />
+<action name="demote" timeout="120s" />
+<action name="notify"   timeout="90s" />
+<action name="meta-data" timeout="5s" />
+<action name="validate-all" timeout="5s" />
+<action name="methods" timeout="5s" />
 </actions>
 </resource-agent>
 EOF
@@ -575,6 +575,8 @@ pgsql_real_start() {
         check_socket_dir
     fi
 
+    check_stat_temp_directory
+
     if [ "$OCF_RESKEY_rep_mode" = "slave" ]; then
         rm -f $RECOVERY_CONF
         make_recovery_conf || return $OCF_ERR_GENERIC
@@ -633,6 +635,7 @@ pgsql_real_start() {
 
 pgsql_replication_start() {
     local rc
+    local synchronous_standby_names
 
     # initializing for replication
     change_pgsql_status "$NODENAME" "STOP"
@@ -653,6 +656,13 @@ pgsql_replication_start() {
     if [ $? -ne $OCF_SUCCESS ]; then
         return $OCF_ERR_GENERIC
     fi
+
+    synchronous_standby_names=$(exec_sql "${CHECK_SYNCHRONOUS_STANDBY_NAMES_SQL}")
+    if [ -n "${synchronous_standby_names}" ]; then
+        ocf_exit_reason "Invalid synchronous_standby_names is set in postgresql.conf."
+        return $OCF_ERR_CONFIGURED
+    fi
+
     change_pgsql_status "$NODENAME" "HS:alone"
     return $OCF_SUCCESS
 }
@@ -1883,6 +1893,7 @@ pgsql_validate_all() {
         PROMOTE_ME="1000"
 
         CHECK_MS_SQL="select pg_is_in_recovery()"
+        CHECK_SYNCHRONOUS_STANDBY_NAMES_SQL="show synchronous_standby_names"
         ocf_version_cmp "$version" "10"
         if [ $? -eq 1 ] || [ $? -eq 2 ]; then
             CHECK_XLOG_LOC_SQL="select pg_last_wal_replay_lsn(),pg_last_wal_receive_lsn()"
@@ -1914,7 +1925,7 @@ pgsql_validate_all() {
         if [ $check_config_rc -eq 0 ]; then
             rep_mode_string="include '$REP_MODE_CONF' # added by pgsql RA"
             if [ "$OCF_RESKEY_rep_mode" = "sync" ]; then
-                if ! grep -q "$rep_mode_string" $OCF_RESKEY_config; then
+                if ! grep -q "^[[:space:]]*$rep_mode_string" $OCF_RESKEY_config; then
                     ocf_log info "adding include directive into $OCF_RESKEY_config"
                     echo "$rep_mode_string" >> $OCF_RESKEY_config
                 fi
@@ -1946,7 +1957,7 @@ pgsql_validate_all() {
             return $OCF_ERR_CONFIGURED
         fi
 
-        echo "$OCF_RESKEY_replication_slot_name" | grep -q -e [^a-z0-9_]
+        echo "$OCF_RESKEY_replication_slot_name" | grep -q -e '[^a-z0-9_]'
         if [ $? -eq 0 ]; then
             ocf_exit_reason "Invalid replication_slot_name($OCF_RESKEY_replication_slot_name). only use lower case letters, numbers, and the underscore character."
             return $OCF_ERR_CONFIGURED
@@ -1978,6 +1989,43 @@ check_log_file() {
 }
 
 #
+# Check if we need to create stats temp directory in tmpfs
+#
+
+check_stat_temp_directory() {
+    local stats_temp
+
+    stats_temp=`get_pgsql_param stats_temp_directory`
+
+    if [ -z "$stats_temp" ]; then
+        return
+    fi
+
+    if [ "${stats_temp#/}" = "$stats_temp" ]; then
+        stats_temp="$OCF_RESKEY_pgdata/$stats_temp"
+    fi
+
+    if [ -d "$stats_temp" ]; then
+        return
+    fi
+
+    if ! mkdir -p "$stats_temp"; then
+        ocf_exit_reason "Can't create directory $stats_temp"
+        exit $OCF_ERR_PERM
+    fi
+
+    if ! chown $OCF_RESKEY_pgdba: "$stats_temp"; then
+        ocf_exit_reason "Can't change ownership for $stats_temp"
+        exit $OCF_ERR_PERM
+    fi
+
+    if ! chmod 700 "$stats_temp"; then
+        ocf_exit_reason "Can't change permissions for $stats_temp"
+        exit $OCF_ERR_PERM
+    fi
+}
+
+#
 # Check socket directory
 #
 check_socket_dir() {
diff --git a/heartbeat/pingd b/heartbeat/pingd
index 205bda6..7e4d839 100755
--- a/heartbeat/pingd
+++ b/heartbeat/pingd
@@ -130,8 +130,8 @@ If set to true, suppresses the deprecation warning for this agent.
 <actions>
 <action name="start"   timeout="20s" />
 <action name="stop"    timeout="20s" />
-<action name="monitor" depth="0"  timeout="20s" interval="10" />
-<action name="meta-data"  timeout="5" />
+<action name="monitor" depth="0"  timeout="20s" interval="10s" />
+<action name="meta-data"  timeout="5s" />
 <action name="validate-all"  timeout="20s" />
 </actions>
 </resource-agent>
diff --git a/heartbeat/portblock b/heartbeat/portblock
index a518f49..0d27891 100755
--- a/heartbeat/portblock
+++ b/heartbeat/portblock
@@ -210,12 +210,12 @@ file name as a single argument. For csync2, set it to "csync2 -xv".
 </parameters>
 
 <actions>
-<action name="start" timeout="20" />
-<action name="stop" timeout="20" />
-<action name="status" depth="0" timeout="10" interval="10" />
-<action name="monitor" depth="0" timeout="10" interval="10" />
-<action name="meta-data" timeout="5" />
-<action name="validate-all" timeout="5" />
+<action name="start" timeout="20s" />
+<action name="stop" timeout="20s" />
+<action name="status" depth="0" timeout="10s" interval="10s" />
+<action name="monitor" depth="0" timeout="10s" interval="10s" />
+<action name="meta-data" timeout="5s" />
+<action name="validate-all" timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/pound b/heartbeat/pound
index 837d591..e77a00a 100755
--- a/heartbeat/pound
+++ b/heartbeat/pound
@@ -125,12 +125,12 @@ a time. Helps to fix the 'Too many open files' error message.
 </parameters>
 
 <actions>
-<action name="start"        timeout="20" />
-<action name="stop"         timeout="20" />
-<action name="monitor"      timeout="20" interval="10" depth="0" />
-<action name="status"       timeout="20" />
-<action name="meta-data"    timeout="5" />
-<action name="validate-all"   timeout="20" />
+<action name="start"        timeout="20s" />
+<action name="stop"         timeout="20s" />
+<action name="monitor"      timeout="20s" interval="10s" depth="0" />
+<action name="status"       timeout="20s" />
+<action name="meta-data"    timeout="5s" />
+<action name="validate-all"   timeout="20s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/rabbitmq-cluster b/heartbeat/rabbitmq-cluster
index ff57934..9ff49e0 100755
--- a/heartbeat/rabbitmq-cluster
+++ b/heartbeat/rabbitmq-cluster
@@ -74,11 +74,11 @@ Policy string to pass to 'rabbitmqctl set_policy' right after bootstrapping the
 </parameters>
 
 <actions>
-<action name="start"        timeout="100" />
-<action name="stop"         timeout="90" />
-<action name="monitor"      timeout="40" interval="10" depth="0" />
-<action name="meta-data"    timeout="10" />
-<action name="validate-all"   timeout="20" />
+<action name="start"        timeout="100s" />
+<action name="stop"         timeout="90s" />
+<action name="monitor"      timeout="40s" interval="10s" depth="0" />
+<action name="meta-data"    timeout="10s" />
+<action name="validate-all"   timeout="20s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/redis b/heartbeat/redis
index bc97f14..b6f111d 100755
--- a/heartbeat/redis
+++ b/heartbeat/redis
@@ -1,6 +1,35 @@
 #!/bin/bash
-
-. ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
+#
+# Resource agent script for redis server.
+#
+# Copyright (c) 2013 Patrick Hemmer <patrick.hemmer at gmail.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+#######################################################################
+# Initialization:
+
+: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
+. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
 
 : ${OCF_RESKEY_bin:=/usr/bin/redis-server}
 : ${OCF_RESKEY_client_bin:=/usr/bin/redis-cli}
@@ -9,6 +38,7 @@
 : ${OCF_RESKEY_pidfile_name:=redis-server.pid}
 : ${OCF_RESKEY_socket_name:=redis.sock}
 : ${OCF_RESKEY_port:=6379}
+: ${OCF_RESKEY_tunnel_host:=127.0.0.1}
 
 if [ -z "$OCF_RESKEY_config" ]; then
 	if [ -f "/etc/redis.conf" ]; then
@@ -37,14 +67,14 @@ if [ -z "$REDIS_CHECK_DUMP" ]; then
 	REDIS_CHECK_DUMP="$(which redis-check-rdb 2>/dev/null)"
 fi
 
-if [ -f "$REDIS_CONFIG" ]; then
-	REDIS_DUMP_DIR="$(cat $REDIS_CONFIG | grep "^\s*dir\s" | awk '{ print $2 }' 2>/dev/null)"
-	REDIS_DUMP_FILE="$(cat $REDIS_CONFIG | grep "^\s*dbfilename\s" | awk '{ print $2 }' 2>/dev/null)"
+if [ -r "$REDIS_CONFIG" ]; then
+	REDIS_DUMP_DIR="$(grep "^\s*dir\s" < "$REDIS_CONFIG" | awk '{ print $2 }' 2>/dev/null)"
+	REDIS_DUMP_FILE="$(grep "^\s*dbfilename\s" < "$REDIS_CONFIG" | awk '{ print $2 }' 2>/dev/null)"
 fi
 : ${REDIS_DUMP_DIR:=/var/lib/redis/}
 : ${REDIS_DUMP_FILE:=dump.rdb}
 
-function meta_data() {
+redis_meta_data() {
 	cat <<EOI
 <?xml version="1.0"?>
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
@@ -127,6 +157,39 @@ Port for replication client to connect to on remote server
 <content type="string" default="${OCF_RESKEY_port}"/>
 </parameter>
 
+<parameter name="tunnel_host" unique="0" required="0">
+<longdesc lang="en">
+When replication traffic is tunnelled, this is the host to target
+to forward outgoing traffic to the redis master. The resource
+agent configures the redis slave to target the master via
+tunnel_host:tunnel_port.
+
+Note that in order to enable replication traffic tunneling,
+parameter {tunnel_port_map} must be populated.
+</longdesc>
+<shortdesc lang="en">Tunnel host for replication traffic</shortdesc>
+<content type="string" default="${OCF_RESKEY_tunnel_host}"/>
+</parameter>
+
+<parameter name="tunnel_port_map" unique="0" required="0">
+<longdesc lang="en">
+A mapping of pacemaker node names to redis port number.
+
+To be used when redis servers need to tunnel replication traffic.
+On every node where the redis resource is running, the redis server
+listens to a different port. Each redis server can access its peers
+for replication traffic via a tunnel accessible at {tunnel_host}:port.
+
+The mapping the form of:
+pcmk1-name:port-for-redis1;pcmk2-name:port-for-redis2;pcmk3-name:port-for-redis3
+
+where the redis resource started on node pcmk1-name would listen on
+port port-for-redis1
+</longdesc>
+<shortdesc lang="en">Mapping of Redis server name to redis port</shortdesc>
+<content type="string" default=""/>
+</parameter>
+
 <parameter name="wait_last_known_master" unique="0" required="0">
 <longdesc lang="en">
 During redis cluster bootstrap, wait for the last known master to be
@@ -140,23 +203,23 @@ is in use.
 </parameters>
 
 <actions>
-<action name="start" timeout="120" />
-<action name="stop" timeout="120" />
-<action name="status" timeout="60" />
-<action name="monitor" depth="0" timeout="60" interval="45" />
-<action name="monitor" role="Master" depth="0" timeout="60" interval="20" />
-<action name="monitor" role="Slave" depth="0" timeout="60" interval="60" />
-<action name="promote" timeout="120" />
-<action name="demote" timeout="120" />
-<action name="notify" timeout="90" />
-<action name="validate-all" timeout="5" />
-<action name="meta-data" timeout="5" />
+<action name="start" timeout="120s" />
+<action name="stop" timeout="120s" />
+<action name="status" timeout="60s" />
+<action name="monitor" depth="0" timeout="60s" interval="45s" />
+<action name="monitor" role="Master" depth="0" timeout="60s" interval="20s" />
+<action name="monitor" role="Slave" depth="0" timeout="60s" interval="60s" />
+<action name="promote" timeout="120s" />
+<action name="demote" timeout="120s" />
+<action name="notify" timeout="90s" />
+<action name="validate-all" timeout="5s" />
+<action name="meta-data" timeout="5s" />
 </actions>
 </resource-agent>
 EOI
 }
 
-INSTANCE_ATTR_NAME=`echo ${OCF_RESOURCE_INSTANCE}| awk -F : '{print $1}'`
+INSTANCE_ATTR_NAME=$(echo "${OCF_RESOURCE_INSTANCE}" | awk -F : '{print $1}')
 CRM_ATTR_REPL_INFO="${HA_SBIN_DIR}/crm_attribute --type crm_config --name ${INSTANCE_ATTR_NAME}_REPL_INFO -s redis_replication"
 MASTER_HOST=""
 MASTER_ACTIVE_CACHED=""
@@ -173,13 +236,13 @@ master_is_active()
 	return $MASTER_ACTIVE
 }
 
-function set_master()
+set_master()
 {
 	MASTER_HOST="$1"
 	${CRM_ATTR_REPL_INFO} -v "$1" -q
 }
 
-function last_known_master()
+last_known_master()
 {
 	if [ -z "$MASTER_HOST" ]; then
 		MASTER_HOST="$(${CRM_ATTR_REPL_INFO} --query  -q  2>/dev/null)"
@@ -187,17 +250,18 @@ function last_known_master()
 	echo "$MASTER_HOST"
 }
 
-function crm_master_reboot() {
-	local node=$(ocf_attribute_target)
-	"${HA_SBIN_DIR}/crm_master" -N $node -l reboot "$@"
+crm_master_reboot() {
+	local node
+	node=$(ocf_attribute_target)
+	"${HA_SBIN_DIR}/crm_master" -N "$node" -l reboot "$@"
 }
 
-function calculate_score()
+calculate_score()
 {
 	perf_score="$1"
 	connected_clients="$2"
 
-    	if ocf_is_true "$OCF_RESKEY_wait_last_known_master"; then
+	if ocf_is_true "$OCF_RESKEY_wait_last_known_master"; then
 		# only set perferred score by slave_priority if
 		# we are not waiting for the last known master. Otherwise
 		# we want the agent to have complete control over the scoring.
@@ -216,12 +280,15 @@ function calculate_score()
 	echo "$perf_score"
 }
 
-function set_score()
+set_score()
 {
-	local score="$1"
+	local score
+	local last_master
+
+	score="$1"
 
-    	if ocf_is_true "$OCF_RESKEY_wait_last_known_master" && ! master_is_active; then
-		local last_master="$(last_known_master)"
+	if ocf_is_true "$OCF_RESKEY_wait_last_known_master" && ! master_is_active; then
+		last_master="$(last_known_master)"
 		if [ -n "$last_master" ] && [[ "$last_master" != "$NODENAME" ]]; then
 			ocf_log info "Postponing setting master score for ${NODENAME} until last known master instance [${last_master}] is promoted"
 			return
@@ -232,16 +299,16 @@ function set_score()
 	crm_master_reboot -v "$score"
 }
 
-function redis_client() {
+redis_client() {
 	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 
+	else
 		"$REDIS_CLIENT" -s "$REDIS_SOCKET" "$@" | sed 's/\r//'
 	fi
 }
 
-function simple_status() {
+simple_status() {
 	local pid
 
 	if ! [ -f "$REDIS_PIDFILE" ]; then
@@ -256,8 +323,10 @@ function simple_status() {
 	return $OCF_SUCCESS
 }
 
-function monitor() {
+redis_monitor() {
 	local res
+	local master_name
+	local last_known_master_port
 
 	simple_status
 	res=$?
@@ -282,7 +351,7 @@ function monitor() {
 		# If score isn't set we the redis setting 'slave_priority'.
 		# If that isn't set, we default to 1000 for a master, and 1 for slave.
 		# We then add 1 for each connected client
-		score="$(crm_master_reboot --get-value --quiet 2>/dev/null)"
+		score="$(crm_master_reboot -G --quiet 2>/dev/null)"
 		if [[ -z "$score" ]]; then
 			score=$(calculate_score "${info[slave_priority]}" "${info[connected_clients]}")
 			set_score "$score"
@@ -301,15 +370,49 @@ function monitor() {
 				return $OCF_ERR_GENERIC
 			fi
 			if [[ "${info[master_host]}" != "$(last_known_master)" ]]; then
-				ocf_log err "monitor: Slave mode current master does not match running master. current=${info[master_host]}, running=$(last_known_master)"
-				return $OCF_ERR_GENERIC
+				if [ -n "${OCF_RESKEY_tunnel_port_map}" ]; then
+					master_name=$(port_to_redis_node ${info[master_port]})
+					last_known_master_port=$(redis_node_to_port $(last_known_master))
+					if [[ "${info[master_host]}" != "${OCF_RESKEY_tunnel_host}" ]] ||
+					   [[  "${info[master_port]}" != "${last_known_master_port}" ]]; then
+						ocf_log err "monitor: Slave mode current tunnelled connection to redis server does not match running master. tunnelled='${info[master_host]}:${info[master_port]} (${master_name})', running='$(last_known_master)'"
+						return $OCF_ERR_GENERIC
+					fi
+				else
+					ocf_log err "monitor: Slave mode current master does not match running master. current=${info[master_host]}, running=$(last_known_master)"
+					return $OCF_ERR_GENERIC
+				fi
 			fi
 		fi
 	fi
 	return $OCF_SUCCESS
 }
 
-function check_dump_file()
+redis_node_to_port()
+{
+	local node=$1
+	echo "$OCF_RESKEY_tunnel_port_map" | tr ';' '\n' | tr -d ' ' | sed 's/:/ /' | awk -F' ' '$1=="'"$node"'" {print $2;exit}'
+}
+
+port_to_redis_node()
+{
+	local port=$1
+	echo "$OCF_RESKEY_tunnel_port_map" | tr ';' '\n' | tr -d ' ' | sed 's/:/ /' | awk -F' ' '$2=="'"$port"'" {print $1;exit}'
+}
+
+get_tunnel_port_from_master()
+{
+	local master_name=$1
+	crm_attribute --node "$master_name" -l forever --name ${INSTANCE_ATTR_NAME}-tunnel-port --query -q 2>/dev/null
+}
+
+get_master_from_tunnel_port()
+{
+	local master_name=$1
+	crm_attribute --node "$master_name" -l forever --name ${INSTANCE_ATTR_NAME}-tunnel-port --query -q 2>/dev/null
+}
+
+check_dump_file()
 {
 	if ! have_binary "$REDIS_CHECK_DUMP"; then
 		return 0
@@ -317,8 +420,10 @@ function check_dump_file()
 	$REDIS_CHECK_DUMP ${REDIS_DUMP_DIR}/${REDIS_DUMP_FILE} 2>&1
 }
 
-function start() {
-	monitor
+redis_start() {
+	local size
+
+	redis_monitor
 	status=$?
 
 	if (( status == OCF_SUCCESS )) || (( status == OCF_RUNNING_MASTER )); then
@@ -336,10 +441,10 @@ function start() {
 	# check for 0 byte database dump file. This is an unrecoverable start
 	# condition that we can avoid by deleting the 0 byte database file.
 	if [ -f "${REDIS_DUMP_DIR}/${REDIS_DUMP_FILE}" ]; then
-		local size="$(stat --format "%s" ${REDIS_DUMP_DIR}/${REDIS_DUMP_FILE})"
+		size="$(stat --format "%s" ${REDIS_DUMP_DIR}/${REDIS_DUMP_FILE})"
 		if [ "$?" -eq "0" ] && [ "$size" -eq "0" ]; then
 			ocf_log notice "Detected 0 byte ${REDIS_DUMP_FILE}, deleting zero length file to avoid start failure."
-			rm -f ${REDIS_DUMP_DIR}/${REDIS_DUMP_FILE}
+			rm -f "${REDIS_DUMP_DIR}/${REDIS_DUMP_FILE}"
 		fi
 	fi
 
@@ -378,9 +483,9 @@ function start() {
 		sleep 1
 	done
 
-	ocf_is_ms && demote # pacemaker expects resources to start in slave mode
+	ocf_is_ms && redis_demote # pacemaker expects resources to start in slave mode
 
-	monitor
+	redis_monitor
 	status=$?
 	if (( status == OCF_SUCCESS )) || (( status == OCF_RUNNING_MASTER )); then
 		return $OCF_SUCCESS
@@ -391,8 +496,8 @@ function start() {
 	return $status
 }
 
-function stop() {
-	monitor
+redis_stop() {
+	redis_monitor
 	status=$?
 
 	if (( status == OCF_NOT_RUNNING )); then
@@ -415,8 +520,8 @@ function stop() {
 	done
 }
 
-function promote() {
-	monitor
+redis_promote() {
+	redis_monitor
 	status=$?
 
 	if (( status == OCF_RUNNING_MASTER )); then
@@ -430,7 +535,7 @@ function promote() {
 
 	redis_client slaveof no one
 
-	monitor
+	redis_monitor
 	status=$?
 	if (( status == OCF_RUNNING_MASTER )); then
 		set_master "$NODENAME"
@@ -441,9 +546,10 @@ function promote() {
 	return $OCF_ERR_GENERIC
 }
 
-function demote() {
+redis_demote() {
 	local master_host
 	local master_port
+	local tunnel_port
 
 	# client kill is only supported in Redis 2.8.12 or greater
 	version=$(redis_client -v | awk '{print $NF}')
@@ -451,7 +557,7 @@ function demote() {
 	client_kill=$?
 
 	CHECK_SLAVE_STATE=1
-	monitor
+	redis_monitor
 	status=$?
 
 	if (( status == OCF_SUCCESS )); then
@@ -477,7 +583,19 @@ function demote() {
 		master_host="no-such-master"
 	fi
 
-	ocf_log info "demote: Setting master to '$master_host'"
+	if [ -n "${OCF_RESKEY_tunnel_port_map}" ]; then
+		# master_host can be the special marker "no-such-master"
+		# while a master is being selected. In this case, no
+		# tunnel port is returned, but this is not fatal.
+		tunnel_port=$(redis_node_to_port "$master_host")
+		if [ -n "$tunnel_port" ]; then
+			ocf_log info "demote: Setting master to '$master_host' via local tunnel '${OCF_RESKEY_tunnel_host}' on port '$tunnel_port'"
+			master_host="${OCF_RESKEY_tunnel_host}"
+			master_port="$tunnel_port"
+		fi
+	else
+		ocf_log info "demote: Setting master to '$master_host'"
+	fi
 
 	redis_client slaveof "$master_host" "$master_port"
 
@@ -495,7 +613,7 @@ function demote() {
 		if [ "$client_kill" -eq 2 ]; then
 			redis_client CLIENT PAUSE 2000
 		fi
-		monitor
+		redis_monitor
 		status=$?
 		if (( status == OCF_SUCCESS )); then
 			if [ "$client_kill" -eq 2 ]; then
@@ -511,23 +629,23 @@ function demote() {
 	return $OCF_ERR_GENERIC
 }
 
-function notify() {
+redis_notify() {
 	mode="${OCF_RESKEY_CRM_meta_notify_type}-${OCF_RESKEY_CRM_meta_notify_operation}"
 	case "$mode" in
 		post-demote|post-promote) # change the master
-			monitor
+			redis_monitor
 			status=$?
 			if (( status == OCF_SUCCESS )); then # were a slave
 				# calling demote updates the slave's connection
 				# to the newly appointed Master instance.
-				demote
+				redis_demote
 			fi
 			;;
 	esac
 	return $OCF_SUCCESS
 }
 
-function validate() {
+redis_validate() {
 	if [[ -x "$REDIS_SERVER" ]]; then
 		ocf_log err "validate: $REDIS_SERVER does not exist or is not executable"
 		return $OCF_ERR_INSTALLED
@@ -547,39 +665,39 @@ function validate() {
 }
 
 NODENAME=$(ocf_attribute_target)
-if [ -f "$REDIS_CONFIG" ]; then
-	clientpasswd="$(cat $REDIS_CONFIG | sed -n -e  's/^\s*requirepass\s*\(.*\)\s*$/\1/p' | tail -n 1)"
+if [ -r "$REDIS_CONFIG" ]; then
+	clientpasswd="$(sed -n -e  's/^\s*requirepass\s*\(.*\)\s*$/\1/p' < $REDIS_CONFIG | tail -n 1)"
 fi
 
 ocf_log debug "action=${1:-$__OCF_ACTION} notify_type=${OCF_RESKEY_CRM_meta_notify_type} notify_operation=${OCF_RESKEY_CRM_meta_notify_operation} master_host=${OCF_RESKEY_CRM_meta_notify_master_uname} slave_host=${OCF_RESKEY_CRM_meta_notify_slave_uname} promote_host=${OCF_RESKEY_CRM_meta_notify_promote_uname} demote_host=${OCF_RESKEY_CRM_meta_notify_demote_uname}; params: bin=${OCF_RESKEY_bin} client_bin=${OCF_RESKEY_client_bin} config=${OCF_RESKEY_config} user=${OCF_RESKEY_user} rundir= [...]
 
 case "${1:-$__OCF_ACTION}" in
 	status|monitor)
-		monitor
+		redis_monitor
 		;;
 	start)
-		start
+		redis_start
 		;;
 	stop)
-		stop
+		redis_stop
 		;;
 	restart)
-		stop && start
+		redis_stop && redis_start
 		;;
 	promote)
-		promote
+		redis_promote
 		;;
 	demote)
-		demote
+		redis_demote
 		;;
 	notify)
-		notify
+		redis_notify
 		;;
 	meta-data)
-		meta_data
+		redis_meta_data
 		;;
 	validate-all)
-		validate
+		redis_validate
 		;;
 	*)
 		echo "Usage: $0 {monitor|start|stop|restart|promote|demote|notify|validate-all|meta-data}"
diff --git a/heartbeat/rkt b/heartbeat/rkt
index 666f885..abe90b3 100755
--- a/heartbeat/rkt
+++ b/heartbeat/rkt
@@ -143,11 +143,11 @@ shutdown
 </parameters>
 
 <actions>
-<action name="start"        timeout="90" />
-<action name="stop"         timeout="90" />
-<action name="monitor"      timeout="30" interval="30" depth="0" />
-<action name="meta-data"    timeout="5" />
-<action name="validate-all"   timeout="30" />
+<action name="start"        timeout="90s" />
+<action name="stop"         timeout="90s" />
+<action name="monitor"      timeout="30s" interval="30s" depth="0" />
+<action name="meta-data"    timeout="5s" />
+<action name="validate-all"   timeout="30s" />
 </actions>
 </resource-agent>
 END
@@ -307,7 +307,7 @@ rkt_start()
 		return $OCF_ERR_GENERIC
 	fi
 
-	while ! container_exists || [ "$(container_state)" == "preparing" ] ; do
+	while ! container_exists || [ "$(container_state)" = "preparing" ] ; do
 		ocf_log debug "waiting for container to start"
 		sleep 1
 	done
@@ -417,7 +417,7 @@ rkt_validate()
 		exit $OCF_ERR_CONFIGURED
 	fi
 
-	if echo ${CONTAINER} | grep -q [^a-z0-9-]; then
+	if echo ${CONTAINER} | grep -q '[^a-z0-9-]'; then
 		ocf_exit_reason "'name' must contain only lower case alphanumeric characters and -"
 		exit $OCF_ERR_CONFIGURED
 	fi
diff --git a/heartbeat/rsyslog b/heartbeat/rsyslog
index a8ebc63..fe6333b 100755
--- a/heartbeat/rsyslog
+++ b/heartbeat/rsyslog
@@ -109,7 +109,7 @@ options is used. Don't use option '-F'. It causes a stuck of a start action.
 <action name="status" timeout="20s" />
 <action name="monitor" depth="0" timeout="20s" interval="20s" />
 <action name="meta-data" timeout="5s" />
-<action name="validate-all"  timeout="5"/>
+<action name="validate-all"  timeout="5s"/>
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/scsi2reservation b/heartbeat/scsi2reservation
index 01b067e..b1b1dc2 100755
--- a/heartbeat/scsi2reservation
+++ b/heartbeat/scsi2reservation
@@ -66,11 +66,11 @@ Times to re-try before giving up.
 </parameters>
 
 <actions>
-<action name="start"   timeout="300" />
-<action name="stop"    timeout="100" />
-<action name="monitor" depth="0"  timeout="20" interval="20" />
-<action name="meta-data"  timeout="5" />
-<action name="validate-all"  timeout="30" />
+<action name="start"   timeout="300s" />
+<action name="stop"    timeout="100s" />
+<action name="monitor" depth="0"  timeout="20s" interval="20s" />
+<action name="meta-data"  timeout="5s" />
+<action name="validate-all"  timeout="30s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/sg_persist b/heartbeat/sg_persist
index 7800474..70390d1 100755
--- a/heartbeat/sg_persist
+++ b/heartbeat/sg_persist
@@ -154,15 +154,15 @@ Setting it to 0 will disable this behavior.
 </parameters>
 
 <actions>
-<action name="start"   timeout="30" />
-<action name="promote"   timeout="30" />
-<action name="demote"   timeout="30" />
-<action name="notify"   timeout="30" />
-<action name="stop"    timeout="30" />
-<action name="monitor" depth="0"  timeout="20" interval="29" role="Slave" />
-<action name="monitor" depth="0"  timeout="20" interval="60" role="Master" />
-<action name="meta-data"  timeout="5" />
-<action name="validate-all"  timeout="30" />
+<action name="start"   timeout="30s" />
+<action name="promote"   timeout="30s" />
+<action name="demote"   timeout="30s" />
+<action name="notify"   timeout="30s" />
+<action name="stop"    timeout="30s" />
+<action name="monitor" depth="0"  timeout="20s" interval="29s" role="Slave" />
+<action name="monitor" depth="0"  timeout="20s" interval="60s" role="Master" />
+<action name="meta-data"  timeout="5s" />
+<action name="validate-all"  timeout="30s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/symlink b/heartbeat/symlink
index dbf633e..c2ecb89 100755
--- a/heartbeat/symlink
+++ b/heartbeat/symlink
@@ -77,11 +77,11 @@ refuse to create a symlink if it clashes with an existing file.
 </parameter>
 </parameters>
 <actions>
-<action name="start"   timeout="15" />
-<action name="stop"    timeout="15" />
-<action name="monitor" depth="0"  timeout="15" interval="60"/>
-<action name="meta-data"  timeout="5" />
-<action name="validate-all"  timeout="10" />
+<action name="start"   timeout="15s" />
+<action name="stop"    timeout="15s" />
+<action name="monitor" depth="0"  timeout="15s" interval="60s"/>
+<action name="meta-data"  timeout="5s" />
+<action name="validate-all"  timeout="10s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/syslog-ng b/heartbeat/syslog-ng
index ef42bf3..f1081e5 100755
--- a/heartbeat/syslog-ng
+++ b/heartbeat/syslog-ng
@@ -122,7 +122,7 @@ The default value is 10.
 <action name="status" timeout="60s" />
 <action name="monitor" depth="0" timeout="60s" interval="60s" />
 <action name="meta-data" timeout="5s" />
-<action name="validate-all"  timeout="5"/>
+<action name="validate-all"  timeout="5s"/>
 </actions>
 </resource-agent>
 END
@@ -250,7 +250,8 @@ if ! ocf_is_decimal "$KILL_TERM_TIMEOUT"; then
 fi
 
 START_OPTS=${OCF_RESKEY_start_opts}
-PROCESS_PATTERN="$SYSLOG_NG_EXE -f $CONFIGFILE"
+EXECUTABLE=$(basename "$SYSLOG_NG_EXE")
+PROCESS_PATTERN="$EXECUTABLE -f $CONFIGFILE"
 
 COMMAND=$1
 
diff --git a/heartbeat/tomcat b/heartbeat/tomcat
index 857da78..4812a01 100755
--- a/heartbeat/tomcat
+++ b/heartbeat/tomcat
@@ -311,7 +311,7 @@ stop_tomcat()
 	echo "`date "+%Y/%m/%d %T"`: stop  ###########################" >> "$TOMCAT_CONSOLE"
 
 	if [ "$TOMCAT_START_SCRIPT" = "$CATALINA_HOME/bin/catalina.sh" ]; then
-		TOMCAT_STOP_OPTS="$STOP_TIMEOUT --force"
+		TOMCAT_STOP_OPTS="$STOP_TIMEOUT -force"
 	fi
 	stop_time=$(date +%s)
 	attemptTomcatCommand stop $TOMCAT_STOP_OPTS
@@ -546,10 +546,10 @@ Logging_manager of tomcat
 <actions>
 <action name="start" timeout="60s" />
 <action name="stop" timeout="120s" />
-<action name="status" timeout="60" />
+<action name="status" timeout="60s" />
 <action name="monitor" depth="0" timeout="30s" interval="10s" />
 <action name="meta-data" timeout="5s" />
-<action name="validate-all"  timeout="5"/>
+<action name="validate-all"  timeout="5s"/>
 </actions>
 </resource-agent>
 END
@@ -645,7 +645,7 @@ LOGGING_MANAGER="${OCF_RESKEY_logging_manager}"
 
 if [ -z "${TOMCAT_START_SCRIPT}" ]; then
 	if ocf_is_true $OCF_RESKEY_force_systemd && \
-	     ps -p 1 | grep -q systemd; then
+	     systemd_is_running; then
 		SYSTEMD=1
 	elif [ -e "$CATALINA_HOME/bin/catalina.sh" ]; then
 		TOMCAT_START_SCRIPT="$CATALINA_HOME/bin/catalina.sh"
diff --git a/heartbeat/varnish b/heartbeat/varnish
index 36ea4a6..452b381 100755
--- a/heartbeat/varnish
+++ b/heartbeat/varnish
@@ -268,12 +268,12 @@ Path to a file containing a secret used for authorizing access to the management
 </parameters>
 
 <actions>
-<action name="start"        timeout="20" />
-<action name="stop"         timeout="20" />
-<action name="monitor"      timeout="20" interval="10" depth="0" />
-<action name="status"       timeout="20" />
-<action name="meta-data"    timeout="5" />
-<action name="validate-all"   timeout="20" />
+<action name="start"        timeout="20s" />
+<action name="stop"         timeout="20s" />
+<action name="monitor"      timeout="20s" interval="10s" depth="0" />
+<action name="status"       timeout="20s" />
+<action name="meta-data"    timeout="5s" />
+<action name="validate-all"   timeout="20s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/vmware b/heartbeat/vmware
index 3c72891..7cd61dd 100755
--- a/heartbeat/vmware
+++ b/heartbeat/vmware
@@ -24,7 +24,7 @@
 #  * vmware-server 2.0 installed and autostarted on all nodes
 #  * vmdk files must be in the same directory of the vmx file
 #  * vmx filenames must be unique, even if stored in different directories
-#  * Default_Action_Timeout stock value (20 sec) isn't enough if you are
+#  * The default value of operation timeout (20 sec) isn't enough if you are
 #    dealing with many virtual machines: raise it to something around 600 secs
 #    or use operation attributes with the proposed values
 #  * Moving a vm among nodes will cause its mac address to change: if you need
@@ -337,10 +337,10 @@ vmware-vim-cmd executable path
 </parameters>
 
 <actions>
-<action name="start"        timeout="600" />
-<action name="stop"         timeout="600" />
-<action name="monitor"      timeout="30" interval="300" depth="0"/>
-<action name="meta-data"    timeout="5" />
+<action name="start"        timeout="600s" />
+<action name="stop"         timeout="600s" />
+<action name="monitor"      timeout="30s" interval="300s" depth="0"/>
+<action name="meta-data"    timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/heartbeat/zabbixserver b/heartbeat/zabbixserver
index 4513141..08f7e79 100755
--- a/heartbeat/zabbixserver
+++ b/heartbeat/zabbixserver
@@ -96,11 +96,11 @@ if not specified.
 </parameters>
 
 <actions>
-<action name="start"        timeout="20" />
-<action name="stop"         timeout="20" />
-<action name="monitor"      timeout="20" interval="10" depth="0"/>
-<action name="validate-all" timeout="20" />
-<action name="meta-data"    timeout="5" />
+<action name="start"        timeout="20s" />
+<action name="stop"         timeout="20s" />
+<action name="monitor"      timeout="20s" interval="10s" depth="0"/>
+<action name="validate-all" timeout="20s" />
+<action name="meta-data"    timeout="5s" />
 </actions>
 </resource-agent>
 END
diff --git a/resource-agents.spec.in b/resource-agents.spec.in
index bb90fd3..8fe63a0 100644
--- a/resource-agents.spec.in
+++ b/resource-agents.spec.in
@@ -56,7 +56,7 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 
 # Build dependencies
 BuildRequires: automake autoconf pkgconfig
-BuildRequires: perl python-devel
+BuildRequires: perl
 BuildRequires: libxslt glib2-devel
 BuildRequires: which
 
diff --git a/rgmanager/src/resources/nfsserver.sh b/rgmanager/src/resources/nfsserver.sh
index 65885e6..04911c7 100644
--- a/rgmanager/src/resources/nfsserver.sh
+++ b/rgmanager/src/resources/nfsserver.sh
@@ -17,7 +17,7 @@ export LC_ALL LANG PATH
 . $(dirname $0)/ocf-shellfuncs
 
 # SELinux information
-which restorecon &> /dev/null && selinuxenabled
+which restorecon &> /dev/null && selinuxenabled &> /dev/null
 export SELINUX_ENABLED=$?
 if [ $SELINUX_ENABLED ]; then
 	export SELINUX_LABEL="$(ls -ldZ /var/lib/nfs/statd | cut -f4 -d' ')"
diff --git a/tools/sfex_daemon.c b/tools/sfex_daemon.c
index 516c101..ee0c314 100644
--- a/tools/sfex_daemon.c
+++ b/tools/sfex_daemon.c
@@ -100,8 +100,8 @@ static void acquire_lock(void)
 static void error_todo (void)
 {
 	if (fork() == 0) {
-		cl_log(LOG_INFO, "Execute \"crm_resource -F -r %s -H %s\" command\n", rsc_id, nodename);
-		execl("/usr/sbin/crm_resource", "crm_resource", "-F", "-r", rsc_id, "-H", nodename, NULL);
+		cl_log(LOG_INFO, "Execute \"crm_resource -F -r %s --node %s\" command\n", rsc_id, nodename);
+		execl("/usr/sbin/crm_resource", "crm_resource", "-F", "-r", rsc_id, "--node", nodename, NULL);
 	} else {
 		exit(EXIT_FAILURE);
 	}
@@ -112,7 +112,7 @@ static void failure_todo(void)
 #ifdef SFEX_TESTING	
 	exit(EXIT_FAILURE);
 #else
-	/*execl("/usr/sbin/crm_resource", "crm_resource", "-F", "-r", rsc_id, "-H", nodename, NULL); */
+	/*execl("/usr/sbin/crm_resource", "crm_resource", "-F", "-r", rsc_id, "--node", nodename, NULL); */
 	int ret;
 
 	cl_log(LOG_INFO, "Force reboot node %s\n", nodename);

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