ctdb-scripts: Add default filesystem usage warnings
[Samba.git] / ctdb / config / events.d / 62.cnfs
blob339eaef3cb00400b1e50b29ffb0688497c1ce822
1 #!/bin/sh
2 # event script to integrate with gpfs cnfs
4 [ -n "$CTDB_BASE" ] || \
5 export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
7 . $CTDB_BASE/functions
9 loadconfig
11 ctdb_setup_service_state_dir "gpfs"
13 check_if_healthy() {
14 mkdir -p "$service_state_dir/fs"
16 [ -f "$service_state_dir/gpfsnoquorum" ] && {
17 logger No GPFS quorum. Node is UNHEALTHY
18 $CTDB_BASE/events.d/62.cnfs unhealthy "No GPFS quorum. Nodfe is UNHEALTHY."
19 exit 0
22 logger All required GPFS resources are available. CNFS part is healthy.
23 $CTDB_BASE/events.d/62.cnfs healthy
26 case "$1" in
27 startup)
28 check_if_healthy
32 gpfsquorumreached)
33 rm -f "$service_state_dir/gpfsnoquorum"
34 logger "GPFS quorum has been reached."
35 check_if_healthy
38 gpfsquorumloss)
39 touch "$service_state_dir/gpfsnoquorum"
40 logger "GPFS quorum has been lost."
41 $CTDB_BASE/events.d/62.cnfs unhealthy "GPFS quorum was lost! Marking node as UNHEALTHY."
44 unhealthy)
45 # Mark the node as UNHEALTHY which means all public addresses
46 # will be migrated off the node.
47 shift
48 echo "$*" | ctdb_setstatus unhealthy -
50 # force a monitor event so we pick up immediately that this script
51 # will now fail and make the node unhealthy.
52 ctdb eventscript monitor
54 # Wait until we no longer serve any ip addresses at all
55 ctdb_get_pnn
56 while ctdb -X ip | grep -q "^|.*|${pnn}|\$" ; do
57 sleep 1
58 done
61 healthy)
62 # mark the node as healthy
63 ctdb_setstatus healthy
67 monitor)
68 ctdb_checkstatus
69 exit $?
73 ctdb_standard_event_handler "$@"
75 esac
77 exit 0