2 # event script to integrate with gpfs cnfs
8 STATEDIR=$CTDB_BASE/state/gpfs
11 # filesystems needed by nfs
12 NFS_FSS=`cat /etc/exports | egrep -v "^#" | sed -e "s/[ \t]*[^ \t]*$//" -e "s/\"//g"`
18 FS=`(cd $STATEDIR/fs ; ls )`
20 MISSING=`echo $FS | sed -e "s/@/\//g"`
21 logger Filesystems required for NFS are missing. Node is UNHEALTHY. [$MISSING]
22 $CTDB_BASE/events.d/62.cnfs unhealthy "GPFS filesystems required for NFS are not mounted : [$MISSING]"
26 logger All required GPFS resources are available. CNFS part is healthy.
27 $CTDB_BASE/events.d/62.cnfs healthy
37 # This event is called from the GPFS callbacks when a filesystem is
40 # is this a filesystem we need for nfs?
41 echo "$NFS_FSS" | egrep "^$2" >/dev/null || {
46 logger "GPFS unmounted filesystem $2 used by NFS. Mark node as UNHEALTHY"
48 MFS=`echo $2 | sed -e "s/\//@/g"`
50 touch "$STATEDIR/fs/$MFS"
51 $CTDB_BASE/events.d/62.cnfs unhealthy "GPFS unmounted filesystem $2 used by NFS"
54 # This event is called from the GPFS callbacks when a filesystem is
57 # is this a filesystem we need for nfs?
58 echo "$NFS_FSS" | egrep "^$2" >/dev/null || {
63 logger "GPFS mounted filesystem $2 used by NFS."
65 MFS=`echo $2 | sed -e "s/\//@/g"`
67 rm -f "$STATEDIR/fs/$MFS"
74 # This event is called from the gpfs callback when GPFS is being shutdown.
76 logger "GPFS is shutting down. Marking node as UNHEALTHY and trigger a CTDB failover"
77 $CTDB_BASE/events.d/62.cnfs unhealthy "GPFS was shut down!"
81 # This event is called from the gpfs callback when GPFS has started.
82 # It checks that all required NFS filesystems are mounted
83 # and flags the node healthy if so.
85 logger "GPFS is is started."
94 # Mark the node as UNHEALTHY which means all public addresses
95 # will be migrated off the node.
97 TMPFILE=/tmp/ctdb.cnfs.$$
99 ctdb_setstatus unhealthy $TMPFILE
102 # force a monitor event so we pick up immediately that this script
103 # will now fail and make the node unhealthy.
104 ctdb eventscript monitor
106 # Wait until we no longer serve any ip addresses at all
107 PNN=`ctdb pnn | cut -d: -f2`
108 while `ctdb -Y ip | cut -d: -f3 | egrep "^$PNN$" >/dev/null`; do
114 # mark the node as healthy
115 ctdb_setstatus healthy
125 ctdb_standard_event_handler "$@"