2 # event script to integrate with gpfs cnfs
8 STATEDIR=$CTDB_BASE/state/gpfs
10 # filesystems needed by nfs
11 NFS_FSS=`cat /etc/exports | egrep -v "^#" | sed -e "s/[ \t]*[^ \t]*$//"`
17 FS=`(cd $STATEDIR/fs ; ls )`
19 MISSING=`echo $FS | sed -e "s/@/\//g"`
20 logger Filesystems required for NFS are missing. Node is UNHEALTHY. [$MISSING]
21 $CTDB_BASE/events.d/62.cnfs unhealthy "GPFS filesystems required for NFS are not mounted : [$MISSING]"
25 logger All required GPFS resources are available. CNFS part is healthy.
26 $CTDB_BASE/events.d/62.cnfs healthy
36 # This event is called from the GPFS callbacks when a filesystem is
39 # is this a filesystem we need for nfs?
40 echo "$NFS_FSS" | egrep "^$2" >/dev/null || {
45 logger "GPFS unmounted filesystem $2 used by NFS. Mark node as UNHEALTHY"
47 MFS=`echo $2 | sed -e "s/\//@/g"`
49 touch "$STATEDIR/fs/$MFS"
50 $CTDB_BASE/events.d/62.cnfs unhealthy "GPFS unmounted filesystem $2 used by NFS"
53 # This event is called from the GPFS callbacks when a filesystem is
56 # is this a filesystem we need for nfs?
57 echo "$NFS_FSS" | egrep "^$2" >/dev/null || {
62 logger "GPFS mounted filesystem $2 used by NFS."
64 MFS=`echo $2 | sed -e "s/\//@/g"`
66 rm -f "$STATEDIR/fs/$MFS"
73 # This event is called from the gpfs callback when GPFS is being shutdown.
75 logger "GPFS is shutting down. Marking node as UNHEALTHY and trigger a CTDB failover"
76 $CTDB_BASE/events.d/62.cnfs unhealthy "GPFS was shut down!"
80 # This event is called from the gpfs callback when GPFS has started.
81 # It checks that all required NFS filesystems are mounted
82 # and flags the node healthy if so.
84 logger "GPFS is is started."
93 # Mark the node as UNHEALTHY which means all public addresses
94 # will be migrated off the node.
96 TMPFILE=/tmp/ctdb.cnfs.$$
98 ctdb_setstatus unhealthy $TMPFILE
101 # force a monitor event so we pick up immediately that this script
102 # will now fail and make the node unhealthy.
103 ctdb eventscript monitor
105 # Wait until we no longer serve any ip addresses at all
106 PNN=`ctdb pnn | cut -d: -f2`
107 while `ctdb -Y ip | cut -d: -f3 | egrep "^$PNN$" >/dev/null`; do
113 # mark the node as healthy
114 ctdb_setstatus healthy
124 ctdb_standard_event_handler "$@"