14f8ab
From 267135e74d94d8a1e56a263b37ca4689020b9e53 Mon Sep 17 00:00:00 2001
14f8ab
From: Jiffin Tony Thottan <jthottan@redhat.com>
14f8ab
Date: Mon, 16 Oct 2017 16:58:28 +0530
14f8ab
Subject: [PATCH 055/124] Revert "storhaug HA: first step, remove resource
14f8ab
 agents and setup script"
14f8ab
14f8ab
This reverts commit c822e354e16646adf18bbc5123798663faa543b2.
14f8ab
14f8ab
Label: DOWNSTREAM ONLY
14f8ab
14f8ab
Change-Id: Idd50fe1a5be5a3258d560518d810f9ec4c57621a
14f8ab
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
14f8ab
Reviewed-on: https://code.engineering.redhat.com/gerrit/167104
14f8ab
Reviewed-by: Soumya Koduri <skoduri@redhat.com>
14f8ab
Tested-by: RHGS Build Bot <nigelb@redhat.com>
14f8ab
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
14f8ab
---
14f8ab
 configure.ac                         |    1 +
14f8ab
 extras/ganesha/Makefile.am           |    2 +-
14f8ab
 extras/ganesha/ocf/Makefile.am       |   11 +
14f8ab
 extras/ganesha/ocf/ganesha_grace     |  221 +++++++
14f8ab
 extras/ganesha/ocf/ganesha_mon       |  234 +++++++
14f8ab
 extras/ganesha/ocf/ganesha_nfsd      |  167 +++++
14f8ab
 extras/ganesha/scripts/Makefile.am   |    6 +-
14f8ab
 extras/ganesha/scripts/ganesha-ha.sh | 1125 ++++++++++++++++++++++++++++++++++
14f8ab
 glusterfs.spec.in                    |    8 +-
14f8ab
 9 files changed, 1771 insertions(+), 4 deletions(-)
14f8ab
 create mode 100644 extras/ganesha/ocf/Makefile.am
14f8ab
 create mode 100644 extras/ganesha/ocf/ganesha_grace
14f8ab
 create mode 100644 extras/ganesha/ocf/ganesha_mon
14f8ab
 create mode 100644 extras/ganesha/ocf/ganesha_nfsd
14f8ab
 create mode 100644 extras/ganesha/scripts/ganesha-ha.sh
