[SCM] CTDB repository - branch master updated - ctdb-2.1-135-g0eb351f

Amitay Isaacs amitay at samba.org
Mon May 6 23:48:48 MDT 2013


The branch, master has been updated
       via  0eb351ff4c7ee096de7c5e0a59561067091fa32e (commit)
       via  7e792d6768d9ca420ce3713cb122e63afd594b15 (commit)
       via  d9775fcbd6e30eef8382bea68e2f9bad2309f2c1 (commit)
       via  9bc8fbee6550ed2814fb35c70d57fab21ef1b8fd (commit)
       via  5a717fd495ba5a2bfd481d69f38b68fa4576716f (commit)
       via  cc3bb42e48bbdabd19187c231846b98589b4f4f3 (commit)
       via  887733dd7be53158bfe07b30ef31b611d0f8122f (commit)
       via  77302dbfd85754e02559eccb2dd6c090db0b6b9f (commit)
       via  15b0f78cbf8d6ba481b7eba9e4fe3f4270214c72 (commit)
       via  4b4e7d8f0e8dcbab987e374d06ffaa21c06da0d3 (commit)
      from  a8ef00608e48a551a334aded206146807aeb4c5a (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 0eb351ff4c7ee096de7c5e0a59561067091fa32e
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 23 12:30:33 2013 +1000

    eventscripts: NFS RPC checks no longer support "knfsd"
    
    No longer used, support removed from test infrastructure.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 7e792d6768d9ca420ce3713cb122e63afd594b15
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 23 12:17:31 2013 +1000

    eventscripts: 60.nfs uses nfs_check_rpc_services() to check NFS RPC services
    
    * New directory nfs-rpc-checks.d/ replaces hardcoded rules in 60.nfs
    
    * Installation and packaging additions to handle nfs-rpc-checks.d/
    
    * Unit test updates, including deleting 1 test that sanity checked
      test infrastructure
    
    * Test infrastructure changes to use nfs-rpc-checks.d/
    
    Note that this removes support for $CTDB_NFS_SKIP_KNFSD_ALIVE_CHECK in
    60.nfs.  To get the equivalent behaviour, edit 20.nfsd.check and
    remove/comment all lines.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit d9775fcbd6e30eef8382bea68e2f9bad2309f2c1
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 23 11:14:48 2013 +1000

    eventscripts: NFS RPC checks allows "nfsd" in addition to "knfsd"
    
    Want nfs_check_rpc_services() to support filenames without the 'k'.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 9bc8fbee6550ed2814fb35c70d57fab21ef1b8fd
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 23 06:42:54 2013 +1000

    eventscripts: New function nfs_check_rpc_services()
    
    This is intended to replace nfs_check_rpc_service(), which builds
    configuration into eventscripts.
    
    nfs_check_rpc_services() uses a directory of configuration checks that
    can be edited by an administrator.  The files have one limit check and
    a set of actions per line.  The program name is extracted from the
    file name.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 5a717fd495ba5a2bfd481d69f38b68fa4576716f
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 23 06:28:27 2013 +1000

    eventscripts: nfs_check_rpc_action() should be _nfs_check_rpc_action()
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit cc3bb42e48bbdabd19187c231846b98589b4f4f3
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 23 06:27:02 2013 +1000

    eventscripts: Factor out common code from nfs_check_rpc_service()
    
    This creates new function _nfs_check_rpc_common().
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 887733dd7be53158bfe07b30ef31b611d0f8122f
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 23 06:17:15 2013 +1000

    eventscripts: Remove ganesha support from nfs_check_rpc_service()
    
    This is unused so doesn't need to be maintained.  An attempt to use it
    now will explicitly fail rather than implicitly fail via bitrot.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 77302dbfd85754e02559eccb2dd6c090db0b6b9f
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 23 06:14:43 2013 +1000

    Revert "Eventscript functions: add optional version to nfs_check_rpc_service()"
    
    This reverts commit 92f74fd589467b46c758e116e97417edfe8773d7.
    
    This change is unused and is just complicating the function.
    
    Conflicts:
    	config/functions

commit 15b0f78cbf8d6ba481b7eba9e4fe3f4270214c72
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 23 05:54:12 2013 +1000

    eventscripts: Move rpc.statd existence check into nfs_check_rpc_service ()
    
    The code in 60.nfs is going to be genericised, so make all the checks
    look the same.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 4b4e7d8f0e8dcbab987e374d06ffaa21c06da0d3
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Apr 22 15:45:13 2013 +1000

    eventscripts: Factor NFS RPC check action code into nfs_check_rpc_action()
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

-----------------------------------------------------------------------

Summary of changes:
 Makefile.in                                        |    6 +
 config/events.d/60.nfs                             |   35 +----
 config/functions                                   |  172 +++++++++++++-------
 config/nfs-rpc-checks.d/10.statd.check             |    3 +
 config/nfs-rpc-checks.d/20.nfsd.check              |    3 +
 config/nfs-rpc-checks.d/30.lockd.check             |    2 +
 config/nfs-rpc-checks.d/40.mountd.check            |    2 +
 config/nfs-rpc-checks.d/50.rquotad.check           |    1 +
 packaging/RPM/ctdb.spec.in                         |    5 +
 tests/INSTALL                                      |    2 +-
 tests/eventscripts/60.nfs.monitor.100.sh           |   19 ---
 tests/eventscripts/60.nfs.monitor.112.sh           |    6 +-
 tests/eventscripts/etc-ctdb/nfs-rpc-checks.d       |    1 +
 .../etc-ctdb/rc.local.nfs.monitor.get-limits       |   25 ---
 tests/eventscripts/scripts/local.sh                |   54 ++-----
 15 files changed, 149 insertions(+), 187 deletions(-)
 create mode 100644 config/nfs-rpc-checks.d/10.statd.check
 create mode 100644 config/nfs-rpc-checks.d/20.nfsd.check
 create mode 100644 config/nfs-rpc-checks.d/30.lockd.check
 create mode 100644 config/nfs-rpc-checks.d/40.mountd.check
 create mode 100644 config/nfs-rpc-checks.d/50.rquotad.check
 delete mode 100755 tests/eventscripts/60.nfs.monitor.100.sh
 create mode 120000 tests/eventscripts/etc-ctdb/nfs-rpc-checks.d
 delete mode 100755 tests/eventscripts/etc-ctdb/rc.local.nfs.monitor.get-limits


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index 87a3bd3..7ffc3dc 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -317,6 +317,7 @@ install: all manpages $(PMDA_INSTALL)
 	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)
