ctdb-scripts: Remove old NFS checking code
authorMartin Schwenke <martin@meltin.net>
Fri, 19 Jun 2015 06:54:33 +0000 (16:54 +1000)
committerAmitay Isaacs <amitay@samba.org>
Tue, 14 Jul 2015 07:57:18 +0000 (09:57 +0200)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/config/functions
ctdb/config/nfs-rpc-checks.d/10.statd.check [deleted file]
ctdb/config/nfs-rpc-checks.d/20.nfsd.check [deleted file]
ctdb/config/nfs-rpc-checks.d/30.lockd.check [deleted file]
ctdb/config/nfs-rpc-checks.d/40.mountd.check [deleted file]
ctdb/config/nfs-rpc-checks.d/50.rquotad.check [deleted file]
ctdb/tests/eventscripts/etc-ctdb/nfs-rpc-checks.d [deleted symlink]

index 4290bfa841ff5fde50fa415e33101cdd22c38ce5..1b79585daa60169933db6817ff18d56974aa7495 100755 (executable)
@@ -258,216 +258,6 @@ program_stack_traces ()
     done
 }
 
-######################################################
-# Check that an RPC service is healthy -
-# this includes allowing a certain number of failures
-# before marking the NFS service unhealthy.
-#
-# usage: nfs_check_rpc_service SERVICE_NAME [ triple ...]
-#
-# each triple is a set of 3 arguments: an operator, a 
-# fail count limit and an action string.
-#
-# For example:
-#
-#      nfs_check_rpc_service "lockd" \
-#          -ge 15 "verbose restart unhealthy" \
-#          -eq 10 "restart:bs"
-#
-# says that if lockd is down for 15 iterations then do
-# a verbose restart of lockd and mark the node unhealthy.
-# Before this, after 10 iterations of failure, the
-# service is restarted silently in the background.
-# Order is important: the number of failures need to be
-# specified in reverse order because processing stops
-# after the first condition that is true.
-######################################################
-nfs_check_rpc_service ()
-{
-    _prog_name="$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 $_prog_name contains '@' then the bit after it is the
-       # address family.
-       _family="${_prog_name#*@}"
-       if [ "$_family" = "$_prog_name" ] ; then
-           _family=""
-       else
-           _prog_name="${_prog_name%@*}"
-       fi
-
-       if _nfs_check_rpc_common "$_prog_name" "$_family" ; 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"
-    _family="$2"
-
-    # Some platforms don't have separate programs for all services.
-    case "$_prog_name" in
-       statd)
-           type "rpc.${_prog_name}" >/dev/null 2>&1 || return 0
-    esac
-
-    case "$_prog_name" in
-       nfsd)
-           _rpc_prog=nfs
-           _version=3
-           ;;
-       mountd)
-           _rpc_prog=mountd
-           _version=1
-           ;;
-       rquotad)
-           _rpc_prog=rquotad
-           _version=1
-           ;;
-       lockd)
-           _rpc_prog=nlockmgr
-           _version=4
-           ;;
-       statd)
-           _rpc_prog=status
-           _version=1
-           ;;
-       *)
-           echo "Internal error: unknown RPC program \"$_prog_name\"."
-           exit 1
-    esac
-
-    _service_name="nfs_${_prog_name}${_family:+_}${_family}"
-
-    if ctdb_check_rpc "$_rpc_prog" "$_version" "$_family" >/dev/null ; then
-       ctdb_counter_init "$_service_name"
-       return 0
-    fi
-
-    ctdb_counter_incr "$_service_name"
-
-    return 1
-}
-
-_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 "ERROR: $ctdb_check_rpc_out"
-               ;;
-           restart)
-               _nfs_restart_rpc_service "$_prog_name"
-               ;;
-           restart:b)
-               _nfs_restart_rpc_service "$_prog_name" true
-               ;;
-           unhealthy)
-               exit 1
-               ;;
-           *)
-               echo "Internal error: unknown action \"$_action\"."
-               exit 1
-       esac
-    done
-
-    return 0
-}
-
-_nfs_restart_rpc_service ()
-{
-    _prog_name="$1"
-    _background="${2:-false}"
-
-    if $_background ; then
-       _maybe_background="background_with_logging"
-    else
-       _maybe_background=""
-    fi
-
-    _p="rpc.${_prog_name}"
-
-    case "$_prog_name" in
-       nfsd)
-           echo "Trying to restart NFS service"
-           $_maybe_background startstop_nfs restart
-           ;;
-       mountd)
-           echo "Trying to restart $_prog_name [${_p}]"
-           killall -q -9 "$_p"
-           nfs_dump_some_threads "$_p"
-           $_maybe_background $_p $RPCMOUNTDOPTS \
-                              ${MOUNTD_PORT:+-p} $MOUNTD_PORT
-           ;;
-       rquotad)
-           echo "Trying to restart $_prog_name [${_p}]"
-           killall -q -9 "$_p"
-           nfs_dump_some_threads "$_p"
-           $_maybe_background $_p ${RQUOTAD_PORT:+-p} $RQUOTAD_PORT
-           ;;
-       lockd)
-           echo "Trying to restart lock manager service"
-           $_maybe_background startstop_nfslock restart
-           ;;
-       statd)
-           echo "Trying to restart $_prog_name [${_p}]"
-           killall -q -9 "$_p"
-           nfs_dump_some_threads "$_p"
-           $_maybe_background $_p \
-               ${STATD_HOSTNAME:+-n} $STATD_HOSTNAME \
-               ${STATD_PORT:+-p} $STATD_PORT \
-               ${STATD_OUTGOING_PORT:+-o} $STATD_OUTGOING_PORT
-           ;;
-       *)
-           echo "Internal error: unknown RPC program \"$_prog_name\"."
-           exit 1
-    esac
-}
-
 ######################################################
 # Check the health of NFS services
 #
diff --git a/ctdb/config/nfs-rpc-checks.d/10.statd.check b/ctdb/config/nfs-rpc-checks.d/10.statd.check
deleted file mode 100644 (file)
index fd7a864..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
--ge 6 verbose restart:b unhealthy
-%   2 verbose restart:b
diff --git a/ctdb/config/nfs-rpc-checks.d/20.nfsd.check b/ctdb/config/nfs-rpc-checks.d/20.nfsd.check
deleted file mode 100644 (file)
index aa4a2e7..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-%   10 verbose restart:b unhealthy
--ge  2 verbose unhealthy
diff --git a/ctdb/config/nfs-rpc-checks.d/30.lockd.check b/ctdb/config/nfs-rpc-checks.d/30.lockd.check
deleted file mode 100644 (file)
index fd7a864..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
--ge 6 verbose restart:b unhealthy
-%   2 verbose restart:b
diff --git a/ctdb/config/nfs-rpc-checks.d/40.mountd.check b/ctdb/config/nfs-rpc-checks.d/40.mountd.check
deleted file mode 100644 (file)
index fd7a864..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
--ge 6 verbose restart:b unhealthy
-%   2 verbose restart:b
diff --git a/ctdb/config/nfs-rpc-checks.d/50.rquotad.check b/ctdb/config/nfs-rpc-checks.d/50.rquotad.check
deleted file mode 100644 (file)
index fd7a864..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
--ge 6 verbose restart:b unhealthy
-%   2 verbose restart:b
diff --git a/ctdb/tests/eventscripts/etc-ctdb/nfs-rpc-checks.d b/ctdb/tests/eventscripts/etc-ctdb/nfs-rpc-checks.d
deleted file mode 120000 (symlink)
index 991b966..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../config/nfs-rpc-checks.d
\ No newline at end of file