14f8ab
14f8ab
diff --git a/configure.ac b/configure.ac
14f8ab
index 125ae29..baa811a 100644
14f8ab
--- a/configure.ac
14f8ab
+++ b/configure.ac
14f8ab
@@ -199,6 +199,7 @@ AC_CONFIG_FILES([Makefile
14f8ab
                 extras/ganesha/Makefile
14f8ab
                 extras/ganesha/config/Makefile
14f8ab
                 extras/ganesha/scripts/Makefile
14f8ab
+                extras/ganesha/ocf/Makefile
14f8ab
                 extras/systemd/Makefile
14f8ab
                 extras/systemd/glusterd.service
14f8ab
                 extras/systemd/glustereventsd.service
14f8ab
diff --git a/extras/ganesha/Makefile.am b/extras/ganesha/Makefile.am
14f8ab
index 542de68..9eaa401 100644
14f8ab
--- a/extras/ganesha/Makefile.am
14f8ab
+++ b/extras/ganesha/Makefile.am
14f8ab
@@ -1,2 +1,2 @@
14f8ab
-SUBDIRS = scripts config
14f8ab
+SUBDIRS = scripts config ocf
14f8ab
 CLEANFILES =
14f8ab
diff --git a/extras/ganesha/ocf/Makefile.am b/extras/ganesha/ocf/Makefile.am
14f8ab
new file mode 100644
14f8ab
index 0000000..990a609
14f8ab
--- /dev/null
14f8ab
+++ b/extras/ganesha/ocf/Makefile.am
14f8ab
@@ -0,0 +1,11 @@
14f8ab
+EXTRA_DIST= ganesha_grace ganesha_mon ganesha_nfsd
14f8ab
+
14f8ab
+# The root of the OCF resource agent hierarchy
14f8ab
+# Per the OCF standard, it's always "lib",
14f8ab
+# not "lib64" (even on 64-bit platforms).
14f8ab
+ocfdir = $(prefix)/lib/ocf
14f8ab
+
14f8ab
+# The provider directory
14f8ab
+radir = $(ocfdir)/resource.d/heartbeat
14f8ab
+
14f8ab
+ra_SCRIPTS = ganesha_grace ganesha_mon ganesha_nfsd
14f8ab
diff --git a/extras/ganesha/ocf/ganesha_grace b/extras/ganesha/ocf/ganesha_grace
14f8ab
new file mode 100644
14f8ab
index 0000000..825f716
14f8ab
--- /dev/null
14f8ab
+++ b/extras/ganesha/ocf/ganesha_grace
14f8ab
@@ -0,0 +1,221 @@
14f8ab
+#!/bin/bash
14f8ab
+#
14f8ab
+# Copyright (c) 2014 Anand Subramanian anands@redhat.com
14f8ab
+# Copyright (c) 2015 Red Hat Inc.
14f8ab
+#                    All Rights Reserved.
14f8ab
+#
14f8ab
+# This program is free software; you can redistribute it and/or modify
14f8ab
+# it under the terms of version 2 of the GNU General Public License as
14f8ab
+# published by the Free Software Foundation.
14f8ab
+#
14f8ab
+# This program is distributed in the hope that it would be useful, but
14f8ab
+# WITHOUT ANY WARRANTY; without even the implied warranty of
14f8ab
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14f8ab
+#
14f8ab
+# Further, this software is distributed without any warranty that it is
14f8ab
+# free of the rightful claim of any third person regarding infringement
14f8ab
+# or the like.  Any license provided herein, whether implied or
14f8ab
+# otherwise, applies only to this software file.  Patent licenses, if
14f8ab
+# any, provided herein do not apply to combinations of this program with
14f8ab
+# other software, or any other product whatsoever.
14f8ab
+#
14f8ab
+# You should have received a copy of the GNU General Public License
14f8ab
+# along with this program; if not, write the Free Software Foundation,
14f8ab
+# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
14f8ab
+#
14f8ab
+#
14f8ab
+
14f8ab
+# Initialization:
14f8ab
+: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
14f8ab
+. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
14f8ab
+
14f8ab
+if [ -n "$OCF_DEBUG_LIBRARY" ]; then
14f8ab
+	. $OCF_DEBUG_LIBRARY
14f8ab
+else
14f8ab
+	: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
14f8ab
+	. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
14f8ab
+fi
14f8ab
+
14f8ab
+OCF_RESKEY_grace_active_default="grace-active"
14f8ab
+: ${OCF_RESKEY_grace_active=${OCF_RESKEY_grace_active_default}}
14f8ab
+
14f8ab
+ganesha_meta_data() {
14f8ab
+	cat <
14f8ab
+
14f8ab
+
14f8ab
+<resource-agent name="ganesha_grace">
14f8ab
+<version>1.0</version>
14f8ab
+
14f8ab
+<longdesc lang="en">
14f8ab
+This Linux-specific resource agent acts as a dummy
14f8ab
+resource agent for nfs-ganesha.
14f8ab
+</longdesc>
14f8ab
+
14f8ab
+<shortdesc lang="en">Manages the user-space nfs-ganesha NFS server</shortdesc>
14f8ab
+
14f8ab
+<parameters>
14f8ab
+<parameter name="grace_active">
14f8ab
+<longdesc lang="en">NFS-Ganesha grace active attribute</longdesc>
14f8ab
+<shortdesc lang="en">NFS-Ganesha grace active attribute</shortdesc>
14f8ab
+<content type="string" default="grace-active" />
14f8ab
+</parameter>
14f8ab
+</parameters>
14f8ab
+
14f8ab
+<actions>
14f8ab
+<action name="start"   timeout="40s" />
14f8ab
+<action name="stop"    timeout="40s" />
14f8ab
+<action name="status"  timeout="20s" interval="60s" />
14f8ab
+<action name="monitor" depth="0" timeout="10s" interval="5s" />
14f8ab
+<action name="notify"  timeout="10s" />
14f8ab
+<action name="meta-data"  timeout="20s" />
14f8ab
+</actions>
14f8ab
+</resource-agent>
14f8ab
+END
14f8ab
+
14f8ab
+return ${OCF_SUCCESS}
14f8ab
+}
14f8ab
+
14f8ab
+ganesha_grace_usage() {
14f8ab
+	echo "ganesha.nfsd USAGE"
14f8ab
+}
14f8ab
+
14f8ab
+# Make sure meta-data and usage always succeed
14f8ab
+case $__OCF_ACTION in
14f8ab
+	meta-data)	ganesha_meta_data
14f8ab
+			exit ${OCF_SUCCESS}
14f8ab
+			;;
14f8ab
+	usage|help)	ganesha_usage
14f8ab
+			exit ${OCF_SUCCESS}
14f8ab
+			;;
14f8ab
+	*)
14f8ab
+			;;
14f8ab
+esac
14f8ab
+
14f8ab
+ganesha_grace_start()
14f8ab
+{
14f8ab
+	local rc=${OCF_ERR_GENERIC}
14f8ab
+	local host=$(hostname -s)
14f8ab
+
14f8ab
+	ocf_log debug "ganesha_grace_start()"
14f8ab
+	# give ganesha_mon RA a chance to set the crm_attr first
14f8ab
+	# I mislike the sleep, but it's not clear that looping
14f8ab
+	# with a small sleep is necessarily better
14f8ab
+	# start has a 40sec timeout, so a 5sec sleep here is okay
14f8ab
+        sleep 5
14f8ab
+	attr=$(crm_attribute --query --node=${host} --name=${OCF_RESKEY_grace_active} 2> /dev/null)
14f8ab
+        if [ $? -ne 0 ]; then
14f8ab
+		host=$(hostname)
14f8ab
+		attr=$(crm_attribute --query --node=${host} --name=${OCF_RESKEY_grace_active} 2> /dev/null )
14f8ab
+                if [ $? -ne 0 ]; then
14f8ab
+	                ocf_log info "grace start: crm_attribute --query --node=${host} --name=${OCF_RESKEY_grace_active} failed"
14f8ab
+                fi
14f8ab
+        fi
14f8ab
+
14f8ab
+	# Three possibilities:
14f8ab
+	# 1. There is no attribute at all and attr_updater returns
14f8ab
+	#    a zero length string. This happens when
14f8ab
+	#    ganesha_mon::monitor hasn't run at least once to set
14f8ab
+	#    the attribute. The assumption here is that the system
14f8ab
+	#    is coming up. We pretend, for now, that the node is
14f8ab
+	#    healthy, to allow the system to continue coming up.
14f8ab
+	#    It will cure itself in a few seconds
14f8ab
+	# 2. There is an attribute, and it has the value "1"; this
14f8ab
+	#    node is healthy.
14f8ab
+	# 3. There is an attribute, but it has no value or the value
14f8ab
+	#    "0"; this node is not healthy.
14f8ab
+
14f8ab
+	# case 1
14f8ab
+	if [[ -z "${attr}" ]]; then
14f8ab
+		return ${OCF_SUCCESS}
14f8ab
+	fi
14f8ab
+
14f8ab
+	# case 2
14f8ab
+	if [[ "${attr}" = *"value=1" ]]; then
14f8ab
+		return ${OCF_SUCCESS}
14f8ab
+	fi
14f8ab
+
14f8ab
+	# case 3
14f8ab
+	return ${OCF_NOT_RUNNING}
14f8ab
+}
14f8ab
+
14f8ab
+ganesha_grace_stop()
14f8ab
+{
14f8ab
+
14f8ab
+	ocf_log debug "ganesha_grace_stop()"
14f8ab
+	return ${OCF_SUCCESS}
14f8ab
+}
14f8ab
+
14f8ab
+ganesha_grace_notify()
14f8ab
+{
14f8ab
+        # since this is a clone RA we should only ever see pre-start
14f8ab
+        # or post-stop
14f8ab
+	mode="${OCF_RESKEY_CRM_meta_notify_type}-${OCF_RESKEY_CRM_meta_notify_operation}"
14f8ab
+	case "${mode}" in
14f8ab
+	pre-start | post-stop)
14f8ab
+		dbus-send --print-reply --system --dest=org.ganesha.nfsd /org/ganesha/nfsd/admin org.ganesha.nfsd.admin.grace string:${OCF_RESKEY_CRM_meta_notify_stop_uname}
14f8ab
+		if [ $? -ne 0 ]; then
14f8ab
+			ocf_log info "dbus-send --print-reply --system --dest=org.ganesha.nfsd /org/ganesha/nfsd/admin org.ganesha.nfsd.admin.grace string:${OCF_RESKEY_CRM_meta_notify_stop_uname} failed"
14f8ab
+		fi
14f8ab
+		;;
14f8ab
+	esac
14f8ab
+
14f8ab
+	return ${OCF_SUCCESS}
14f8ab
+}
14f8ab
+
14f8ab
+ganesha_grace_monitor()
14f8ab
+{
14f8ab
+	local host=$(hostname -s)
14f8ab
+
14f8ab
+	ocf_log debug "monitor"
14f8ab
+
14f8ab
+	attr=$(crm_attribute --query --node=${host} --name=${OCF_RESKEY_grace_active} 2> /dev/null)
14f8ab
+        if [ $? -ne 0 ]; then
14f8ab
+		host=$(hostname)
14f8ab
+	        attr=$(crm_attribute --query --node=${host} --name=${OCF_RESKEY_grace_active} 2> /dev/null)
14f8ab
+                if [ $? -ne 0 ]; then
14f8ab
+	                ocf_log info "crm_attribute --query --node=${host} --name=${OCF_RESKEY_grace_active} failed"
14f8ab
+                fi
14f8ab
+        fi
14f8ab
+
14f8ab
+	# if there is no attribute (yet), maybe it's because
14f8ab
+	# this RA started before ganesha_mon (nfs-mon) has had
14f8ab
+	# chance to create it. In which case we'll pretend
14f8ab
+	# everything is okay this time around
14f8ab
+	if [[ -z "${attr}" ]]; then
14f8ab
+		return ${OCF_SUCCESS}
14f8ab
+	fi
14f8ab
+
14f8ab
+	if [[ "${attr}" = *"value=1" ]]; then
14f8ab
+		return ${OCF_SUCCESS}
14f8ab
+	fi
14f8ab
+
14f8ab
+	return ${OCF_NOT_RUNNING}
14f8ab
+}
14f8ab
+
14f8ab
+ganesha_grace_validate()
14f8ab
+{
14f8ab
+	return ${OCF_SUCCESS}
14f8ab
+}
14f8ab
+
14f8ab
+ganesha_grace_validate
14f8ab
+
14f8ab
+# Translate each action into the appropriate function call
14f8ab
+case $__OCF_ACTION in
14f8ab
+start)          ganesha_grace_start
14f8ab
+		;;
14f8ab
+stop)           ganesha_grace_stop
14f8ab
+		;;
14f8ab
+status|monitor) ganesha_grace_monitor
14f8ab
+		;;
14f8ab
+notify)         ganesha_grace_notify
14f8ab
+		;;
14f8ab
+*)              ganesha_grace_usage
14f8ab
+		exit ${OCF_ERR_UNIMPLEMENTED}
14f8ab
+		;;
14f8ab
+esac
14f8ab
+
14f8ab
+rc=$?
14f8ab
+
14f8ab
+# The resource agent may optionally log a debug message
14f8ab
+ocf_log debug "${OCF_RESOURCE_INSTANCE} ${__OCF_ACTION} returned $rc"
14f8ab
+exit $rc
14f8ab
diff --git a/extras/ganesha/ocf/ganesha_mon b/extras/ganesha/ocf/ganesha_mon
14f8ab
new file mode 100644
14f8ab
index 0000000..2b4a9d6
14f8ab
--- /dev/null
14f8ab
+++ b/extras/ganesha/ocf/ganesha_mon
14f8ab
@@ -0,0 +1,234 @@
14f8ab
+#!/bin/bash
14f8ab
+#
14f8ab
+# Copyright (c) 2014 Anand Subramanian anands@redhat.com
14f8ab
+# Copyright (c) 2015 Red Hat Inc.
14f8ab
+#                    All Rights Reserved.
14f8ab
+#
14f8ab
+# This program is free software; you can redistribute it and/or modify
14f8ab
+# it under the terms of version 2 of the GNU General Public License as
14f8ab
+# published by the Free Software Foundation.
14f8ab
+#
14f8ab
+# This program is distributed in the hope that it would be useful, but
14f8ab
+# WITHOUT ANY WARRANTY; without even the implied warranty of
14f8ab
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14f8ab
+#
14f8ab
+# Further, this software is distributed without any warranty that it is
14f8ab
+# free of the rightful claim of any third person regarding infringement
14f8ab
+# or the like.  Any license provided herein, whether implied or
14f8ab
+# otherwise, applies only to this software file.  Patent licenses, if
14f8ab
+# any, provided herein do not apply to combinations of this program with
14f8ab
+# other software, or any other product whatsoever.
14f8ab
+#
14f8ab
+# You should have received a copy of the GNU General Public License
14f8ab
+# along with this program; if not, write the Free Software Foundation,
14f8ab
+# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
14f8ab
+#
14f8ab
+#
14f8ab
+
14f8ab
+# Initialization:
14f8ab
+: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
14f8ab
+. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
14f8ab
+
14f8ab
+if [ -n "${OCF_DEBUG_LIBRARY}" ]; then
14f8ab
+	. ${OCF_DEBUG_LIBRARY}
14f8ab
+else
14f8ab
+	: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
14f8ab
+	. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
14f8ab
+fi
14f8ab
+
14f8ab
+# Defaults
14f8ab
+OCF_RESKEY_ganesha_active_default="ganesha-active"
14f8ab
+OCF_RESKEY_grace_active_default="grace-active"
14f8ab
+OCF_RESKEY_grace_delay_default="5"
14f8ab
+
14f8ab
+: ${OCF_RESKEY_ganesha_active=${OCF_RESKEY_ganesha_active_default}}
14f8ab
+: ${OCF_RESKEY_grace_active=${OCF_RESKEY_grace_active_default}}
14f8ab
+: ${OCF_RESKEY_grace_delay=${OCF_RESKEY_grace_delay_default}}
14f8ab
+
14f8ab
+ganesha_meta_data() {
14f8ab
+	cat <
14f8ab
+
14f8ab
+
14f8ab
+<resource-agent name="ganesha_mon">
14f8ab
+<version>1.0</version>
14f8ab
+
14f8ab
+<longdesc lang="en">
14f8ab
+This Linux-specific resource agent acts as a dummy
14f8ab
+resource agent for nfs-ganesha.
14f8ab
+</longdesc>
14f8ab
+
14f8ab
+<shortdesc lang="en">Manages the user-space nfs-ganesha NFS server</shortdesc>
14f8ab
+
14f8ab
+<parameters>
14f8ab
+<parameter name="ganesha_active">
14f8ab
+<longdesc lang="en">NFS-Ganesha daemon active attribute</longdesc>
14f8ab
+<shortdesc lang="en">NFS-Ganesha daemon active attribute</shortdesc>
14f8ab
+<content type="string" default="ganesha-active" />
14f8ab
+</parameter>
14f8ab
+<parameter name="grace_active">
14f8ab
+<longdesc lang="en">NFS-Ganesha grace active attribute</longdesc>
14f8ab
+<shortdesc lang="en">NFS-Ganesha grace active attribute</shortdesc>
14f8ab
+<content type="string" default="grace-active" />
14f8ab
+</parameter>
14f8ab
+<parameter name="grace_delay">
14f8ab
+<longdesc lang="en">
14f8ab
+NFS-Ganesha grace delay.
14f8ab
+When changing this, adjust the ganesha_grace RA's monitor interval to match.
14f8ab
+</longdesc>
14f8ab
+<shortdesc lang="en">NFS-Ganesha grace delay</shortdesc>
14f8ab
+<content type="string" default="5" />
14f8ab
+</parameter>
14f8ab
+</parameters>
14f8ab
+
14f8ab
+<actions>
14f8ab
+<action name="start"   timeout="40s" />
14f8ab
+<action name="stop"    timeout="40s" />
14f8ab
+<action name="status"  timeout="20s" interval="60s" />
14f8ab
+<action name="monitor" depth="0"  timeout="10s" interval="10s" />
14f8ab
+<action name="meta-data"  timeout="20s" />
14f8ab
+</actions>
14f8ab
+</resource-agent>
14f8ab
+END
14f8ab
+
14f8ab
+return ${OCF_SUCCESS}
14f8ab
+}
14f8ab
+
14f8ab
+ganesha_mon_usage() {
14f8ab
+	echo "ganesha.nfsd USAGE"
14f8ab
+}
14f8ab
+
14f8ab
+# Make sure meta-data and usage always succeed
14f8ab
+case ${__OCF_ACTION} in
14f8ab
+	meta-data)	ganesha_meta_data
14f8ab
+			exit ${OCF_SUCCESS}
14f8ab
+			;;
14f8ab
+	usage|help)	ganesha_usage
14f8ab
+			exit ${OCF_SUCCESS}
14f8ab
+			;;
14f8ab
+	*)
14f8ab
+			;;
14f8ab
+esac
14f8ab
+
14f8ab
+ganesha_mon_start()
14f8ab
+{
14f8ab
+	ocf_log debug "ganesha_mon_start"
14f8ab
+	ganesha_mon_monitor
14f8ab
+	return $OCF_SUCCESS
14f8ab
+}
14f8ab
+
14f8ab
+ganesha_mon_stop()
14f8ab
+{
14f8ab
+	ocf_log debug "ganesha_mon_stop"
14f8ab
+	return $OCF_SUCCESS
14f8ab
+}
14f8ab
+
14f8ab
+ganesha_mon_monitor()
14f8ab
+{
14f8ab
+	local host=$(hostname -s)
14f8ab
+	local pid_file="/var/run/ganesha.pid"
14f8ab
+	local rhel6_pid_file="/var/run/ganesha.nfsd.pid"
14f8ab
+	local proc_pid="/proc/"
14f8ab
+
14f8ab
+	# RHEL6 /etc/init.d/nfs-ganesha adds -p /var/run/ganesha.nfsd.pid
14f8ab
+	# RHEL7 systemd does not. Would be nice if all distros used the
14f8ab
+	# same pid file.
14f8ab
+	if [ -e ${rhel6_pid_file} ]; then
14f8ab
+		pid_file=${rhel6_pid_file}
14f8ab
+	fi
14f8ab
+	if [ -e ${pid_file} ]; then
14f8ab
+		proc_pid="${proc_pid}$(cat ${pid_file})"
14f8ab
+	fi
14f8ab
+
14f8ab
+	if [ "x${proc_pid}" != "x/proc/" -a -d ${proc_pid} ]; then
14f8ab
+
14f8ab
+		attrd_updater -n ${OCF_RESKEY_ganesha_active} -v 1
14f8ab
+		if [ $? -ne 0 ]; then
14f8ab
+			ocf_log info "warning: attrd_updater -n ${OCF_RESKEY_ganesha_active} -v 1 failed"
14f8ab
+		fi
14f8ab
+
14f8ab
+		# ganesha_grace (nfs-grace) RA follows grace-active attr
14f8ab
+		# w/ constraint location
14f8ab
+		attrd_updater -n ${OCF_RESKEY_grace_active} -v 1
14f8ab
+		if [ $? -ne 0 ]; then
14f8ab
+			ocf_log info "warning: attrd_updater -n ${OCF_RESKEY_grace_active} -v 1 failed"
14f8ab
+		fi
14f8ab
+
14f8ab
+		# ganesha_mon (nfs-mon) and ganesha_grace (nfs-grace)
14f8ab
+		# track grace-active crm_attr (attr != crm_attr)
14f8ab
+		# we can't just use the attr as there's no way to query
14f8ab
+		# its value in RHEL6 pacemaker
14f8ab
+
14f8ab
+		crm_attribute --node=${host} --lifetime=forever --name=${OCF_RESKEY_grace_active} --update=1 2> /dev/null
14f8ab
+		if [ $? -ne 0 ]; then
14f8ab
+			host=$(hostname)
14f8ab
+			crm_attribute --node=${host} --lifetime=forever --name=${OCF_RESKEY_grace_active} --update=1 2> /dev/null
14f8ab
+			if [ $? -ne 0 ]; then
14f8ab
+				ocf_log info "mon monitor warning: crm_attribute --node=${host} --lifetime=forever --name=${OCF_RESKEY_grace_active} --update=1 failed"
14f8ab
+			fi
14f8ab
+		fi
14f8ab
+
14f8ab
+		return ${OCF_SUCCESS}
14f8ab
+	fi
14f8ab
+
14f8ab
+	# VIP fail-over is triggered by clearing the
14f8ab
+	# ganesha-active node attribute on this node.
14f8ab
+	#
14f8ab
+	# Meanwhile the ganesha_grace notify() runs when its
14f8ab
+	# nfs-grace resource is disabled on a node; which
14f8ab
+	# is triggered by clearing the grace-active attribute
14f8ab
+	# on this node.
14f8ab
+	#
14f8ab
+	# We need to allow time for it to run and put
14f8ab
+	# the remaining ganesha.nfsds into grace before
14f8ab
+	# initiating the VIP fail-over.
14f8ab
+
14f8ab
+	attrd_updater -D -n ${OCF_RESKEY_grace_active}
14f8ab
+	if [ $? -ne 0 ]; then
14f8ab
+		ocf_log info "warning: attrd_updater -D -n ${OCF_RESKEY_grace_active} failed"
14f8ab
+	fi
14f8ab
+
14f8ab
+	host=$(hostname -s)
14f8ab
+	crm_attribute --node=${host} --name=${OCF_RESKEY_grace_active} --update=0 2> /dev/null
14f8ab
+	if [ $? -ne 0 ]; then
14f8ab
+		host=$(hostname)
14f8ab
+		crm_attribute --node=${host} --name=${OCF_RESKEY_grace_active} --update=0 2> /dev/null
14f8ab
+		if [ $? -ne 0 ]; then
14f8ab
+			ocf_log info "mon monitor warning: crm_attribute --node=${host} --name=${OCF_RESKEY_grace_active} --update=0 failed"
14f8ab
+		fi
14f8ab
+	fi
14f8ab
+
14f8ab
+	sleep ${OCF_RESKEY_grace_delay}
14f8ab
+
14f8ab
+	attrd_updater -D -n ${OCF_RESKEY_ganesha_active}
14f8ab
+	if [ $? -ne 0 ]; then
14f8ab
+		ocf_log info "warning: attrd_updater -D -n ${OCF_RESKEY_ganesha_active} failed"
14f8ab
+	fi
14f8ab
+
14f8ab
+	return ${OCF_SUCCESS}
14f8ab
+}
14f8ab
+
14f8ab
+ganesha_mon_validate()
14f8ab
+{
14f8ab
+	return ${OCF_SUCCESS}
14f8ab
+}
14f8ab
+
14f8ab
+ganesha_mon_validate
14f8ab
+
14f8ab
+# Translate each action into the appropriate function call
14f8ab
+case ${__OCF_ACTION} in
14f8ab
+start)          ganesha_mon_start
14f8ab
+		;;
14f8ab
+stop)           ganesha_mon_stop
14f8ab
+		;;
14f8ab
+status|monitor) ganesha_mon_monitor
14f8ab
+		;;
14f8ab
+*)              ganesha_mon_usage
14f8ab
+		exit ${OCF_ERR_UNIMPLEMENTED}
14f8ab
+		;;
14f8ab
+esac
14f8ab
+
14f8ab
+rc=$?
14f8ab
+
14f8ab
+# The resource agent may optionally log a debug message
14f8ab
+ocf_log debug "${OCF_RESOURCE_INSTANCE} ${__OCF_ACTION} returned $rc"
14f8ab
+exit $rc
14f8ab
diff --git a/extras/ganesha/ocf/ganesha_nfsd b/extras/ganesha/ocf/ganesha_nfsd
14f8ab
new file mode 100644
14f8ab
index 0000000..93fc8be
14f8ab
--- /dev/null
14f8ab
+++ b/extras/ganesha/ocf/ganesha_nfsd
14f8ab
@@ -0,0 +1,167 @@
14f8ab
+#!/bin/bash
14f8ab
+#
14f8ab
+# Copyright (c) 2014 Anand Subramanian anands@redhat.com
14f8ab
+# Copyright (c) 2015 Red Hat Inc.
14f8ab
+#                    All Rights Reserved.
14f8ab
+#
14f8ab
+# This program is free software; you can redistribute it and/or modify
14f8ab
+# it under the terms of version 2 of the GNU General Public License as
14f8ab
+# published by the Free Software Foundation.
14f8ab
+#
14f8ab
+# This program is distributed in the hope that it would be useful, but
14f8ab
+# WITHOUT ANY WARRANTY; without even the implied warranty of
14f8ab
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14f8ab
+#
14f8ab
+# Further, this software is distributed without any warranty that it is
14f8ab
+# free of the rightful claim of any third person regarding infringement
14f8ab
+# or the like.  Any license provided herein, whether implied or
14f8ab
+# otherwise, applies only to this software file.  Patent licenses, if
14f8ab
+# any, provided herein do not apply to combinations of this program with
14f8ab
+# other software, or any other product whatsoever.
14f8ab
+#
14f8ab
+# You should have received a copy of the GNU General Public License
14f8ab
+# along with this program; if not, write the Free Software Foundation,
14f8ab
+# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
14f8ab
+#
14f8ab
+#
14f8ab
+
14f8ab
+# Initialization:
14f8ab
+: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
14f8ab
+. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
14f8ab
+
14f8ab
+if [ -n "${OCF_DEBUG_LIBRARY}" ]; then
14f8ab
+	. ${OCF_DEBUG_LIBRARY}
14f8ab
+else
14f8ab
+	: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
14f8ab
+	. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
14f8ab
+fi
14f8ab
+
14f8ab
+OCF_RESKEY_ha_vol_mnt_default="/var/run/gluster/shared_storage"
14f8ab
+: ${OCF_RESKEY_ha_vol_mnt=${OCF_RESKEY_ha_vol_mnt_default}}
14f8ab
+
14f8ab
+ganesha_meta_data() {
14f8ab
+	cat <
14f8ab
+
14f8ab
+
14f8ab
+<resource-agent name="ganesha_nfsd">
14f8ab
+<version>1.0</version>
14f8ab
+
14f8ab
+<longdesc lang="en">
14f8ab
+This Linux-specific resource agent acts as a dummy
14f8ab
+resource agent for nfs-ganesha.
14f8ab
+</longdesc>
14f8ab
+
14f8ab
+<shortdesc lang="en">Manages the user-space nfs-ganesha NFS server</shortdesc>
14f8ab
+
14f8ab
+<parameters>
14f8ab
+<parameter name="ha_vol_mnt">
14f8ab
+<longdesc lang="en">HA State Volume Mount Point</longdesc>
14f8ab
+<shortdesc lang="en">HA_State Volume Mount Point</shortdesc>
14f8ab
+<content type="string" default="" />
14f8ab
+</parameter>
14f8ab
+</parameters>
14f8ab
+
14f8ab
+<actions>
14f8ab
+<action name="start"   timeout="5s" />
14f8ab
+<action name="stop"    timeout="5s" />
14f8ab
+<action name="status" depth="0"  timeout="5s" interval="0" />
14f8ab
+<action name="monitor" depth="0"  timeout="5s" interval="0" />
14f8ab
+<action name="meta-data"  timeout="20s" />
14f8ab
+</actions>
14f8ab
+</resource-agent>
14f8ab
+END
14f8ab
+
14f8ab
+return ${OCF_SUCCESS}
14f8ab
+}
14f8ab
+
14f8ab
+ganesha_nfsd_usage() {
14f8ab
+	echo "ganesha.nfsd USAGE"
14f8ab
+}
14f8ab
+
14f8ab
+# Make sure meta-data and usage always succeed
14f8ab
+case $__OCF_ACTION in
14f8ab
+	meta-data)	ganesha_meta_data
14f8ab
+			exit ${OCF_SUCCESS}
14f8ab
+			;;
14f8ab
+	usage|help)	ganesha_usage
14f8ab
+			exit ${OCF_SUCCESS}
14f8ab
+			;;
14f8ab
+	*)
14f8ab
+			;;
14f8ab
+esac
14f8ab
+
14f8ab
+ganesha_nfsd_start()
14f8ab
+{
14f8ab
+	local long_host=$(hostname)
14f8ab
+
14f8ab
+	if [[ -d /var/lib/nfs ]]; then
14f8ab
+		mv /var/lib/nfs /var/lib/nfs.backup
14f8ab
+		if [ $? -ne 0 ]; then
14f8ab
+			ocf_log notice "mv /var/lib/nfs /var/lib/nfs.backup failed"
14f8ab
+		fi
14f8ab
+		ln -s ${OCF_RESKEY_ha_vol_mnt}/nfs-ganesha/${long_host}/nfs /var/lib/nfs
14f8ab
+		if [ $? -ne 0 ]; then
14f8ab
+			ocf_log notice "ln -s ${OCF_RESKEY_ha_vol_mnt}/nfs-ganesha/${long_host}/nfs /var/lib/nfs failed"
14f8ab
+		fi
14f8ab
+	fi
14f8ab
+
14f8ab
+	return ${OCF_SUCCESS}
14f8ab
+}
14f8ab
+
14f8ab
+ganesha_nfsd_stop()
14f8ab
+{
14f8ab
+
14f8ab
+	if [ -L /var/lib/nfs -a -d /var/lib/nfs.backup ]; then
14f8ab
+		rm -f /var/lib/nfs
14f8ab
+		if [ $? -ne 0 ]; then
14f8ab
+			ocf_log notice "rm -f /var/lib/nfs failed"
14f8ab
+		fi
14f8ab
+		mv /var/lib/nfs.backup /var/lib/nfs
14f8ab
+		if [ $? -ne 0 ]; then
14f8ab
+			ocf_log notice "mv /var/lib/nfs.backup /var/lib/nfs failed"
14f8ab
+		fi
14f8ab
+	fi
14f8ab
+
14f8ab
+	return ${OCF_SUCCESS}
14f8ab
+}
14f8ab
+
14f8ab
+ganesha_nfsd_monitor()
14f8ab
+{
14f8ab
+	# pacemaker checks to see if RA is already running before starting it.
14f8ab
+	# if we return success, then it's presumed it's already running and
14f8ab
+	# doesn't need to be started, i.e. invoke the start action.
14f8ab
+	# return something other than success to make pacemaker invoke the
14f8ab
+	# start action
14f8ab
+	if [[ -L /var/lib/nfs ]]; then
14f8ab
+		return ${OCF_SUCCESS}
14f8ab
+	fi
14f8ab
+	return ${OCF_NOT_RUNNING}
14f8ab
+}
14f8ab
+
14f8ab
+ganesha_nfsd_validate()
14f8ab
+{
14f8ab
+	return ${OCF_SUCCESS}
14f8ab
+}
14f8ab
+
14f8ab
+ganesha_nfsd_validate
14f8ab
+
14f8ab
+# ocf_log notice "ganesha_nfsd ${OCF_RESOURCE_INSTANCE} $__OCF_ACTION"
14f8ab
+
14f8ab
+# Translate each action into the appropriate function call
14f8ab
+case $__OCF_ACTION in
14f8ab
+start)          ganesha_nfsd_start
14f8ab
+		;;
14f8ab
+stop)           ganesha_nfsd_stop
14f8ab
+		;;
14f8ab
+status|monitor) ganesha_nfsd_monitor
14f8ab
+		;;
14f8ab
+*)              ganesha_nfsd_usage
14f8ab
+		exit ${OCF_ERR_UNIMPLEMENTED}
14f8ab
+		;;
14f8ab
+esac
14f8ab
+
14f8ab
+rc=$?
14f8ab
+
14f8ab
+# The resource agent may optionally log a debug message
14f8ab
+ocf_log debug "${OCF_RESOURCE_INSTANCE} ${__OCF_ACTION} returned $rc"
14f8ab
+exit $rc
14f8ab
diff --git a/extras/ganesha/scripts/Makefile.am b/extras/ganesha/scripts/Makefile.am
14f8ab
index 00a2c45..7e345fd 100644
14f8ab
--- a/extras/ganesha/scripts/Makefile.am
14f8ab
+++ b/extras/ganesha/scripts/Makefile.am
14f8ab
@@ -1,4 +1,6 @@
14f8ab
-EXTRA_DIST= create-export-ganesha.sh generate-epoch.py dbus-send.sh
14f8ab
+EXTRA_DIST= create-export-ganesha.sh generate-epoch.py dbus-send.sh \
14f8ab
+			ganesha-ha.sh
14f8ab
 