@@ -355,6 +356,11 @@ install: all manpages $(PMDA_INSTALL)
 	${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
diff --git a/config/events.d/60.nfs b/config/events.d/60.nfs
index 2cba9a7..46456bc 100755
--- a/config/events.d/60.nfs
+++ b/config/events.d/60.nfs
@@ -77,40 +77,7 @@ case "$1" in
 
 	update_tickles 2049
 
-	# check that statd responds to rpc requests
-	# if statd is not running we try to restart it
-	# we only do this IF we have a rpc.statd command.
-	# For platforms where rpc.statd does not exist, we skip
-	# the check completely
-        p="rpc.statd"
-        which $p >/dev/null 2>/dev/null && \
-	    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
diff --git a/config/functions b/config/functions
index 3572a00..4f31d84 100755
--- a/config/functions
+++ b/config/functions
@@ -223,29 +223,68 @@ nfs_check_rpc_service ()
 {
     _prog_name="$1" ; shift
 
-    _v=""
-    case "$1" in
-	-*) : ;;
-	*) _v="$1" ; shift ;;
+    if _nfs_check_rpc_common "$_prog_name" ; then
+	return
+    fi
+
+    while [ -n "$3" ] ; do
+	if _nfs_check_rpc_action "$1" "$2" "$3" ; then
+	    break
+	fi
+	shift 3
+    done
+}
+
+# The new way of doing things...
+nfs_check_rpc_services ()
+{
+    # Files must end with .check - avoids editor backups, RPM fu, ...
+    for _f in "${CTDB_BASE}/nfs-rpc-checks.d/"[0-9][0-9].*.check ; do
+	_t="${_f%.check}"
+	_prog_name="${_t##*/[0-9][0-9].}"
+
+	if _nfs_check_rpc_common "$_prog_name" ; then
+	    # This RPC service is up, check next service...
+	    continue
+	fi
+
+	# Check each line in the file in turn until one of the limit
+	# checks is hit...
+	while read _cmp _lim _rest ; do
+	    # Skip comments
+	    case "$_cmp" in
+		\#*) continue ;;
+	    esac
+
+	    if _nfs_check_rpc_action "$_cmp" "$_lim" "$_rest" ; then
+		# Limit was hit on this line, no further checking...
+		break
+	    fi
+	done <"$_f"
+    done
+}
+
+_nfs_check_rpc_common ()
+{
+    _prog_name="$1"
+
+    # Some platforms don't have separate programs for all services.
+    case "$_prog_name" in
+	statd)
+	    which "rpc.${_prog_name}" >/dev/null 2>&1 || return 0
     esac
 
-    _version=${_v:-1}
+    _version=1
     _rpc_prog="$_prog_name"
     _restart=""
     _opts=""
     case "$_prog_name" in
-	knfsd)
+	nfsd)
 	    _rpc_prog=nfs
