mkdir -p $(DESTDIR)$(includedir)
mkdir -p $(DESTDIR)$(etcdir)/ctdb
mkdir -p $(DESTDIR)$(etcdir)/ctdb/events.d
+ mkdir -p $(DESTDIR)$(etcdir)/ctdb/nfs-rpc-checks.d
mkdir -p $(DESTDIR)$(docdir)/ctdb
${INSTALLCMD} -m 644 ctdb.pc $(DESTDIR)$(libdir)/pkgconfig
${INSTALLCMD} -m 755 bin/ctdb $(DESTDIR)$(bindir)
${INSTALLCMD} -m 755 config/events.d/62.cnfs $(DESTDIR)$(etcdir)/ctdb/events.d
${INSTALLCMD} -m 755 config/events.d/70.iscsi $(DESTDIR)$(etcdir)/ctdb/events.d
${INSTALLCMD} -m 755 config/events.d/91.lvs $(DESTDIR)$(etcdir)/ctdb/events.d
+ ${INSTALLCMD} -m 644 config/nfs-rpc-checks.d/10.statd.check $(DESTDIR)$(etcdir)/ctdb/nfs-rpc-checks.d/
+ ${INSTALLCMD} -m 644 config/nfs-rpc-checks.d/20.nfsd.check $(DESTDIR)$(etcdir)/ctdb/nfs-rpc-checks.d/
+ ${INSTALLCMD} -m 644 config/nfs-rpc-checks.d/30.lockd.check $(DESTDIR)$(etcdir)/ctdb/nfs-rpc-checks.d/
+ ${INSTALLCMD} -m 644 config/nfs-rpc-checks.d/40.mountd.check $(DESTDIR)$(etcdir)/ctdb/nfs-rpc-checks.d/
+ ${INSTALLCMD} -m 644 config/nfs-rpc-checks.d/50.rquotad.check $(DESTDIR)$(etcdir)/ctdb/nfs-rpc-checks.d/
${INSTALLCMD} -m 755 tools/ctdb_diagnostics $(DESTDIR)$(bindir)
${INSTALLCMD} -m 755 tools/onnode $(DESTDIR)$(bindir)
if [ -f doc/ctdb.1 ];then ${INSTALLCMD} -d $(DESTDIR)$(mandir)/man1; fi
update_tickles 2049
- # check that statd responds to rpc requests
- nfs_check_rpc_service "statd" \
- -ge 6 "verbose unhealthy" \
- -eq 4 "verbose restart" \
- -eq 2 "restart:bs"
-
- # check that NFS responds to rpc requests
- if [ "$CTDB_NFS_SKIP_KNFSD_ALIVE_CHECK" != "yes" ] ; then
- nfs_check_rpc_service "knfsd" \
- -ge 6 "verbose unhealthy" \
- -eq 4 "verbose restart" \
- -eq 2 "restart:bs"
- fi
-
- # check that lockd responds to rpc requests
- nfs_check_rpc_service "lockd" \
- -ge 15 "verbose restart:b unhealthy" \
- -eq 10 "restart:bs"
-
- # mountd is sometimes not started correctly on RHEL5
- nfs_check_rpc_service "mountd" \
- -ge 10 "verbose restart:b unhealthy" \
- -eq 5 "restart:b"
-
- # rquotad is sometimes not started correctly on RHEL5
- # not a critical service so we dont flag the node as unhealthy
- nfs_check_rpc_service "rquotad" \
- -gt 0 "verbose restart:b"
+ nfs_check_rpc_services
# once every 600 seconds, update the statd state database for which
# clients need notifications
--- /dev/null
+-ge 6 verbose unhealthy
+-eq 4 verbose restart
+-eq 2 restart:bs
--- /dev/null
+-ge 6 verbose unhealthy
+-eq 4 verbose restart
+-eq 2 restart:bs
--- /dev/null
+-ge 15 verbose restart:b unhealthy
+-eq 10 restart:bs
--- /dev/null
+-ge 10 verbose restart:b unhealthy
+-eq 5 restart:b
--- /dev/null
+-gt 0 verbose restart:b
%{_sysconfdir}/ctdb/events.d/62.cnfs
%{_sysconfdir}/ctdb/events.d/70.iscsi
%{_sysconfdir}/ctdb/events.d/91.lvs
+%config(noreplace) %{_sysconfdir}/ctdb/nfs-rpc-checks.d/10.statd.check
+%config(noreplace) %{_sysconfdir}/ctdb/nfs-rpc-checks.d/20.nfsd.check
+%config(noreplace) %{_sysconfdir}/ctdb/nfs-rpc-checks.d/30.lockd.check
+%config(noreplace) %{_sysconfdir}/ctdb/nfs-rpc-checks.d/40.mountd.check
+%config(noreplace) %{_sysconfdir}/ctdb/nfs-rpc-checks.d/50.rquotad.check
%{_sysconfdir}/ctdb/statd-callout
%{_sbindir}/ctdbd
%{_bindir}/ctdb
done
# Some of the unit tests have relative symlinks back to in-tree bits
# and pieces. These links will be broken!
-for i in "events.d" "functions" ; do
+for i in "events.d" "functions" "nfs-rpc-checks.d" ; do
ln -sf "${etcdir}/ctdb/${i}" "${ctdb_datadir}/eventscripts/etc-ctdb/${i}"
done
# test_wrap needs to set TEST_BIN_DIR
+++ /dev/null
-#!/bin/sh
-
-. "${TEST_SCRIPTS_DIR}/unit.sh"
-
-define_test "get RPC service fail limits/actions"
-
-setup_nfs
-
-set -e
-
-rm -f "$rpc_fail_limits_file"
-CTDB_RC_LOCAL="$CTDB_BASE/rc.local.nfs.monitor.get-limits" \
- "${CTDB_BASE}/events.d/60.nfs" "monitor" >"$rpc_fail_limits_file"
-
-services="knfsd|mountd|rquotad|lockd|statd"
-
-echo "Doing rough check of file format..."
-
-! grep -v -E "^(${services}) " "$rpc_fail_limits_file"
rpc_services_down "nfs"
iterate_test 6 'ok_null' \
- 2 'rpc_set_service_failure_response "knfsd"' \
- 4 'rpc_set_service_failure_response "knfsd"' \
- 6 'rpc_set_service_failure_response "knfsd"'
+ 2 'rpc_set_service_failure_response "nfsd"' \
+ 4 'rpc_set_service_failure_response "nfsd"' \
+ 6 'rpc_set_service_failure_response "nfsd"'
--- /dev/null
+../../../config/nfs-rpc-checks.d
\ No newline at end of file
+++ /dev/null
-# Hey Emacs, this is a -*- shell-script -*- !!! :-)
-
-# This scripts nobble the 60.nfs monitor event so that it prints out
-# the service fail limits for each RPC service.
-
-CTDB_INIT_STYLE="redhat"
-PATH="${EVENTSCRIPTS_PATH}:$PATH"
-
-service () { : ; }
-
-update_tickles () { : ; }
-
-ctdb_setup_service_state_dir "nfs"
-
-CTDB_NFS_SKIP_KNFSD_ALIVE_CHECK="no"
-CTDB_NFS_SKIP_SHARE_CHECK="yes"
-
-# Ugly but necessary - if this file was touched less then 60 seconds
-# ago then this skips some code.
-touch "$service_state_dir/update-trigger"
-
-nfs_check_rpc_service ()
-{
- echo "$*"
-}
export FAKE_RPCINFO_SERVICES=""
export CTDB_NFS_SKIP_SHARE_CHECK="no"
- export CTDB_NFS_SKIP_KNFSD_ALIVE_CHECK="no"
# Reset the failcounts for nfs services.
eventscript_call eval rm -f '$ctdb_fail_dir/nfs_*'
- rpc_fail_limits_file="${EVENTSCRIPTS_TESTS_VAR_DIR}/rpc_fail_limits"
-
- # Force this file to exist so tests can be individually run.
- if [ ! -f "$rpc_fail_limits_file" ] ; then
- # This is gross... but is needed to fake through the nfs monitor event.
- eventscript_call ctdb_service_managed
- service "nfs" force-started # might not be enough
- CTDB_RC_LOCAL="$CTDB_BASE/rc.local.nfs.monitor.get-limits" \
- CTDB_MANAGES_NFS="yes" \
- "${CTDB_BASE}/events.d/60.nfs" "monitor" >"$rpc_fail_limits_file"
- fi
-
if [ "$1" != "down" ] ; then
debug "Setting up NFS environment: all RPC services up, NFS managed by CTDB"
# Default
ok_null
- _ts=$(sed -n -e "s@^${_progname} @@p" "$rpc_fail_limits_file")
-
- while [ -n "$_ts" ] ; do
- # Get the triple: operator, fail limit and actions.
- _op="${_ts%% *}" ; _ts="${_ts#* }"
- _li="${_ts%% *}" ; _ts="${_ts#* }"
- # We've lost some of the quoting but we can simulate
- # because we know an operator is always the first in a
- # triple.
- _actions=""
- while [ -n "$_ts" ] ; do
- # If this is an operator then we've got all of the
- # actions.
- case "$_ts" in
- -*) break ;;
- esac
-
- _actions="${_actions}${_actions:+ }${_ts%% *}"
- # Special case for end of list.
- if [ "$_ts" != "${_ts#* }" ] ; then
- _ts="${_ts#* }"
- else
- _ts=""
- fi
- done
+ _file=$(ls "${CTDB_BASE}/nfs-rpc-checks.d/"[0-9][0-9]."${_progname}.check")
+ [ -r "$_file" ] || die "RPC check file \"$_file\" does not exist or is not unique"
+
+ while read _op _li _actions ; do
+ # Skip comments
+ case "$_op" in
+ \#*) continue ;;
+ esac
if [ "$_numfails" "$_op" "$_li" ] ; then
_out=""
_ver=1
_pn="$_progname"
case "$_progname" in
- knfsd) _ver=3 ; _pn="nfs" ;;
+ nfsd) _ver=3 ; _pn="nfs" ;;
lockd) _ver=4 ; _pn="nlockmgr" ;;
statd) _pn="status" ;;
esac
;;
esac
case "${_progname}${_action#restart}" in
- knfsd)
+ nfsd)
_t="\
Trying to restart NFS service
Starting nfslock: OK
Starting nfs: OK"
;;
- knfsd:bs)
+ nfsd:bs)
_t="Trying to restart NFS service"
;;
lockd|lockd:b)
required_result $_rc "$_out"
return
fi
- done
+ done <"$_file"
}
######################################################################