14f8ab
 scriptsdir = $(libexecdir)/ganesha
14f8ab
-scripts_SCRIPTS = create-export-ganesha.sh dbus-send.sh generate-epoch.py
14f8ab
+scripts_SCRIPTS = create-export-ganesha.sh dbus-send.sh generate-epoch.py \
14f8ab
+				  ganesha-ha.sh
14f8ab
diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh
14f8ab
new file mode 100644
14f8ab
index 0000000..6b011be
14f8ab
--- /dev/null
14f8ab
+++ b/extras/ganesha/scripts/ganesha-ha.sh
14f8ab
@@ -0,0 +1,1125 @@
14f8ab
+#!/bin/bash
14f8ab
+
14f8ab
+# Copyright 2015-2016 Red Hat Inc.  All Rights Reserved
14f8ab
+#
14f8ab
+# Pacemaker+Corosync High Availability for NFS-Ganesha
14f8ab
+#
14f8ab
+# setup, teardown, add, delete, refresh-config, and status
14f8ab
+#
14f8ab
+# Each participating node in the cluster is assigned a virtual IP (VIP)
14f8ab
+# which fails over to another node when its associated ganesha.nfsd dies
14f8ab
+# for any reason. After the VIP is moved to another node all the
14f8ab
+# ganesha.nfsds are send a signal using DBUS to put them into NFS GRACE.
14f8ab
+#
14f8ab
+# There are six resource agent types used: ganesha_mon, ganesha_grace,
14f8ab
+# ganesha_nfsd, IPaddr, and Dummy. ganesha_mon is used to monitor the
14f8ab
+# ganesha.nfsd. ganesha_grace is used to send the DBUS signal to put
14f8ab
+# the remaining ganesha.nfsds into grace. ganesha_nfsd is used to start
14f8ab
+# and stop the ganesha.nfsd during setup and teardown. IPaddr manages
14f8ab
+# the VIP. A Dummy resource named $hostname-trigger_ip-1 is used to
14f8ab
+# ensure that the NFS GRACE DBUS signal is sent after the VIP moves to
14f8ab
+# the new host.
14f8ab
+
14f8ab
+HA_NUM_SERVERS=0
14f8ab
+HA_SERVERS=""
14f8ab
+HA_VOL_NAME="gluster_shared_storage"
14f8ab
+HA_VOL_MNT="/var/run/gluster/shared_storage"
14f8ab
+HA_CONFDIR=$HA_VOL_MNT"/nfs-ganesha"
14f8ab
+SERVICE_MAN="DISTRO_NOT_FOUND"
14f8ab
+
14f8ab
+RHEL6_PCS_CNAME_OPTION="--name"
14f8ab
+SECRET_PEM="/var/lib/glusterd/nfs/secret.pem"
14f8ab
+
14f8ab
+# UNBLOCK RA uses shared_storage which may become unavailable
14f8ab
+# during any of the nodes reboot. Hence increase timeout value.
14f8ab
+PORTBLOCK_UNBLOCK_TIMEOUT="60s"
14f8ab
+
14f8ab
+# Try loading the config from any of the distro
14f8ab
+# specific configuration locations
14f8ab
+if [ -f /etc/sysconfig/ganesha ]
14f8ab
+        then
14f8ab
+        . /etc/sysconfig/ganesha
14f8ab
+fi
14f8ab
+if [ -f /etc/conf.d/ganesha ]
14f8ab
+        then
14f8ab
+        . /etc/conf.d/ganesha
14f8ab
+fi
14f8ab
+if [ -f /etc/default/ganesha ]
14f8ab
+        then
14f8ab
+        . /etc/default/ganesha
14f8ab
+fi
14f8ab
+
14f8ab
+GANESHA_CONF=
14f8ab
+
14f8ab
+function find_rhel7_conf
14f8ab
+{
14f8ab
+ while [[ $# > 0 ]]
14f8ab
+        do
14f8ab
+                key="$1"
14f8ab
+                case $key in
14f8ab
+                        -f)
14f8ab
+                         CONFFILE="$2"
14f8ab
+                         break;
14f8ab
+                         ;;
14f8ab
+                         *)
14f8ab
+                         ;;
14f8ab
+                 esac
14f8ab
+                 shift
14f8ab
+         done
14f8ab
+}
14f8ab
+
14f8ab
+if [ -z $CONFFILE ]
14f8ab
+        then
14f8ab
+        find_rhel7_conf $OPTIONS
14f8ab
+
14f8ab
+fi
14f8ab
+
14f8ab
+GANESHA_CONF=${CONFFILE:-/etc/ganesha/ganesha.conf}
14f8ab
+
14f8ab
+usage() {
14f8ab
+
14f8ab
+        echo "Usage      : add|delete|refresh-config|status"
14f8ab
+        echo "Add-node   : ganesha-ha.sh --add <HA_CONF_DIR> \
14f8ab
+<NODE-HOSTNAME>  <NODE-VIP>"
14f8ab
+        echo "Delete-node: ganesha-ha.sh --delete <HA_CONF_DIR> \
14f8ab
+<NODE-HOSTNAME>"
14f8ab
+        echo "Refresh-config : ganesha-ha.sh --refresh-config <HA_CONFDIR> \
14f8ab
+<volume>"
14f8ab
+        echo "Status : ganesha-ha.sh --status <HA_CONFDIR>"
14f8ab
+}
14f8ab
+
14f8ab
+determine_service_manager () {
14f8ab
+
14f8ab
+        if [ -e "/usr/bin/systemctl" ];
14f8ab
+        then
14f8ab
+                SERVICE_MAN="/usr/bin/systemctl"
14f8ab
+        elif [ -e "/sbin/invoke-rc.d" ];
14f8ab
+        then
14f8ab
+                SERVICE_MAN="/sbin/invoke-rc.d"
14f8ab
+        elif [ -e "/sbin/service" ];
14f8ab
+        then
14f8ab
+                SERVICE_MAN="/sbin/service"
14f8ab
+        fi
14f8ab
+        if [ "$SERVICE_MAN" == "DISTRO_NOT_FOUND" ]
14f8ab
+        then
14f8ab
+                echo "Service manager not recognized, exiting"
14f8ab
+                exit 1
14f8ab
+        fi
14f8ab
+}
14f8ab
+
14f8ab
+manage_service ()
14f8ab
+{
14f8ab
+        local action=${1}
14f8ab
+        local new_node=${2}
14f8ab
+        local option=
14f8ab
+
14f8ab
+        if [ "$action" == "start" ]; then
14f8ab
+                option="yes"
14f8ab
+        else
14f8ab
+                option="no"
14f8ab
+        fi
14f8ab
+        ssh -oPasswordAuthentication=no -oStrictHostKeyChecking=no -i \
14f8ab
+${SECRET_PEM} root@${new_node} "/usr/libexec/ganesha/ganesha-ha.sh --setup-ganesha-conf-files $HA_CONFDIR $option"
14f8ab
+
14f8ab
+        if [ "$SERVICE_MAN" == "/usr/bin/systemctl" ]
14f8ab
+        then
14f8ab
+                ssh -oPasswordAuthentication=no -oStrictHostKeyChecking=no -i \
14f8ab
+${SECRET_PEM} root@${new_node} "$SERVICE_MAN  ${action} nfs-ganesha"
14f8ab
+        else
14f8ab
+                ssh -oPasswordAuthentication=no -oStrictHostKeyChecking=no -i \
14f8ab
+${SECRET_PEM} root@${new_node} "$SERVICE_MAN nfs-ganesha ${action}"
14f8ab
+        fi
14f8ab
+}
14f8ab
+
14f8ab
+
14f8ab
+check_cluster_exists()
14f8ab
+{
14f8ab
+    local name=${1}
14f8ab
+    local cluster_name=""
14f8ab
+
14f8ab
+    if [ -e /var/run/corosync.pid ]; then
14f8ab
+        cluster_name=$(pcs status | grep "Cluster name:" | cut -d ' ' -f 3)
14f8ab
+        if [ ${cluster_name} -a ${cluster_name} = ${name} ]; then
14f8ab
+            logger "$name already exists, exiting"
14f8ab
+            exit 0
14f8ab
+        fi
14f8ab
+    fi
14f8ab
+}
14f8ab
+
14f8ab
+
14f8ab
+determine_servers()
14f8ab
+{
14f8ab
+    local cmd=${1}
14f8ab
+    local num_servers=0
14f8ab
+    local tmp_ifs=${IFS}
14f8ab
+    local ha_servers=""
14f8ab
+
14f8ab
+    if [ "X${cmd}X" != "XsetupX" -a "X${cmd}X" != "XstatusX" ]; then
14f8ab
+        ha_servers=$(pcs status | grep "Online:" | grep -o '\[.*\]' | sed -e 's/\[//' | sed -e 's/\]//')
14f8ab
+        IFS=$' '
14f8ab
+        for server in ${ha_servers} ; do
14f8ab
+            num_servers=$(expr ${num_servers} + 1)
14f8ab
+        done
14f8ab
+        IFS=${tmp_ifs}
14f8ab
+        HA_NUM_SERVERS=${num_servers}
14f8ab
+        HA_SERVERS="${ha_servers}"
14f8ab
+    else
14f8ab
+        IFS=$','
14f8ab
+        for server in ${HA_CLUSTER_NODES} ; do
14f8ab
+            num_servers=$(expr ${num_servers} + 1)
14f8ab
+        done
14f8ab
+        IFS=${tmp_ifs}
14f8ab
+        HA_NUM_SERVERS=${num_servers}
14f8ab
+        HA_SERVERS="${HA_CLUSTER_NODES//,/ }"
14f8ab
+    fi
14f8ab
+}
14f8ab
+
14f8ab
+
14f8ab
+setup_cluster()
14f8ab
+{
14f8ab
+    local name=${1}
14f8ab
+    local num_servers=${2}
14f8ab
+    local servers=${3}
14f8ab
+    local unclean=""
14f8ab
+    local quorum_policy="stop"
14f8ab
+
14f8ab
+    logger "setting up cluster ${name} with the following ${servers}"
14f8ab
+
14f8ab
+    pcs cluster auth ${servers}
14f8ab
+    # pcs cluster setup --name ${name} ${servers}
14f8ab
+    pcs cluster setup ${RHEL6_PCS_CNAME_OPTION} ${name} --transport udpu ${servers}
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+        logger "pcs cluster setup ${RHEL6_PCS_CNAME_OPTION} ${name} ${servers} failed"
14f8ab
+        exit 1;
14f8ab
+    fi
14f8ab
+    pcs cluster start --all
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+        logger "pcs cluster start failed"
14f8ab
+        exit 1;
14f8ab
+    fi
14f8ab
+
14f8ab
+    sleep 1
14f8ab
+    # wait for the cluster to elect a DC before querying or writing
14f8ab
+    # to the CIB. BZ 1334092
14f8ab
+    crmadmin --dc_lookup --timeout=5000 > /dev/null 2>&1
14f8ab
+    while [ $? -ne 0 ]; do
14f8ab
+        crmadmin --dc_lookup --timeout=5000 > /dev/null 2>&1
14f8ab
+    done
14f8ab
+
14f8ab
+    unclean=$(pcs status | grep -u "UNCLEAN")
14f8ab
+    while [[ "${unclean}X" = "UNCLEANX" ]]; do
14f8ab
+         sleep 1
14f8ab
+         unclean=$(pcs status | grep -u "UNCLEAN")
14f8ab
+    done
14f8ab
+    sleep 1
14f8ab
+
14f8ab
+    if [ ${num_servers} -lt 3 ]; then
14f8ab
+        quorum_policy="ignore"
14f8ab
+    fi
14f8ab
+    pcs property set no-quorum-policy=${quorum_policy}
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+        logger "warning: pcs property set no-quorum-policy=${quorum_policy} failed"
14f8ab
+    fi
14f8ab
+
14f8ab
+    pcs property set stonith-enabled=false
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+        logger "warning: pcs property set stonith-enabled=false failed"
14f8ab
+    fi
14f8ab
+}
14f8ab
+
14f8ab
+
14f8ab
+setup_finalize_ha()
14f8ab
+{
14f8ab
+    local cibfile=${1}
14f8ab
+    local stopped=""
14f8ab
+
14f8ab
+    stopped=$(pcs status | grep -u "Stopped")
14f8ab
+    while [[ "${stopped}X" = "StoppedX" ]]; do
14f8ab
+         sleep 1
14f8ab
+         stopped=$(pcs status | grep -u "Stopped")
14f8ab
+    done
14f8ab
+}
14f8ab
+
14f8ab
+
14f8ab
+refresh_config ()
14f8ab
+{
14f8ab
+        local short_host=$(hostname -s)
14f8ab
+        local VOL=${1}
14f8ab
+        local HA_CONFDIR=${2}
14f8ab
+        local short_host=$(hostname -s)
14f8ab
+
14f8ab
+        local export_id=$(grep ^[[:space:]]*Export_Id $HA_CONFDIR/exports/export.$VOL.conf |\
14f8ab
+                          awk -F"[=,;]" '{print $2}' | tr -d '[[:space:]]')
14f8ab
+
14f8ab
+
14f8ab
+        if [ -e ${SECRET_PEM} ]; then
14f8ab
+        while [[ ${3} ]]; do
14f8ab
+            current_host=`echo ${3} | cut -d "." -f 1`
14f8ab
+            if [ ${short_host} != ${current_host} ]; then
14f8ab
+                output=$(ssh -oPasswordAuthentication=no \
14f8ab
+-oStrictHostKeyChecking=no -i ${SECRET_PEM} root@${current_host} \
14f8ab
+"dbus-send --print-reply --system --dest=org.ganesha.nfsd \
14f8ab
+/org/ganesha/nfsd/ExportMgr org.ganesha.nfsd.exportmgr.UpdateExport \
14f8ab
+string:$HA_CONFDIR/exports/export.$VOL.conf \
14f8ab
+string:\"EXPORT(Export_Id=$export_id)\" 2>&1")
14f8ab
+                ret=$?
14f8ab
+                logger <<< "${output}"
14f8ab
+                if [ ${ret} -ne 0 ]; then
14f8ab
+                        echo "Error: refresh-config failed on ${current_host}."
14f8ab
+                        exit 1
14f8ab
+                else
14f8ab
+                        echo "Refresh-config completed on ${current_host}."
14f8ab
+                fi
14f8ab
+
14f8ab
+          fi
14f8ab
+          shift
14f8ab
+        done
14f8ab
+    else
14f8ab
+        echo "Error: refresh-config failed. Passwordless ssh is not enabled."
14f8ab
+        exit 1
14f8ab
+    fi
14f8ab
+
14f8ab
+    # Run the same command on the localhost,
14f8ab
+        output=$(dbus-send --print-reply --system --dest=org.ganesha.nfsd \
14f8ab
+/org/ganesha/nfsd/ExportMgr org.ganesha.nfsd.exportmgr.UpdateExport \
14f8ab
+string:$HA_CONFDIR/exports/export.$VOL.conf \
14f8ab
+string:"EXPORT(Export_Id=$export_id)" 2>&1)
14f8ab
+        ret=$?
14f8ab
+        logger <<< "${output}"
14f8ab
+        if [ ${ret} -ne 0 ] ; then
14f8ab
+                echo "Error: refresh-config failed on localhost."
14f8ab
+                exit 1
14f8ab
+        else
14f8ab
+                echo "Success: refresh-config completed."
14f8ab
+        fi
14f8ab
+}
14f8ab
+
14f8ab
+
14f8ab
+teardown_cluster()
14f8ab
+{
14f8ab
+    local name=${1}
14f8ab
+
14f8ab
+    for server in ${HA_SERVERS} ; do
14f8ab
+        if [[ ${HA_CLUSTER_NODES} != *${server}* ]]; then
14f8ab
+            logger "info: ${server} is not in config, removing"
14f8ab
+
14f8ab
+            pcs cluster stop ${server} --force
14f8ab
+            if [ $? -ne 0 ]; then
14f8ab
+                logger "warning: pcs cluster stop ${server} failed"
14f8ab
+            fi
14f8ab
+
14f8ab
+            pcs cluster node remove ${server}
14f8ab
+            if [ $? -ne 0 ]; then
14f8ab
+                logger "warning: pcs cluster node remove ${server} failed"
14f8ab
+            fi
14f8ab
+        fi
14f8ab
+    done
14f8ab
+
14f8ab
+    # BZ 1193433 - pcs doesn't reload cluster.conf after modification
14f8ab
+    # after teardown completes, a subsequent setup will appear to have
14f8ab
+    # 'remembered' the deleted node. You can work around this by
14f8ab
+    # issuing another `pcs cluster node remove $node`,
14f8ab
+    # `crm_node -f -R $server`, or
14f8ab
+    # `cibadmin --delete --xml-text '
14f8ab
+    # uname="$server"/>'
14f8ab
+
14f8ab
+    pcs cluster stop --all
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+        logger "warning pcs cluster stop --all failed"
14f8ab
+    fi
14f8ab
+
14f8ab
+    pcs cluster destroy
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+        logger "error pcs cluster destroy failed"
14f8ab
+        exit 1
14f8ab
+    fi
14f8ab
+}
14f8ab
+
14f8ab
+
14f8ab
+cleanup_ganesha_config ()
14f8ab
+{
14f8ab
+    rm -f /etc/corosync/corosync.conf
14f8ab
+    rm -rf /etc/cluster/cluster.conf*
14f8ab
+    rm -rf /var/lib/pacemaker/cib/*
14f8ab
+}
14f8ab
+
14f8ab
+do_create_virt_ip_constraints()
14f8ab
+{
14f8ab
+    local cibfile=${1}; shift
14f8ab
+    local primary=${1}; shift
14f8ab
+    local weight="1000"
14f8ab
+
14f8ab
+    # first a constraint location rule that says the VIP must be where
14f8ab
+    # there's a ganesha.nfsd running
14f8ab
+    pcs -f ${cibfile} constraint location ${primary}-group rule score=-INFINITY ganesha-active ne 1
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+        logger "warning: pcs constraint location ${primary}-group rule score=-INFINITY ganesha-active ne 1 failed"
14f8ab
+    fi
14f8ab
+
14f8ab
+    # then a set of constraint location prefers to set the prefered order
14f8ab
+    # for where a VIP should move
14f8ab
+    while [[ ${1} ]]; do
14f8ab
+        pcs -f ${cibfile} constraint location ${primary}-group prefers ${1}=${weight}
14f8ab
+        if [ $? -ne 0 ]; then
14f8ab
+            logger "warning: pcs constraint location ${primary}-group prefers ${1}=${weight} failed"
14f8ab
+        fi
14f8ab
+        weight=$(expr ${weight} + 1000)
14f8ab
+        shift
14f8ab
+    done
14f8ab
+    # and finally set the highest preference for the VIP to its home node
14f8ab
+    # default weight when created is/was 100.
14f8ab
+    # on Fedora setting appears to be additive, so to get the desired
14f8ab
+    # value we adjust the weight
14f8ab
+    # weight=$(expr ${weight} - 100)
14f8ab
+    pcs -f ${cibfile} constraint location ${primary}-group prefers ${primary}=${weight}
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+        logger "warning: pcs constraint location ${primary}-group prefers ${primary}=${weight} failed"
14f8ab
+    fi
14f8ab
+}
14f8ab
+
14f8ab
+
14f8ab
+wrap_create_virt_ip_constraints()
14f8ab
+{
14f8ab
+    local cibfile=${1}; shift
14f8ab
+    local primary=${1}; shift
14f8ab
+    local head=""
14f8ab
+    local tail=""
14f8ab
+
14f8ab
+    # build a list of peers, e.g. for a four node cluster, for node1,
14f8ab
+    # the result is "node2 node3 node4"; for node2, "node3 node4 node1"
14f8ab
+    # and so on.
14f8ab
+    while [[ ${1} ]]; do
14f8ab
+        if [ "${1}" = "${primary}" ]; then
14f8ab
+            shift
14f8ab
+            while [[ ${1} ]]; do
14f8ab
+                tail=${tail}" "${1}
14f8ab
+                shift
14f8ab
+            done
14f8ab
+        else
14f8ab
+            head=${head}" "${1}
14f8ab
+        fi
14f8ab
+        shift
14f8ab
+    done
14f8ab
+    do_create_virt_ip_constraints ${cibfile} ${primary} ${tail} ${head}
14f8ab
+}
14f8ab
+
14f8ab
+
14f8ab
+create_virt_ip_constraints()
14f8ab
+{
14f8ab
+    local cibfile=${1}; shift
14f8ab
+
14f8ab
+    while [[ ${1} ]]; do
14f8ab
+        wrap_create_virt_ip_constraints ${cibfile} ${1} ${HA_SERVERS}
14f8ab
+        shift
14f8ab
+    done
14f8ab
+}
14f8ab
+
14f8ab
+
14f8ab
+setup_create_resources()
14f8ab
+{
14f8ab
+    local cibfile=$(mktemp -u)
14f8ab
+
14f8ab
+    # fixup /var/lib/nfs
14f8ab
+    logger "pcs resource create nfs_setup ocf:heartbeat:ganesha_nfsd ha_vol_mnt=${HA_VOL_MNT} --clone"
14f8ab
+    pcs resource create nfs_setup ocf:heartbeat:ganesha_nfsd ha_vol_mnt=${HA_VOL_MNT} --clone
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+        logger "warning: pcs resource create nfs_setup ocf:heartbeat:ganesha_nfsd ha_vol_mnt=${HA_VOL_MNT} --clone failed"
14f8ab
+    fi
14f8ab
+
14f8ab
+    pcs resource create nfs-mon ocf:heartbeat:ganesha_mon --clone
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+        logger "warning: pcs resource create nfs-mon ocf:heartbeat:ganesha_mon --clone failed"
14f8ab
+    fi
14f8ab
+
14f8ab
+    # see comment in (/usr/lib/ocf/resource.d/heartbeat/ganesha_grace
14f8ab
+    # start method. Allow time for ganesha_mon to start and set the
14f8ab
+    # ganesha-active crm_attribute
14f8ab
+    sleep 5
14f8ab
+
14f8ab
+    pcs resource create nfs-grace ocf:heartbeat:ganesha_grace --clone meta notify=true
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+        logger "warning: pcs resource create nfs-grace ocf:heartbeat:ganesha_grace --clone failed"
14f8ab
+    fi
14f8ab
+
14f8ab
+    pcs constraint location nfs-grace-clone rule score=-INFINITY grace-active ne 1
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+        logger "warning: pcs constraint location nfs-grace-clone rule score=-INFINITY grace-active ne 1"
14f8ab
+    fi
14f8ab
+
14f8ab
+    pcs cluster cib ${cibfile}
14f8ab
+
14f8ab
+    while [[ ${1} ]]; do
14f8ab
+
14f8ab
+        # this is variable indirection
14f8ab
+        # from a nvs like 'VIP_host1=10.7.6.5' or 'VIP_host1="10.7.6.5"'
14f8ab
+        # (or VIP_host-1=..., or VIP_host-1.my.domain.name=...)
14f8ab
+        # a variable 'clean_name' is created (e.g. w/ value 'VIP_host_1')
14f8ab
+        # and a clean nvs (e.g. w/ value 'VIP_host_1="10_7_6_5"')
14f8ab
+        # after the `eval ${clean_nvs}` there is a variable VIP_host_1
14f8ab
+        # with the value '10_7_6_5', and the following \$$ magic to
14f8ab
+        # reference it, i.e. `eval tmp_ipaddr=\$${clean_name}` gives us
14f8ab
+        # ${tmp_ipaddr} with 10_7_6_5 and then convert the _s back to .s
14f8ab
+        # to give us ipaddr="10.7.6.5". whew!
14f8ab
+        name="VIP_${1}"
14f8ab
+        clean_name=${name//[-.]/_}
14f8ab
+        nvs=$(grep "^${name}=" ${HA_CONFDIR}/ganesha-ha.conf)
14f8ab
+        clean_nvs=${nvs//[-.]/_}
14f8ab
+        eval ${clean_nvs}
14f8ab
+        eval tmp_ipaddr=\$${clean_name}
14f8ab
+        ipaddr=${tmp_ipaddr//_/.}
14f8ab
+
14f8ab
+        pcs -f ${cibfile} resource create ${1}-nfs_block ocf:heartbeat:portblock protocol=tcp \
14f8ab
+        portno=2049 action=block ip=${ipaddr} --group ${1}-group
14f8ab
+        if [ $? -ne 0 ]; then
14f8ab
+            logger "warning pcs resource create ${1}-nfs_block failed"
14f8ab
+        fi
14f8ab
+        pcs -f ${cibfile} resource create ${1}-cluster_ip-1 ocf:heartbeat:IPaddr ip=${ipaddr} \
14f8ab
+        cidr_netmask=32 op monitor interval=15s --group ${1}-group --after ${1}-nfs_block
14f8ab
+        if [ $? -ne 0 ]; then
14f8ab
+            logger "warning pcs resource create ${1}-cluster_ip-1 ocf:heartbeat:IPaddr ip=${ipaddr} \
14f8ab
+            cidr_netmask=32 op monitor interval=15s failed"
14f8ab
+        fi
14f8ab
+
14f8ab
+        pcs -f ${cibfile} constraint order nfs-grace-clone then ${1}-cluster_ip-1
14f8ab
+        if [ $? -ne 0 ]; then
14f8ab
+            logger "warning: pcs constraint order nfs-grace-clone then ${1}-cluster_ip-1 failed"
14f8ab
+        fi
14f8ab
+
14f8ab
+        pcs -f ${cibfile} resource create ${1}-nfs_unblock ocf:heartbeat:portblock protocol=tcp \
14f8ab
+        portno=2049 action=unblock ip=${ipaddr} reset_local_on_unblock_stop=true \
14f8ab
+        tickle_dir=${HA_VOL_MNT}/nfs-ganesha/tickle_dir/ --group ${1}-group --after ${1}-cluster_ip-1 \
14f8ab
+        op stop timeout=${PORTBLOCK_UNBLOCK_TIMEOUT} op start timeout=${PORTBLOCK_UNBLOCK_TIMEOUT} \
14f8ab
+        op monitor interval=10s timeout=${PORTBLOCK_UNBLOCK_TIMEOUT}
14f8ab
+        if [ $? -ne 0 ]; then
14f8ab
+            logger "warning pcs resource create ${1}-nfs_unblock failed"
14f8ab
+        fi
14f8ab
+
14f8ab
+
14f8ab
+        shift
14f8ab
+    done
14f8ab
+
14f8ab
+    create_virt_ip_constraints ${cibfile} ${HA_SERVERS}
14f8ab
+
14f8ab
+    pcs cluster cib-push ${cibfile}
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+        logger "warning pcs cluster cib-push ${cibfile} failed"
14f8ab
+    fi
14f8ab
+    rm -f ${cibfile}
14f8ab
+}
14f8ab
+
14f8ab
+
14f8ab
+teardown_resources()
14f8ab
+{
14f8ab
+    # local mntpt=$(grep ha-vol-mnt ${HA_CONFIG_FILE} | cut -d = -f 2)
14f8ab
+
14f8ab
+    # restore /var/lib/nfs
14f8ab
+    logger "notice: pcs resource delete nfs_setup-clone"
14f8ab
+    pcs resource delete nfs_setup-clone
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+        logger "warning: pcs resource delete nfs_setup-clone failed"
14f8ab
+    fi
14f8ab
+
14f8ab
+    # delete -clone resource agents
14f8ab
+    # in particular delete the ganesha monitor so we don't try to
14f8ab
+    # trigger anything when we shut down ganesha next.
14f8ab
+    pcs resource delete nfs-mon-clone
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+        logger "warning: pcs resource delete nfs-mon-clone failed"
14f8ab
+    fi
14f8ab
+
14f8ab
+    pcs resource delete nfs-grace-clone
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+        logger "warning: pcs resource delete nfs-grace-clone failed"
14f8ab
+    fi
14f8ab
+
14f8ab
+    while [[ ${1} ]]; do
14f8ab
+        pcs resource delete ${1}-group
14f8ab
+        if [ $? -ne 0 ]; then
14f8ab
+            logger "warning: pcs resource delete ${1}-group failed"
14f8ab
+        fi
14f8ab
+        shift
14f8ab
+    done
14f8ab
+
14f8ab
+}
14f8ab
+
14f8ab
+
14f8ab
+recreate_resources()
14f8ab
+{
14f8ab
+    local cibfile=${1}; shift
14f8ab
+
14f8ab
+    while [[ ${1} ]]; do
14f8ab
+        # this is variable indirection
14f8ab
+        # see the comment on the same a few lines up
14f8ab
+        name="VIP_${1}"
14f8ab
+        clean_name=${name//[-.]/_}
14f8ab
+        nvs=$(grep "^${name}=" ${HA_CONFDIR}/ganesha-ha.conf)
14f8ab
+        clean_nvs=${nvs//[-.]/_}
14f8ab
+        eval ${clean_nvs}
14f8ab
+        eval tmp_ipaddr=\$${clean_name}
14f8ab
+        ipaddr=${tmp_ipaddr//_/.}
14f8ab
+
14f8ab
+        pcs -f ${cibfile} resource create ${1}-nfs_block ocf:heartbeat:portblock protocol=tcp \
14f8ab
+        portno=2049 action=block ip=${ipaddr} --group ${1}-group
14f8ab
+        if [ $? -ne 0 ]; then
14f8ab
+            logger "warning pcs resource create ${1}-nfs_block failed"
14f8ab
+        fi
14f8ab
+        pcs -f ${cibfile} resource create ${1}-cluster_ip-1 ocf:heartbeat:IPaddr ip=${ipaddr} \
14f8ab
+        cidr_netmask=32 op monitor interval=15s --group ${1}-group --after ${1}-nfs_block
14f8ab
+        if [ $? -ne 0 ]; then
14f8ab
+            logger "warning pcs resource create ${1}-cluster_ip-1 ocf:heartbeat:IPaddr ip=${ipaddr} \
14f8ab
+            cidr_netmask=32 op monitor interval=15s failed"
14f8ab
+        fi
14f8ab
+
14f8ab
+        pcs -f ${cibfile} constraint order nfs-grace-clone then ${1}-cluster_ip-1
14f8ab
+        if [ $? -ne 0 ]; then
14f8ab
+            logger "warning: pcs constraint order nfs-grace-clone then ${1}-cluster_ip-1 failed"
14f8ab
+        fi
14f8ab
+
14f8ab
+        pcs -f ${cibfile} resource create ${1}-nfs_unblock ocf:heartbeat:portblock protocol=tcp \
14f8ab
+        portno=2049 action=unblock ip=${ipaddr} reset_local_on_unblock_stop=true \
14f8ab
+        tickle_dir=${HA_VOL_MNT}/nfs-ganesha/tickle_dir/ --group ${1}-group --after ${1}-cluster_ip-1 \
14f8ab
+        op stop timeout=${PORTBLOCK_UNBLOCK_TIMEOUT} op start timeout=${PORTBLOCK_UNBLOCK_TIMEOUT} \
14f8ab
+        op monitor interval=10s timeout=${PORTBLOCK_UNBLOCK_TIMEOUT}
14f8ab
+        if [ $? -ne 0 ]; then
14f8ab
+            logger "warning pcs resource create ${1}-nfs_unblock failed"
14f8ab
+        fi
14f8ab
+
14f8ab
+        shift
14f8ab
+    done
14f8ab
+}
14f8ab
+
14f8ab
+
14f8ab
+addnode_recreate_resources()
14f8ab
+{
14f8ab
+    local cibfile=${1}; shift
14f8ab
+    local add_node=${1}; shift
14f8ab
+    local add_vip=${1}; shift
14f8ab
+
14f8ab
+    recreate_resources ${cibfile} ${HA_SERVERS}
14f8ab
+
14f8ab
+    pcs -f ${cibfile} resource create ${add_node}-nfs_block ocf:heartbeat:portblock \
14f8ab
+    protocol=tcp portno=2049 action=block ip=${add_vip} --group ${add_node}-group
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+        logger "warning pcs resource create ${add_node}-nfs_block failed"
14f8ab
+    fi
14f8ab
+    pcs -f ${cibfile} resource create ${add_node}-cluster_ip-1 ocf:heartbeat:IPaddr \
14f8ab
+    ip=${add_vip} cidr_netmask=32 op monitor interval=15s --group ${add_node}-group \
14f8ab
+    --after ${add_node}-nfs_block
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+        logger "warning pcs resource create ${add_node}-cluster_ip-1 ocf:heartbeat:IPaddr \
14f8ab
+	ip=${add_vip} cidr_netmask=32 op monitor interval=15s failed"
14f8ab
+    fi
14f8ab
+
14f8ab
+    pcs -f ${cibfile} constraint order nfs-grace-clone then ${add_node}-cluster_ip-1
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+        logger "warning: pcs constraint order nfs-grace-clone then ${add_node}-cluster_ip-1 failed"
14f8ab
+    fi
14f8ab
+    pcs -f ${cibfile} resource create ${add_node}-nfs_unblock ocf:heartbeat:portblock \
14f8ab
+    protocol=tcp portno=2049 action=unblock ip=${add_vip} reset_local_on_unblock_stop=true \
14f8ab
+    tickle_dir=${HA_VOL_MNT}/nfs-ganesha/tickle_dir/ --group ${add_node}-group --after \
14f8ab
+    ${add_node}-cluster_ip-1 op stop timeout=${PORTBLOCK_UNBLOCK_TIMEOUT} op start \
14f8ab
+    timeout=${PORTBLOCK_UNBLOCK_TIMEOUT} op monitor interval=10s \
14f8ab
+    timeout=${PORTBLOCK_UNBLOCK_TIMEOUT}
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+        logger "warning pcs resource create ${add_node}-nfs_unblock failed"
14f8ab
+    fi
14f8ab
+}
14f8ab
+
14f8ab
+
14f8ab
+clear_resources()
14f8ab
+{
14f8ab
+    local cibfile=${1}; shift
14f8ab
+
14f8ab
+    while [[ ${1} ]]; do
14f8ab
+        pcs -f ${cibfile} resource delete ${1}-group
14f8ab
+        if [ $? -ne 0 ]; then
14f8ab
+            logger "warning: pcs -f ${cibfile} resource delete ${1}-group"
14f8ab
+        fi
14f8ab
+
14f8ab
+        shift
14f8ab
+    done
14f8ab
+}
14f8ab
+
14f8ab
+
14f8ab
+addnode_create_resources()
14f8ab
+{
14f8ab
+    local add_node=${1}; shift
14f8ab
+    local add_vip=${1}; shift
14f8ab
+    local cibfile=$(mktemp -u)
14f8ab
+
14f8ab
+    # start HA on the new node
14f8ab
+    pcs cluster start ${add_node}
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+       logger "warning: pcs cluster start ${add_node} failed"
14f8ab
+    fi
14f8ab
+
14f8ab
+    pcs cluster cib ${cibfile}
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+        logger "warning: pcs cluster cib ${cibfile} failed"
14f8ab
+    fi
14f8ab
+
14f8ab
+    # delete all the -cluster_ip-1 resources, clearing
14f8ab
+    # their constraints, then create them again so we can
14f8ab
+    # recompute their constraints
14f8ab
+    clear_resources ${cibfile} ${HA_SERVERS}
14f8ab
+    addnode_recreate_resources ${cibfile} ${add_node} ${add_vip}
14f8ab
+
14f8ab
+    HA_SERVERS="${HA_SERVERS} ${add_node}"
14f8ab
+    create_virt_ip_constraints ${cibfile} ${HA_SERVERS}
14f8ab
+
14f8ab
+    pcs cluster cib-push ${cibfile}
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+        logger "warning: pcs cluster cib-push ${cibfile} failed"
14f8ab
+    fi
14f8ab
+    rm -f ${cibfile}
14f8ab
+}
14f8ab
+
14f8ab
+
14f8ab
+deletenode_delete_resources()
14f8ab
+{
14f8ab
+    local node=${1}; shift
14f8ab
+    local ha_servers=$(echo "${HA_SERVERS}" | sed s/${node}//)
14f8ab
+    local cibfile=$(mktemp -u)
14f8ab
+
14f8ab
+    pcs cluster cib ${cibfile}
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+        logger "warning: pcs cluster cib ${cibfile} failed"
14f8ab
+    fi
14f8ab
+
14f8ab
+    # delete all the -cluster_ip-1 and -trigger_ip-1 resources,
14f8ab
+    # clearing their constraints, then create them again so we can
14f8ab
+    # recompute their constraints
14f8ab
+    clear_resources ${cibfile} ${HA_SERVERS}
14f8ab
+    recreate_resources ${cibfile} ${ha_servers}
14f8ab
+    HA_SERVERS=$(echo "${ha_servers}" | sed -e "s/  / /")
14f8ab
+
14f8ab
+    create_virt_ip_constraints ${cibfile} ${HA_SERVERS}
14f8ab
+
14f8ab
+    pcs cluster cib-push ${cibfile}
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+        logger "warning: pcs cluster cib-push ${cibfile} failed"
14f8ab
+    fi
14f8ab
+    rm -f ${cibfile}
14f8ab
+
14f8ab
+}
14f8ab
+
14f8ab
+
14f8ab
+deletenode_update_haconfig()
14f8ab
+{
14f8ab
+    local name="VIP_${1}"
14f8ab
+    local clean_name=${name//[-.]/_}
14f8ab
+
14f8ab
+    ha_servers=$(echo ${HA_SERVERS} | sed -e "s/ /,/")
14f8ab
+    sed -i -e "s/^HA_CLUSTER_NODES=.*$/HA_CLUSTER_NODES=\"${ha_servers// /,}\"/" -e "s/^${name}=.*$//" -e "/^$/d" ${HA_CONFDIR}/ganesha-ha.conf
14f8ab
+}
14f8ab
+
14f8ab
+
14f8ab
+setup_state_volume()
14f8ab
+{
14f8ab
+    local mnt=${HA_VOL_MNT}
14f8ab
+    local longname=""
14f8ab
+    local shortname=""
14f8ab
+    local dname=""
14f8ab
+    local dirname=""
14f8ab
+
14f8ab
+    longname=$(hostname)
14f8ab
+    dname=${longname#$(hostname -s)}
14f8ab
+
14f8ab
+    while [[ ${1} ]]; do
14f8ab
+
14f8ab
+        if [[ ${1} == *${dname} ]]; then
14f8ab
+            dirname=${1}
14f8ab
+        else
14f8ab
+            dirname=${1}${dname}
14f8ab
+        fi
14f8ab
+
14f8ab
+        if [ ! -d ${mnt}/nfs-ganesha/tickle_dir ]; then
14f8ab
+            mkdir ${mnt}/nfs-ganesha/tickle_dir
14f8ab
+        fi
14f8ab
+        if [ ! -d ${mnt}/nfs-ganesha/${dirname} ]; then
14f8ab
+            mkdir ${mnt}/nfs-ganesha/${dirname}
14f8ab
+        fi
14f8ab
+        if [ ! -d ${mnt}/nfs-ganesha/${dirname}/nfs ]; then
14f8ab
+            mkdir ${mnt}/nfs-ganesha/${dirname}/nfs
14f8ab
+        fi
14f8ab
+        if [ ! -d ${mnt}/nfs-ganesha/${dirname}/nfs/ganesha ]; then
14f8ab
+            mkdir ${mnt}/nfs-ganesha/${dirname}/nfs/ganesha
14f8ab
+        fi
14f8ab
+        if [ ! -d ${mnt}/nfs-ganesha/${dirname}/nfs/statd ]; then
14f8ab
+            mkdir ${mnt}/nfs-ganesha/${dirname}/nfs/statd
14f8ab
+        fi
14f8ab
+        if [ ! -e ${mnt}/nfs-ganesha/${dirname}/nfs/state ]; then
14f8ab
+            touch ${mnt}/nfs-ganesha/${dirname}/nfs/state
14f8ab
+        fi
14f8ab
+        if [ ! -d ${mnt}/nfs-ganesha/${dirname}/nfs/ganesha/v4recov ]; then
14f8ab
+            mkdir ${mnt}/nfs-ganesha/${dirname}/nfs/ganesha/v4recov
14f8ab
+        fi
14f8ab
+        if [ ! -d ${mnt}/nfs-ganesha/${dirname}/nfs/ganesha/v4old ]; then
14f8ab
+            mkdir ${mnt}/nfs-ganesha/${dirname}/nfs/ganesha/v4old
14f8ab
+        fi
14f8ab
+        if [ ! -d ${mnt}/nfs-ganesha/${dirname}/nfs/statd/sm ]; then
14f8ab
+            mkdir ${mnt}/nfs-ganesha/${dirname}/nfs/statd/sm
14f8ab
+        fi
14f8ab
+        if [ ! -d ${mnt}/nfs-ganesha/${dirname}/nfs/statd/sm.bak ]; then
14f8ab
+            mkdir ${mnt}/nfs-ganesha/${dirname}/nfs/statd/sm.bak
14f8ab
+        fi
14f8ab
+        if [ ! -e ${mnt}/nfs-ganesha/${dirname}/nfs/statd/state ]; then
14f8ab
+            touch ${mnt}/nfs-ganesha/${dirname}/nfs/statd/state
14f8ab
+        fi
14f8ab
+        for server in ${HA_SERVERS} ; do
14f8ab
+            if [ ${server} != ${dirname} ]; then
14f8ab
+                ln -s ${mnt}/nfs-ganesha/${server}/nfs/ganesha ${mnt}/nfs-ganesha/${dirname}/nfs/ganesha/${server}
14f8ab
+                ln -s ${mnt}/nfs-ganesha/${server}/nfs/statd ${mnt}/nfs-ganesha/${dirname}/nfs/statd/${server}
14f8ab
+            fi
14f8ab
+        done
14f8ab
+        shift
14f8ab
+    done
14f8ab
+
14f8ab
+}
14f8ab
+
14f8ab
+
14f8ab
+addnode_state_volume()
14f8ab
+{
14f8ab
+    local newnode=${1}; shift
14f8ab
+    local mnt=${HA_VOL_MNT}
14f8ab
+    local longname=""
14f8ab
+    local dname=""
14f8ab
+    local dirname=""
14f8ab
+
14f8ab
+    longname=$(hostname)
14f8ab
+    dname=${longname#$(hostname -s)}
14f8ab
+
14f8ab
+    if [[ ${newnode} == *${dname} ]]; then
14f8ab
+        dirname=${newnode}
14f8ab
+    else
14f8ab
+        dirname=${newnode}${dname}
14f8ab
+    fi
14f8ab
+
14f8ab
+    if [ ! -d ${mnt}/nfs-ganesha/${dirname} ]; then
14f8ab
+        mkdir ${mnt}/nfs-ganesha/${dirname}
14f8ab
+    fi
14f8ab
+    if [ ! -d ${mnt}/nfs-ganesha/${dirname}/nfs ]; then
14f8ab
+        mkdir ${mnt}/nfs-ganesha/${dirname}/nfs
14f8ab
+    fi
14f8ab
+    if [ ! -d ${mnt}/nfs-ganesha/${dirname}/nfs/ganesha ]; then
14f8ab
+        mkdir ${mnt}/nfs-ganesha/${dirname}/nfs/ganesha
14f8ab
+    fi
14f8ab
+    if [ ! -d ${mnt}/nfs-ganesha/${dirname}/nfs/statd ]; then
14f8ab
+        mkdir ${mnt}/nfs-ganesha/${dirname}/nfs/statd
14f8ab
+    fi
14f8ab
+    if [ ! -e ${mnt}/nfs-ganesha/${dirname}/nfs/state ]; then
14f8ab
+        touch ${mnt}/nfs-ganesha/${dirname}/nfs/state
14f8ab
+    fi
14f8ab
+    if [ ! -d ${mnt}/nfs-ganesha/${dirname}/nfs/ganesha/v4recov ]; then
14f8ab
+        mkdir ${mnt}/nfs-ganesha/${dirname}/nfs/ganesha/v4recov
14f8ab
+    fi
14f8ab
+    if [ ! -d ${mnt}/nfs-ganesha/${dirname}/nfs/ganesha/v4old ]; then
14f8ab
+        mkdir ${mnt}/nfs-ganesha/${dirname}/nfs/ganesha/v4old
14f8ab
+    fi
14f8ab
+    if [ ! -d ${mnt}/nfs-ganesha/${dirname}/nfs/statd/sm ]; then
14f8ab
+        mkdir ${mnt}/nfs-ganesha/${dirname}/nfs/statd/sm
14f8ab
+    fi
14f8ab
+    if [ ! -d ${mnt}/nfs-ganesha/${dirname}/nfs/statd/sm.bak ]; then
14f8ab
+        mkdir ${mnt}/nfs-ganesha/${dirname}/nfs/statd/sm.bak
14f8ab
+    fi
14f8ab
+    if [ ! -e ${mnt}/nfs-ganesha/${dirname}/nfs/statd/state ]; then
14f8ab
+        touch ${mnt}/nfs-ganesha/${dirname}/nfs/statd/state
14f8ab
+    fi
14f8ab
+
14f8ab
+    for server in ${HA_SERVERS} ; do
14f8ab
+
14f8ab
+        if [[ ${server} != ${dirname} ]]; then
14f8ab
+            ln -s ${mnt}/nfs-ganesha/${server}/nfs/ganesha ${mnt}/nfs-ganesha/${dirname}/nfs/ganesha/${server}
14f8ab
+            ln -s ${mnt}/nfs-ganesha/${server}/nfs/statd ${mnt}/nfs-ganesha/${dirname}/nfs/statd/${server}
14f8ab
+
14f8ab
+            ln -s ${mnt}/nfs-ganesha/${dirname}/nfs/ganesha ${mnt}/nfs-ganesha/${server}/nfs/ganesha/${dirname}
14f8ab
+            ln -s ${mnt}/nfs-ganesha/${dirname}/nfs/statd ${mnt}/nfs-ganesha/${server}/nfs/statd/${dirname}
14f8ab
+        fi
14f8ab
+    done
14f8ab
+
14f8ab
+}
14f8ab
+
14f8ab
+
14f8ab
+delnode_state_volume()
14f8ab
+{
14f8ab
+    local delnode=${1}; shift
14f8ab
+    local mnt=${HA_VOL_MNT}
14f8ab
+    local longname=""
14f8ab
+    local dname=""
14f8ab
+    local dirname=""
14f8ab
+
14f8ab
+    longname=$(hostname)
14f8ab
+    dname=${longname#$(hostname -s)}
14f8ab
+
14f8ab
+    if [[ ${delnode} == *${dname} ]]; then
14f8ab
+        dirname=${delnode}
14f8ab
+    else
14f8ab
+        dirname=${delnode}${dname}
14f8ab
+    fi
14f8ab
+
14f8ab
+    rm -rf ${mnt}/nfs-ganesha/${dirname}
14f8ab
+
14f8ab
+    for server in ${HA_SERVERS} ; do
14f8ab
+        if [[ "${server}" != "${dirname}" ]]; then
14f8ab
+            rm -f ${mnt}/nfs-ganesha/${server}/nfs/ganesha/${dirname}
14f8ab
+            rm -f ${mnt}/nfs-ganesha/${server}/nfs/statd/${dirname}
14f8ab
+        fi
14f8ab
+    done
14f8ab
+}
14f8ab
+
14f8ab
+
14f8ab
+status()
14f8ab
+{
14f8ab
+    local scratch=$(mktemp)
14f8ab
+    local regex_str="^${1}-cluster_ip-1"
14f8ab
+    local healthy=0
14f8ab
+    local index=1
14f8ab
+    local nodes
14f8ab
+
14f8ab
+    # change tabs to spaces, strip leading spaces
14f8ab
+    pcs status | sed -e "s/\t/ /g" -e "s/^[ ]*//" > ${scratch}
14f8ab
+
14f8ab
+    nodes[0]=${1}; shift
14f8ab
+
14f8ab
+    # make a regex of the configured nodes
14f8ab
+    # and initalize the nodes array for later
14f8ab
+    while [[ ${1} ]]; do
14f8ab
+
14f8ab
+        regex_str="${regex_str}|^${1}-cluster_ip-1"
14f8ab
+        nodes[${index}]=${1}
14f8ab
+        ((index++))
14f8ab
+        shift
14f8ab
+    done
14f8ab
+
14f8ab
+    # print the nodes that are expected to be online
14f8ab
+    grep -E "^Online:" ${scratch}
14f8ab
+
14f8ab
+    echo
14f8ab
+
14f8ab
+    # print the VIPs and which node they are on
14f8ab
+    grep -E "${regex_str}" < ${scratch} | cut -d ' ' -f 1,4
14f8ab
+
14f8ab
+    echo
14f8ab
+
14f8ab
+    # check if the VIP and port block/unblock RAs are on the expected nodes
14f8ab
+    for n in ${nodes[*]}; do
14f8ab
+
14f8ab
+        grep -E -x "${n}-nfs_block \(ocf::heartbeat:portblock\): Started ${n}" > /dev/null 2>&1 ${scratch}
14f8ab
+        result=$?
14f8ab
+        ((healthy+=${result}))
14f8ab
+        grep -E -x "${n}-cluster_ip-1 \(ocf::heartbeat:IPaddr\): Started ${n}" > /dev/null 2>&1 ${scratch}
14f8ab
+        result=$?
14f8ab
+        ((healthy+=${result}))
14f8ab
+        grep -E -x "${n}-nfs_unblock \(ocf::heartbeat:portblock\): Started ${n}" > /dev/null 2>&1 ${scratch}
14f8ab
+        result=$?
14f8ab
+        ((healthy+=${result}))
14f8ab
+    done
14f8ab
+
14f8ab
+    grep -E "\):\ Stopped|FAILED" > /dev/null 2>&1 ${scratch}
14f8ab
+    result=$?
14f8ab
+
14f8ab
+    if [ ${result} -eq 0 ]; then
14f8ab
+        echo "Cluster HA Status: BAD"
14f8ab
+    elif [ ${healthy} -eq 0 ]; then
14f8ab
+        echo "Cluster HA Status: HEALTHY"
14f8ab
+    else
14f8ab
+        echo "Cluster HA Status: FAILOVER"
14f8ab
+    fi
14f8ab
+
14f8ab
+    rm -f ${scratch}
14f8ab
+}
14f8ab
+
14f8ab
+create_ganesha_conf_file()
14f8ab
+{
14f8ab
+        if [ $1 == "yes" ];
14f8ab
+        then
14f8ab
+                if [  -e $GANESHA_CONF ];
14f8ab
+                then
14f8ab
+                        rm -rf $GANESHA_CONF
14f8ab
+                fi
14f8ab
+        # The symlink /etc/ganesha/ganesha.conf need to be
14f8ab
+        # created using ganesha conf file mentioned in the
14f8ab
+        # shared storage. Every node will only have this
14f8ab
+        # link and actual file will stored in shared storage,
14f8ab
+        # so that ganesha conf editing of ganesha conf will
14f8ab
+        # be easy as well as it become more consistent.
14f8ab
+
14f8ab
+                ln -s $HA_CONFDIR/ganesha.conf $GANESHA_CONF
14f8ab
+        else
14f8ab
+        # Restoring previous file
14f8ab
+                rm -rf $GANESHA_CONF
14f8ab
+                cp $HA_CONFDIR/ganesha.conf $GANESHA_CONF
14f8ab
+                sed -r -i -e '/^%include[[:space:]]+".+\.conf"$/d' $GANESHA_CONF
14f8ab
+        fi
14f8ab
+}
14f8ab
+
14f8ab
+set_quorum_policy()
14f8ab
+{
14f8ab
+    local quorum_policy="stop"
14f8ab
+    local num_servers=${1}
14f8ab
+
14f8ab
+    if [ ${num_servers} -lt 3 ]; then
14f8ab
+        quorum_policy="ignore"
14f8ab
+    fi
14f8ab
+    pcs property set no-quorum-policy=${quorum_policy}
14f8ab
+    if [ $? -ne 0 ]; then
14f8ab
+        logger "warning: pcs property set no-quorum-policy=${quorum_policy} failed"
14f8ab
+    fi
14f8ab
+}
14f8ab
+
14f8ab
+main()
14f8ab
+{
14f8ab
+
14f8ab
+    local cmd=${1}; shift
14f8ab
+    if [[ ${cmd} == *help ]]; then
14f8ab
+        usage
14f8ab
+        exit 0
14f8ab
+    fi
14f8ab
+    HA_CONFDIR=${1%/}; shift
14f8ab
+    local ha_conf=${HA_CONFDIR}/ganesha-ha.conf
14f8ab
+    local node=""
14f8ab
+    local vip=""
14f8ab
+
14f8ab
+    # ignore any comment lines
14f8ab
+    cfgline=$(grep  ^HA_NAME= ${ha_conf})
14f8ab
+    eval $(echo ${cfgline} | grep -F HA_NAME=)
14f8ab
+    cfgline=$(grep  ^HA_CLUSTER_NODES= ${ha_conf})
14f8ab
+    eval $(echo ${cfgline} | grep -F HA_CLUSTER_NODES=)
14f8ab
+
14f8ab
+    case "${cmd}" in
14f8ab
+
14f8ab
+    setup | --setup)
14f8ab
+        logger "setting up ${HA_NAME}"
14f8ab
+
14f8ab
+        check_cluster_exists ${HA_NAME}
14f8ab
+
14f8ab
+        determine_servers "setup"
14f8ab
+
14f8ab
+        if [ "X${HA_NUM_SERVERS}X" != "X1X" ]; then
14f8ab
+
14f8ab
+            setup_cluster ${HA_NAME} ${HA_NUM_SERVERS} "${HA_SERVERS}"
14f8ab
+
14f8ab
+            setup_create_resources ${HA_SERVERS}
14f8ab
+
14f8ab
+            setup_finalize_ha
14f8ab
+
14f8ab
+            setup_state_volume ${HA_SERVERS}
14f8ab
+
14f8ab
+        else
14f8ab
+
14f8ab
+            logger "insufficient servers for HA, aborting"
14f8ab
+        fi
14f8ab
+        ;;
14f8ab
+
14f8ab
+    teardown | --teardown)
14f8ab
+        logger "tearing down ${HA_NAME}"
14f8ab
+
14f8ab
+        determine_servers "teardown"
14f8ab
+
14f8ab
+        teardown_resources ${HA_SERVERS}
14f8ab
+
14f8ab
+        teardown_cluster ${HA_NAME}
14f8ab
+
14f8ab
+        cleanup_ganesha_config ${HA_CONFDIR}
14f8ab
+        ;;
14f8ab
+
14f8ab
+    cleanup | --cleanup)
14f8ab
+        cleanup_ganesha_config ${HA_CONFDIR}
14f8ab
+        ;;
14f8ab
+
14f8ab
+    add | --add)
14f8ab
+        node=${1}; shift
14f8ab
+        vip=${1}; shift
14f8ab
+
14f8ab
+        logger "adding ${node} with ${vip} to ${HA_NAME}"
14f8ab
+
14f8ab
+        determine_service_manager
14f8ab
+
14f8ab
+        manage_service "start" ${node}
14f8ab
+
14f8ab
+        determine_servers "add"
14f8ab
+
14f8ab
+        pcs cluster node add ${node}
14f8ab
+        if [ $? -ne 0 ]; then
14f8ab
+            logger "warning: pcs cluster node add ${node} failed"
14f8ab
+        fi
14f8ab
+
14f8ab
+        addnode_create_resources ${node} ${vip}
14f8ab
+        # Subsequent add-node recreates resources for all the nodes
14f8ab
+        # that already exist in the cluster. The nodes are picked up
14f8ab
+        # from the entries in the ganesha-ha.conf file. Adding the
14f8ab
+        # newly added node to the file so that the resources specfic
14f8ab
+        # to this node is correctly recreated in the future.
14f8ab
+        clean_node=${node//[-.]/_}
14f8ab
+        echo "VIP_${node}=\"${vip}\"" >> ${HA_CONFDIR}/ganesha-ha.conf
14f8ab
+
14f8ab
+        NEW_NODES="$HA_CLUSTER_NODES,${node}"
14f8ab
+
14f8ab
+        sed -i s/HA_CLUSTER_NODES.*/"HA_CLUSTER_NODES=\"$NEW_NODES\""/ \
14f8ab
+$HA_CONFDIR/ganesha-ha.conf
14f8ab
+
14f8ab
+        addnode_state_volume ${node}
14f8ab
+
14f8ab
+        # addnode_create_resources() already appended ${node} to
14f8ab
+        # HA_SERVERS, so only need to increment HA_NUM_SERVERS
14f8ab
+        # and set quorum policy
14f8ab
+        HA_NUM_SERVERS=$(expr ${HA_NUM_SERVERS} + 1)
14f8ab
+        set_quorum_policy ${HA_NUM_SERVERS}
14f8ab
+        ;;
14f8ab
+
14f8ab
+    delete | --delete)
14f8ab
+        node=${1}; shift
14f8ab
+
14f8ab
+        logger "deleting ${node} from ${HA_NAME}"
14f8ab
+
14f8ab
+        determine_servers "delete"
14f8ab
+
14f8ab
+        deletenode_delete_resources ${node}
14f8ab
+
14f8ab
+        pcs cluster node remove ${node}
14f8ab
+        if [ $? -ne 0 ]; then
14f8ab
+            logger "warning: pcs cluster node remove ${node} failed"
14f8ab
+        fi
14f8ab
+
14f8ab
+        deletenode_update_haconfig ${node}
14f8ab
+
14f8ab
+        delnode_state_volume ${node}
14f8ab
+
14f8ab
+        determine_service_manager
14f8ab
+
14f8ab
+        manage_service "stop" ${node}
14f8ab
+
14f8ab
+        HA_NUM_SERVERS=$(expr ${HA_NUM_SERVERS} - 1)
14f8ab
+        set_quorum_policy ${HA_NUM_SERVERS}
14f8ab
+        ;;
14f8ab
+
14f8ab
+    status | --status)
14f8ab
+        determine_servers "status"
14f8ab
+
14f8ab
+        status ${HA_SERVERS}
14f8ab
+        ;;
14f8ab
+
14f8ab
+    refresh-config | --refresh-config)
14f8ab
+        VOL=${1}
14f8ab
+
14f8ab
+        determine_servers "refresh-config"
14f8ab
+
14f8ab
+        refresh_config ${VOL} ${HA_CONFDIR} ${HA_SERVERS}
14f8ab
+        ;;
14f8ab
+
14f8ab
+    setup-ganesha-conf-files | --setup-ganesha-conf-files)
14f8ab
+
14f8ab
+        create_ganesha_conf_file ${1}
14f8ab
+        ;;
14f8ab
+
14f8ab
+    *)
14f8ab
+        # setup and teardown are not intended to be used by a
14f8ab
+        # casual user
14f8ab
+        usage
14f8ab
+        logger "Usage: ganesha-ha.sh add|delete|status"
14f8ab
+        ;;
14f8ab
+
14f8ab
+    esac
14f8ab
+}
14f8ab
+
14f8ab
+main $*
14f8ab
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
14f8ab
index dd7438c..d748ebc 100644
14f8ab
--- a/glusterfs.spec.in
14f8ab
+++ b/glusterfs.spec.in
14f8ab
@@ -460,7 +460,8 @@ Summary:          NFS-Ganesha configuration
14f8ab
 Group:            Applications/File