-	    _version=${_v:-3}
+	    _version=3
 	    _restart="echo 'Trying to restart NFS service'"
 	    _restart="${_restart}; startstop_nfs restart"
 	    ;;
-	ganesha)
-	    _rpc_prog=nfs
-	    _version=${_v:-3}
-	    _restart="echo 'Trying to restart Ganesha NFS service'"
-	    _restart="${_restart}; startstop_ganesha restart"
-	    ;;
 	mountd)
 	    _opts="${MOUNTD_PORT:+ -p }${MOUNTD_PORT}"
 	    ;;
@@ -254,7 +293,7 @@ nfs_check_rpc_service ()
 	    ;;
 	lockd)
 	    _rpc_prog=nlockmgr
-	    _version=${_v:-4}
+	    _version=4
 	    _restart="echo 'Trying to restart lock manager service'"
 	    _restart="${_restart}; startstop_nfslock restart"
 	    ;;
@@ -278,56 +317,63 @@ nfs_check_rpc_service ()
 
     ctdb_counter_incr "$_service_name"
 
-    while [ -n "$3" ] ; do
-	ctdb_check_counter "quiet" "$1" "$2" "$_service_name" || {
-	    for _action in $3 ; do
-		case "$_action" in
-		    verbose)
-			echo "$ctdb_check_rpc_out"
-			;;
-		    restart|restart:*)
-			# No explicit command specified, construct rpc command.
-			if [ -z "$_restart" ] ; then
-			    _p="rpc.${_prog_name}"
-			    _restart="echo 'Trying to restart $_prog_name [${_p}${_opts}]'"
-			    _restart="${_restart}; killall -q -9 $_p"
-			    _restart="${_restart}; $_p $_opts"
-			fi
-
-			# Process restart flags...
-			_flags="${_action#restart:}"
-			# There may not have been a colon...
-			[ "$_flags" != "$_action" ] || _flags=""
-			# q=quiet - everything to /dev/null
-			if [ "${_flags#*q}" != "$_flags" ] ; then
-			    _restart="{ ${_restart} ; } >/dev/null 2>&1"
-			fi
-			# s=stealthy - last command to /dev/null
-			if [ "${_flags#*s}" != "$_flags" ] ; then
-			    _restart="${_restart} >/dev/null 2>&1"
-			fi
-			# b=background - the whole thing, easy and reliable
-			if [ "${_flags#*b}" != "$_flags" ] ; then
-			    _restart="{ ${_restart} ; } &"
-			fi
-
-			# Do it!
-			eval "${_restart}"
-			;;
-		    unhealthy)
-			exit 1
-			;;
-		    *)
-			echo "Internal error: unknown action \"$_action\"."
-			exit 1
-		esac
-	    done
+    return 1
+}
 
-	    # Only process the first action group.
-	    break
-	}
-	shift 3
+_nfs_check_rpc_action ()
+{
+    _cmp="$1"
+    _limit="$2"
+    _actions="$3"
+
+    if ctdb_check_counter "quiet" "$_cmp" "$_limit" "$_service_name" ; then
+	return 1
+    fi
+
+    for _action in $_actions ; do
+	case "$_action" in
+	    verbose)
+		echo "$ctdb_check_rpc_out"
+		;;
+	    restart|restart:*)
+		# No explicit command specified, construct rpc command.
+		if [ -z "$_restart" ] ; then
+		    _p="rpc.${_prog_name}"
+		    _restart="echo 'Trying to restart $_prog_name [${_p}${_opts}]'"
+		    _restart="${_restart}; killall -q -9 $_p"
+		    _restart="${_restart}; $_p $_opts"
+		fi
+
+		# Process restart flags...
+		_flags="${_action#restart:}"
+		# There may not have been a colon...
+		[ "$_flags" != "$_action" ] || _flags=""
+		# q=quiet - everything to /dev/null
+		if [ "${_flags#*q}" != "$_flags" ] ; then
+		    _restart="{ ${_restart} ; } >/dev/null 2>&1"
+		fi
+		# s=stealthy - last command to /dev/null
+		if [ "${_flags#*s}" != "$_flags" ] ; then
+		    _restart="${_restart} >/dev/null 2>&1"
+		fi
+		# b=background - the whole thing, easy and reliable
+		if [ "${_flags#*b}" != "$_flags" ] ; then
+		    _restart="{ ${_restart} ; } &"
+		fi
+
+		# Do it!
+		eval "${_restart}"
+		;;
+	    unhealthy)
+		exit 1
+		;;
+	    *)
+		echo "Internal error: unknown action \"$_action\"."
+		exit 1
+	esac
     done
+
+    return 0
 }
 
 ######################################################
