File 0001-exportfs-Add-pseudo-resource-factor-bsc-978680.patch of Package resource-agents.2497
commit 372a6931eef9f9725166d96e314b2e2f5312fd1e
Author: Michal Koutný <mkoutny@suse.com>
Date: Fri Jun 3 16:48:02 2016 +0200
exportfs: Add pseudo resource factor (bsc#978680)
exportfs resource relies on output from exportfs utility which in turn
stores its state data in /var/lib/nfs/etab. This file survives reboot
(e.g. after fencing) and when probe monitor operation is invoked
exportfs RA will report resource as *started* if there are respective
records in /var/lib/nfs/etab despite the fact nfsserver resource is
not started and exportfs resource is thus effectively *stopped*.
Normally this is not a problem because nfsserver clears content of
/var/lib/nfs/etab upon start, however, when only monitor operations are
executed (e.g. probing after reboot) wrong state of exportfs resource is
reported.
This solution puts alleged status of the resource in logical conjunction
with pseudo resource state (i.e. it's not pure pseudo resource, just
necessary condition). The idea is from Dejan Muhamedagic
<dmuhamedagic@suse.com>.
Note: pseudo resource state is kept in $HA_RSCTMP directory, which is
supposed to be empty after reboot.
diff --git a/heartbeat/exportfs b/heartbeat/exportfs
index 4b88fa1..bf4191e 100755
--- a/heartbeat/exportfs
+++ b/heartbeat/exportfs
@@ -266,6 +266,10 @@ is_exported() {
exportfs_monitor ()
{
+ if ! ha_pseudo_resource "${OCF_RESOURCE_INSTANCE}" monitor; then
+ return $OCF_NOT_RUNNING
+ fi
+
if forall is_exported "${OCF_RESKEY_clientspec}"; then
if [ ${OCF_RESKEY_rmtab_backup} != "none" ]; then
forall backup_rmtab
@@ -311,6 +315,8 @@ exportfs_start ()
return $OCF_SUCCESS
fi
ocf_log info "Exporting file system(s) ..."
+
+ ha_pseudo_resource "${OCF_RESOURCE_INSTANCE}" start
forall export_one
# Restore the rmtab to ensure smooth NFS-over-TCP failover
@@ -391,6 +397,8 @@ exportfs_stop ()
if [ $rc -eq 0 ]; then
cleanup_export_cache
+ ha_pseudo_resource "${OCF_RESOURCE_INSTANCE}" stop
+
ocf_log info "Un-exported file system(s)"
return $OCF_SUCCESS
else