14f8ab
 
14f8ab
 Requires:         %{name}-server%{?_isa} = %{version}-%{release}
14f8ab
-Requires:         nfs-ganesha-gluster, pcs, dbus
14f8ab
+Requires:         nfs-ganesha-gluster >= 2.4.1
14f8ab
+Requires:         pcs, dbus
14f8ab
 %if ( 0%{?rhel} && 0%{?rhel} == 6 )
14f8ab
 Requires:         cman, pacemaker, corosync
14f8ab
 %endif
14f8ab
@@ -1138,6 +1139,7 @@ exit 0
14f8ab
 #exclude ganesha related files
14f8ab
 %exclude %{_sysconfdir}/ganesha/*
14f8ab
 %exclude %{_libexecdir}/ganesha/*
14f8ab
+%exclude %{_prefix}/lib/ocf/resource.d/heartbeat/*
14f8ab
 %endif
14f8ab
 
14f8ab
 %files api
14f8ab
@@ -1306,6 +1308,7 @@ exit 0
14f8ab
 %files ganesha
14f8ab
 %{_sysconfdir}/ganesha/*
14f8ab
 %{_libexecdir}/ganesha/*
14f8ab
+%{_prefix}/lib/ocf/resource.d/heartbeat/*
14f8ab
 %endif
14f8ab
 
14f8ab
 %if ( 0%{!?_without_ocf:1} )
14f8ab
@@ -1904,6 +1907,9 @@ fi
14f8ab
 %endif
14f8ab
 
14f8ab
 %changelog
14f8ab
+* Sat Apr 6 2019 Jiffin Tony Thottan <jthottan@redhat.com>
14f8ab
+- Adding ganesha ha resources back in gluster repository
14f8ab
+
14f8ab
 * Fri Apr 5 2019 Jiffin Tony Thottan <jthottan@redhat.com>
14f8ab
 - Adding ganesha bits back in gluster repository
14f8ab
 
14f8ab
-- 
14f8ab
1.8.3.1
14f8ab