diff --git a/config/nfs-rpc-checks.d/10.statd.check b/config/nfs-rpc-checks.d/10.statd.check
new file mode 100644
index 0000000..dd5e15d
--- /dev/null
+++ b/config/nfs-rpc-checks.d/10.statd.check
@@ -0,0 +1,3 @@
+-ge 6 verbose unhealthy
+-eq 4 verbose restart
+-eq 2 restart:bs
diff --git a/config/nfs-rpc-checks.d/20.nfsd.check b/config/nfs-rpc-checks.d/20.nfsd.check
new file mode 100644
index 0000000..dd5e15d
--- /dev/null
+++ b/config/nfs-rpc-checks.d/20.nfsd.check
@@ -0,0 +1,3 @@
+-ge 6 verbose unhealthy
+-eq 4 verbose restart
+-eq 2 restart:bs
diff --git a/config/nfs-rpc-checks.d/30.lockd.check b/config/nfs-rpc-checks.d/30.lockd.check
new file mode 100644
index 0000000..4bda6c3
--- /dev/null
+++ b/config/nfs-rpc-checks.d/30.lockd.check
@@ -0,0 +1,2 @@
+-ge 15 verbose restart:b unhealthy
+-eq 10 restart:bs
diff --git a/config/nfs-rpc-checks.d/40.mountd.check b/config/nfs-rpc-checks.d/40.mountd.check
new file mode 100644
index 0000000..6b4f801
--- /dev/null
+++ b/config/nfs-rpc-checks.d/40.mountd.check
@@ -0,0 +1,2 @@
+-ge 10 verbose restart:b unhealthy
+-eq 5 restart:b
diff --git a/config/nfs-rpc-checks.d/50.rquotad.check b/config/nfs-rpc-checks.d/50.rquotad.check
new file mode 100644
index 0000000..1ebb828
--- /dev/null
+++ b/config/nfs-rpc-checks.d/50.rquotad.check
@@ -0,0 +1 @@
+-gt 0 verbose restart:b
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index cb86044..83261c5 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -156,6 +156,11 @@ rm -rf $RPM_BUILD_ROOT
 %{_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
diff --git a/tests/INSTALL b/tests/INSTALL
index 8c3f777..5581989 100755
--- a/tests/INSTALL
+++ b/tests/INSTALL
@@ -71,7 +71,7 @@ for d in $data_subdirs ; do
 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
diff --git a/tests/eventscripts/60.nfs.monitor.100.sh b/tests/eventscripts/60.nfs.monitor.100.sh
deleted file mode 100755
index e846d82..0000000
--- a/tests/eventscripts/60.nfs.monitor.100.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/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"
diff --git a/tests/eventscripts/60.nfs.monitor.112.sh b/tests/eventscripts/60.nfs.monitor.112.sh
index 666a38a..c5c39b2 100755
--- a/tests/eventscripts/60.nfs.monitor.112.sh
+++ b/tests/eventscripts/60.nfs.monitor.112.sh
@@ -10,6 +10,6 @@ setup_nfs
 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"'
diff --git a/tests/eventscripts/etc-ctdb/nfs-rpc-checks.d b/tests/eventscripts/etc-ctdb/nfs-rpc-checks.d
new file mode 120000
index 0000000..991b966
--- /dev/null
+++ b/tests/eventscripts/etc-ctdb/nfs-rpc-checks.d
@@ -0,0 +1 @@
+../../../config/nfs-rpc-checks.d
\ No newline at end of file
diff --git a/tests/eventscripts/etc-ctdb/rc.local.nfs.monitor.get-limits b/tests/eventscripts/etc-ctdb/rc.local.nfs.monitor.get-limits
deleted file mode 100755
index 96e4cff..0000000
--- a/tests/eventscripts/etc-ctdb/rc.local.nfs.monitor.get-limits
+++ /dev/null
@@ -1,25 +0,0 @@
-# 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 "$*"
-}
diff --git a/tests/eventscripts/scripts/local.sh b/tests/eventscripts/scripts/local.sh
index 5ce6b73..3f55830 100644
--- a/tests/eventscripts/scripts/local.sh
+++ b/tests/eventscripts/scripts/local.sh
@@ -554,23 +554,10 @@ setup_nfs ()
     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"
 
@@ -648,31 +635,14 @@ rpc_set_service_failure_response ()
     # 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=""
@@ -683,7 +653,7 @@ rpc_set_service_failure_response ()
 			_ver=1
 			_pn="$_progname"
 			case "$_progname" in
-			    knfsd) _ver=3 ; _pn="nfs" ;;
+			    nfsd) _ver=3 ; _pn="nfs" ;;
 			    lockd) _ver=4 ; _pn="nlockmgr" ;;


-- 
CTDB repository


More information about the samba-cvs mailing list