mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
ctdb-scripts: Remove 60.ganesha, replace with callout for 60.nfs
This isn't a straightforward move of code from 60.ganesha to the callout. Simplifications have been made to allow better interoperation with the new NFS checking logic. The following configuration variables have been removed: CTDB_GANESHA_REC_SUBDIR Edit NFS ganesha callout to change this location CTDB_NFS_SERVER_MODE, NFS_SERVER_MODE Use CTDB_NFS_CALLOUT instead CTDB_NFS_SKIP_KNFSD_ALIVE_CHECK, CTDB_SKIP_GANESHA_NFSD_CHECK Disable the corresponding .check file instead Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
713ec21750
commit
6586651508
@ -1,254 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# script to manage nfs in a clustered environment
|
|
||||||
|
|
||||||
[ -n "$CTDB_BASE" ] || \
|
|
||||||
export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
|
|
||||||
|
|
||||||
. $CTDB_BASE/functions
|
|
||||||
|
|
||||||
GANRECDIR="/var/lib/nfs/ganesha"
|
|
||||||
GANRECDIR2="/var/lib/nfs/ganesha/recevents"
|
|
||||||
GPFS_STATE="/usr/lpp/mmfs/bin/mmgetstate"
|
|
||||||
GANRECDIR3="/var/lib/nfs/ganesha_local"
|
|
||||||
|
|
||||||
|
|
||||||
service_start ()
|
|
||||||
{
|
|
||||||
startstop_ganesha stop
|
|
||||||
startstop_ganesha start
|
|
||||||
set_proc "sys/net/ipv4/tcp_tw_recycle" 1
|
|
||||||
}
|
|
||||||
|
|
||||||
service_stop ()
|
|
||||||
{
|
|
||||||
startstop_ganesha stop
|
|
||||||
}
|
|
||||||
|
|
||||||
service_reconfigure ()
|
|
||||||
{
|
|
||||||
# Restart lock manager, notify clients
|
|
||||||
if [ -x "${CTDB_BASE}/statd-callout" ] ; then
|
|
||||||
"${CTDB_BASE}/statd-callout" notify &
|
|
||||||
fi >/dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
loadconfig "nfs"
|
|
||||||
|
|
||||||
|
|
||||||
[ -n "$CTDB_CLUSTER_FILESYSTEM_TYPE" ] || CTDB_CLUSTER_FILESYSTEM_TYPE="gpfs"
|
|
||||||
|
|
||||||
service_name="nfs-ganesha-$CTDB_CLUSTER_FILESYSTEM_TYPE"
|
|
||||||
|
|
||||||
[ "${CTDB_NFS_SERVER_MODE:-${NFS_SERVER_MODE}}" = "ganesha" ] || exit 0
|
|
||||||
|
|
||||||
ctdb_setup_service_state_dir
|
|
||||||
|
|
||||||
ctdb_start_stop_service
|
|
||||||
|
|
||||||
is_ctdb_managed_service || exit 0
|
|
||||||
|
|
||||||
ctdb_service_check_reconfigure
|
|
||||||
|
|
||||||
nodenum_file="${service_state_dir}/gpfs_nodenum"
|
|
||||||
|
|
||||||
get_cluster_fs_state ()
|
|
||||||
{
|
|
||||||
case $CTDB_CLUSTER_FILESYSTEM_TYPE in
|
|
||||||
gpfs)
|
|
||||||
STATE=`$GPFS_STATE | awk 'NR <= 3 {next} {printf "%-6s", $3}'`
|
|
||||||
echo $STATE
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
die "File system $CTDB_CLUSTER_FILESYSTEM_TYPE not supported"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
create_nodenum_file()
|
|
||||||
{
|
|
||||||
NNUM=$(/usr/lpp/mmfs/bin/mmlsconfig myNodeConfigNumber | awk '{print $2}')
|
|
||||||
echo $NNUM > $nodenum_file
|
|
||||||
}
|
|
||||||
|
|
||||||
get_nodenum()
|
|
||||||
{
|
|
||||||
if [ ! -f $nodenum_file ]; then
|
|
||||||
create_nodenum_file
|
|
||||||
fi
|
|
||||||
cat $nodenum_file
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
create_ganesha_recdirs ()
|
|
||||||
{
|
|
||||||
[ -n "$CTDB_GANESHA_REC_SUBDIR" ] || CTDB_GANESHA_REC_SUBDIR=".ganesha"
|
|
||||||
|
|
||||||
_mounts=$(mount -t $CTDB_CLUSTER_FILESYSTEM_TYPE)
|
|
||||||
if [ -z "$_mounts" ]; then
|
|
||||||
echo "startup $CTDB_CLUSTER_FILESYSTEM_TYPE not ready"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
_mntpt=$(echo "$_mounts" | sort | awk 'NR == 1 {print $3}')
|
|
||||||
_link_dst="${_mntpt}/${CTDB_GANESHA_REC_SUBDIR}"
|
|
||||||
mkdir -vp "$_link_dst"
|
|
||||||
if [ -e "$GANRECDIR" ]; then
|
|
||||||
if [ ! -L "$GANRECDIR" ] ; then
|
|
||||||
rm -vrf "$GANRECDIR"
|
|
||||||
else
|
|
||||||
_t=$(readlink "$GANRECDIR")
|
|
||||||
if [ "$_t" != "$_link_dst" ] ; then
|
|
||||||
rm -v "$GANRECDIR"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
# This is not an "else". It also re-creates the link if it was
|
|
||||||
# removed above!
|
|
||||||
if [ ! -e "$GANRECDIR" ]; then
|
|
||||||
ln -sv "$_link_dst" "$GANRECDIR"
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p $GANRECDIR2
|
|
||||||
mkdir -p $GANRECDIR3
|
|
||||||
}
|
|
||||||
|
|
||||||
monitor_ganesha_nfsd ()
|
|
||||||
{
|
|
||||||
create_ganesha_recdirs
|
|
||||||
service_name=${service_name}_process
|
|
||||||
|
|
||||||
PIDFILE="/var/run/ganesha.pid"
|
|
||||||
CUR_STATE=`get_cluster_fs_state`
|
|
||||||
GANESHA="/usr/bin/$CTDB_CLUSTER_FILESYSTEM_TYPE.ganesha.nfsd"
|
|
||||||
if { read PID < $PIDFILE && \
|
|
||||||
grep "$GANESHA" "/proc/$PID/cmdline" ; } >/dev/null 2>&1 ; then
|
|
||||||
ctdb_counter_init "$service_name"
|
|
||||||
else
|
|
||||||
if [ $CUR_STATE = "active" ]; then
|
|
||||||
echo "Trying fast restart of NFS service"
|
|
||||||
startstop_ganesha restart
|
|
||||||
ctdb_counter_incr "$service_name"
|
|
||||||
ctdb_check_counter "error" "-ge" "6" "$service_name"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
service_name="nfs-ganesha-$CTDB_CLUSTER_FILESYSTEM_TYPE"_service
|
|
||||||
# check that NFS is posting forward progress
|
|
||||||
if [ $CUR_STATE = "active" -a "$CTDB_NFS_SKIP_KNFSD_ALIVE_CHECK" != "yes" ] ; then
|
|
||||||
MAXREDS=2
|
|
||||||
MAXSTALL=120
|
|
||||||
RESTART=0
|
|
||||||
|
|
||||||
NUMREDS=`ls $GANRECDIR3 | grep "red" | wc -l`
|
|
||||||
LASTONE=`ls -t $GANRECDIR3 | sed 's/_/ /' | awk 'NR > 1 {next} {printf $1} '`
|
|
||||||
# Beware of startup
|
|
||||||
if [ -z $LASTONE ] ; then
|
|
||||||
LASTONE=`date +"%s"`
|
|
||||||
fi
|
|
||||||
TNOW=$(date +"%s")
|
|
||||||
TSTALL=$(($TNOW - $LASTONE))
|
|
||||||
if [ $NUMREDS -ge $MAXREDS ] ; then
|
|
||||||
echo restarting because of $NUMREDS red conditions
|
|
||||||
RESTART=1
|
|
||||||
ctdb_counter_incr "$service_name"
|
|
||||||
ctdb_check_counter "error" "-ge" "6" "$service_name"
|
|
||||||
fi
|
|
||||||
if [ $TSTALL -ge $MAXSTALL ] ; then
|
|
||||||
echo restarting because of $TSTALL second stall
|
|
||||||
RESTART=1
|
|
||||||
ctdb_counter_incr "$service_name"
|
|
||||||
ctdb_check_counter "error" "-ge" "6" "$service_name"
|
|
||||||
fi
|
|
||||||
if [ $RESTART -gt 0 ] ; then
|
|
||||||
startstop_ganesha restart
|
|
||||||
else
|
|
||||||
ctdb_counter_init "$service_name"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
############################################################
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
init)
|
|
||||||
# read statd from persistent database
|
|
||||||
;;
|
|
||||||
startup)
|
|
||||||
create_ganesha_recdirs
|
|
||||||
ctdb_service_start
|
|
||||||
create_nodenum_file
|
|
||||||
;;
|
|
||||||
|
|
||||||
shutdown)
|
|
||||||
ctdb_service_stop
|
|
||||||
;;
|
|
||||||
|
|
||||||
takeip)
|
|
||||||
if [ -n "$2" ] ; then
|
|
||||||
case $CTDB_CLUSTER_FILESYSTEM_TYPE in
|
|
||||||
gpfs)
|
|
||||||
NNUM=$(get_nodenum)
|
|
||||||
TDATE=`date +"%s"`
|
|
||||||
TOUCHTGT=$1"_"$TDATE"_"$NNUM"_"$3"_"$4"_"$2
|
|
||||||
touch $GANRECDIR2/$TOUCHTGT
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
ctdb_service_set_reconfigure
|
|
||||||
;;
|
|
||||||
|
|
||||||
releaseip)
|
|
||||||
if [ -n "$2" ] ; then
|
|
||||||
case $CTDB_CLUSTER_FILESYSTEM_TYPE in
|
|
||||||
gpfs)
|
|
||||||
NNUM=$(get_nodenum)
|
|
||||||
TDATE=`date +"%s"`
|
|
||||||
TOUCHTGT=$1"_"$TDATE"_"$NNUM"_"$3"_"$4"_"$2
|
|
||||||
touch $GANRECDIR2/$TOUCHTGT
|
|
||||||
TOUCHTGT="my"$TOUCHTGT
|
|
||||||
touch $GANRECDIR2/$TOUCHTGT
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
ctdb_service_set_reconfigure
|
|
||||||
;;
|
|
||||||
|
|
||||||
monitor)
|
|
||||||
# Check that directories for shares actually exist.
|
|
||||||
[ "$CTDB_NFS_SKIP_SHARE_CHECK" = "yes" ] || {
|
|
||||||
grep Path /etc/ganesha/$CTDB_CLUSTER_FILESYSTEM_TYPE.ganesha.exports.conf |
|
|
||||||
cut -f2 -d\" | sort -u | ctdb_check_directories
|
|
||||||
} || exit $?
|
|
||||||
|
|
||||||
update_tickles 2049
|
|
||||||
nfs_update_lock_info
|
|
||||||
|
|
||||||
nfs_check_service "status" <<EOF
|
|
||||||
version="1" # could drop this and use any version?
|
|
||||||
restart_every=2
|
|
||||||
unhealthy_after=6
|
|
||||||
service_stop_cmd="killall -q -9 rpc.statd"
|
|
||||||
service_start_cmd="rpc.statd ${STATD_HA_CALLOUT:+-H} $STATD_HA_CALLOUT ${STATD_HOSTNAME:+-n} $STATD_HOSTNAME ${STATD_PORT:+-p} $STATD_PORT ${STATD_OUTGOING_PORT:+-o} $STATD_OUTGOING_PORT"
|
|
||||||
service_debug_cmd="program_stack_traces rpc.statd 5"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
if [ "$CTDB_SKIP_GANESHA_NFSD_CHECK" != "yes" ] ; then
|
|
||||||
monitor_ganesha_nfsd
|
|
||||||
fi
|
|
||||||
|
|
||||||
# rquotad is sometimes not started correctly on RHEL5
|
|
||||||
nfs_check_service "rquotad" <<EOF
|
|
||||||
version="1" # could drop this and use any version?
|
|
||||||
restart_every=2
|
|
||||||
unhealthy_after=6
|
|
||||||
service_stop_cmd="killall -q -9 rpc.rquotad"
|
|
||||||
service_start_cmd="rpc.rquotad ${RQUOTAD_PORT:+-p} $RQUOTAD_PORT"
|
|
||||||
service_debug_cmd="program_stack_traces rpc.rquotad 5"
|
|
||||||
EOF
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
ctdb_standard_event_handler "$@"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
exit 0
|
|
@ -29,8 +29,6 @@ service_reconfigure ()
|
|||||||
|
|
||||||
loadconfig
|
loadconfig
|
||||||
|
|
||||||
[ "${CTDB_NFS_SERVER_MODE:-${NFS_SERVER_MODE}}" != "ganesha" ] || exit 0
|
|
||||||
|
|
||||||
ctdb_setup_service_state_dir
|
ctdb_setup_service_state_dir
|
||||||
|
|
||||||
ctdb_start_stop_service
|
ctdb_start_stop_service
|
||||||
|
@ -1175,7 +1175,6 @@ is_ctdb_managed_service ()
|
|||||||
ctdb_compat_managed_service "$CTDB_MANAGES_ISCSI" "iscsi"
|
ctdb_compat_managed_service "$CTDB_MANAGES_ISCSI" "iscsi"
|
||||||
ctdb_compat_managed_service "$CTDB_MANAGES_CLAMD" "clamd"
|
ctdb_compat_managed_service "$CTDB_MANAGES_CLAMD" "clamd"
|
||||||
ctdb_compat_managed_service "$CTDB_MANAGES_NFS" "nfs"
|
ctdb_compat_managed_service "$CTDB_MANAGES_NFS" "nfs"
|
||||||
ctdb_compat_managed_service "$CTDB_MANAGES_NFS" "nfs-ganesha-gpfs"
|
|
||||||
|
|
||||||
t=" $CTDB_MANAGED_SERVICES "
|
t=" $CTDB_MANAGED_SERVICES "
|
||||||
|
|
||||||
|
8
ctdb/config/nfs-checks.d/20.nfs_ganesha.disabled
Normal file
8
ctdb/config/nfs-checks.d/20.nfs_ganesha.disabled
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# nfs_ganesha
|
||||||
|
restart_every=2
|
||||||
|
unhealthy_after=6
|
||||||
|
service_stop_cmd="$CTDB_NFS_CALLOUT stop nfs"
|
||||||
|
service_start_cmd="$CTDB_NFS_CALLOUT start nfs"
|
||||||
|
service_check_cmd="$CTDB_NFS_CALLOUT check nfs"
|
||||||
|
# Ganesha initscript restarts rpc.statd and stack trace is desirable!
|
||||||
|
service_debug_cmd="program_stack_traces status 5"
|
299
ctdb/config/nfs-ganesha-callout
Executable file
299
ctdb/config/nfs-ganesha-callout
Executable file
@ -0,0 +1,299 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# This is an example CTDB NFS callout script for Ganesha. It is based
|
||||||
|
# on the last version of 60.ganesha shipped with CTDB. As such, it
|
||||||
|
# does not try to monitor RPC services that were not monitored by
|
||||||
|
# 60.ganesha - this might be a useful improvement. It has also not
|
||||||
|
# been properly tested.
|
||||||
|
|
||||||
|
# You should check your version of NFS Ganesha to see if it ships with
|
||||||
|
# a newer callout.
|
||||||
|
|
||||||
|
# To use this:
|
||||||
|
#
|
||||||
|
# * Set CTDB_NFS_CALLOUT in your CTDB configuration to point to this
|
||||||
|
# script
|
||||||
|
#
|
||||||
|
# * Rename nfs-checks.d/{20.nfs.check,30.nlockmgr.check,50.mountd.check}
|
||||||
|
# so that they no longer have the ".check" suffix
|
||||||
|
#
|
||||||
|
# * Rename nfs-checks.d/20.nfs-ganesha.disabled to nfs-checks.d/20.nfs.check
|
||||||
|
|
||||||
|
# I (Martin Schwenke) hereby relicense all of my contributions to this
|
||||||
|
# callout (and, previously, to 60.ganesha) to a license compatible
|
||||||
|
# with NFS Ganesha (right now this is LGPLv3, but I'm flexible).
|
||||||
|
# There may be other contributions to be considered for relicensing,
|
||||||
|
# particularly those in commit 28cbe527d47822f870e8252495ab2a1c8fddd12f.
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
# Exit on 1st error
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ -z "$CTDB_CLUSTER_FILESYSTEM_TYPE" ] ; then
|
||||||
|
CTDB_CLUSTER_FILESYSTEM_TYPE="gpfs"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Override for unit testing
|
||||||
|
if [ -z "$PROCFS_PATH" ] ; then
|
||||||
|
PROCFS_PATH="/proc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
##################################################
|
||||||
|
|
||||||
|
usage ()
|
||||||
|
{
|
||||||
|
_c=$(basename $0)
|
||||||
|
cat <<EOF
|
||||||
|
usage: $_c { shutdown | startup }
|
||||||
|
$_c { stop | start | check } nfs
|
||||||
|
$_c { releaseip | takeip }
|
||||||
|
$_c { monitor-list-shares }
|
||||||
|
EOF
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
##################################################
|
||||||
|
# Basic service stop and start
|
||||||
|
|
||||||
|
nfs_service="nfs-ganesha-$CTDB_CLUSTER_FILESYSTEM_TYPE"
|
||||||
|
|
||||||
|
basic_stop ()
|
||||||
|
{
|
||||||
|
case "$1" in
|
||||||
|
nfs)
|
||||||
|
service "$nfs_service" stop
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
usage
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
basic_start ()
|
||||||
|
{
|
||||||
|
case "$1" in
|
||||||
|
nfs)
|
||||||
|
service "$nfs_service" start
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
usage
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
##################################################
|
||||||
|
# "stop" and "start" options for restarting
|
||||||
|
|
||||||
|
service_stop ()
|
||||||
|
{
|
||||||
|
case "$1" in
|
||||||
|
nfs)
|
||||||
|
basic_stop "nfs"
|
||||||
|
;;
|
||||||
|
nlockmgr)
|
||||||
|
# Do nothing - used by statd-callout
|
||||||
|
:
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
usage
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
service_start ()
|
||||||
|
{
|
||||||
|
case "$1" in
|
||||||
|
nfs)
|
||||||
|
basic_start "nfs"
|
||||||
|
;;
|
||||||
|
nlockmgr)
|
||||||
|
# Do nothing - used by statd-callout
|
||||||
|
:
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
usage
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
##################################################
|
||||||
|
# Nitty gritty - monitoring and IP handling
|
||||||
|
|
||||||
|
GANRECDIR="/var/lib/nfs/ganesha"
|
||||||
|
GANRECDIR2="/var/lib/nfs/ganesha/recevents"
|
||||||
|
GANRECDIR3="/var/lib/nfs/ganesha_local"
|
||||||
|
|
||||||
|
get_cluster_fs_state ()
|
||||||
|
{
|
||||||
|
case $CTDB_CLUSTER_FILESYSTEM_TYPE in
|
||||||
|
gpfs)
|
||||||
|
/usr/lpp/mmfs/bin/mmgetstate | awk 'NR == 4 { print $3 }'
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
die "File system $CTDB_CLUSTER_FILESYSTEM_TYPE not supported"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
create_ganesha_recdirs ()
|
||||||
|
{
|
||||||
|
[ -n "$CTDB_GANESHA_REC_SUBDIR" ] || CTDB_GANESHA_REC_SUBDIR=".ganesha"
|
||||||
|
|
||||||
|
_mounts=$(mount -t $CTDB_CLUSTER_FILESYSTEM_TYPE)
|
||||||
|
if [ -z "$_mounts" ]; then
|
||||||
|
echo "startup $CTDB_CLUSTER_FILESYSTEM_TYPE not ready"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
_mntpt=$(echo "$_mounts" | sort | awk 'NR == 1 {print $3}')
|
||||||
|
_link_dst="${_mntpt}/${CTDB_GANESHA_REC_SUBDIR}"
|
||||||
|
mkdir -vp "$_link_dst"
|
||||||
|
if [ -e "$GANRECDIR" ]; then
|
||||||
|
if [ ! -L "$GANRECDIR" ] ; then
|
||||||
|
rm -vrf "$GANRECDIR"
|
||||||
|
else
|
||||||
|
_t=$(readlink "$GANRECDIR")
|
||||||
|
if [ "$_t" != "$_link_dst" ] ; then
|
||||||
|
rm -v "$GANRECDIR"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# This is not an "else". It also re-creates the link if it was
|
||||||
|
# removed above!
|
||||||
|
if [ ! -e "$GANRECDIR" ]; then
|
||||||
|
ln -sv "$_link_dst" "$GANRECDIR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "$GANRECDIR2"
|
||||||
|
mkdir -p "$GANRECDIR3"
|
||||||
|
}
|
||||||
|
|
||||||
|
service_check ()
|
||||||
|
{
|
||||||
|
create_ganesha_recdirs
|
||||||
|
|
||||||
|
# Always succeed if cluster filesystem is not active
|
||||||
|
_cluster_fs_state=$(get_cluster_fs_state)
|
||||||
|
if [ $_cluster_fs_state != "active" ] ; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check that NFS Ganesha is running, according to PID file
|
||||||
|
_pidfile="/var/run/ganesha.pid"
|
||||||
|
_ganesha="/usr/bin/$CTDB_CLUSTER_FILESYSTEM_TYPE.ganesha.nfsd"
|
||||||
|
if ! { read _pid < "$_pidfile" && \
|
||||||
|
grep "$_ganesha" "${PROCFS_PATH}/${_pid}/cmdline" ; } >/dev/null 2>&1 ; then
|
||||||
|
echo "ERROR: NFS Ganesha not running according to PID file"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check red conditions against limit
|
||||||
|
_reds_max=2
|
||||||
|
_reds=$(ls $GANRECDIR3 | grep -c "red")
|
||||||
|
|
||||||
|
if [ $_reds -ge $_reds_max ] ; then
|
||||||
|
echo "Too many red conditions (${_reds}/${_reds_max})"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check for stall
|
||||||
|
_stall_max=120
|
||||||
|
_now=$(date +"%s")
|
||||||
|
_last=$(ls -t $GANRECDIR3 | sed -n -e '1s@_.*@@p')
|
||||||
|
[ -n $_last ] || _last=$_now # Handle startup
|
||||||
|
_stall=$(($_now - $_last))
|
||||||
|
if [ $_stall -ge $_stall_max ] ; then
|
||||||
|
echo "ERROR: Stalled for ${_stall} second(s)"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------
|
||||||
|
|
||||||
|
get_nodenum ()
|
||||||
|
{
|
||||||
|
_nodenum_file="${GANRECDIR}/gpfs_nodenum"
|
||||||
|
|
||||||
|
if [ ! -f "$_nodenum_file" ]; then
|
||||||
|
/usr/lpp/mmfs/bin/mmlsconfig myNodeConfigNumber |
|
||||||
|
awk '{print $2}' >"$_nodenum_file"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat "$_nodenum_file"
|
||||||
|
}
|
||||||
|
|
||||||
|
nfs_releaseip ()
|
||||||
|
{
|
||||||
|
case $CLUSTER_FILESYSTEM_TYPE in
|
||||||
|
gpfs)
|
||||||
|
_nnum=$(get_nodenum)
|
||||||
|
_tdate=$(date +"%s")
|
||||||
|
_touchtgt="releaseip_${_tdate}_${_nnum}_${2}_${3}_${1}"
|
||||||
|
touch "${GANRECDIR2}/${_touchtgt}"
|
||||||
|
touch "$GANRECDIR2/my${_touchtgt}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
nfs_takeip ()
|
||||||
|
{
|
||||||
|
case $CLUSTER_FILESYSTEM_TYPE in
|
||||||
|
gpfs)
|
||||||
|
_nnum=$(get_nodenum)
|
||||||
|
_tdate=$(date +"%s")
|
||||||
|
_touchtgt="takeip_${_tdate}_${_nnum}_${2}_${3}_${1}"
|
||||||
|
touch "${GANRECDIR2}/${_touchtgt}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
##################################################
|
||||||
|
# service init startup and final shutdown
|
||||||
|
|
||||||
|
nfs_shutdown ()
|
||||||
|
{
|
||||||
|
basic_stop "nfs"
|
||||||
|
}
|
||||||
|
|
||||||
|
nfs_startup ()
|
||||||
|
{
|
||||||
|
create_ganesha_recdirs
|
||||||
|
|
||||||
|
basic_stop "nfs" || true
|
||||||
|
basic_start "nfs"
|
||||||
|
_f="${PROCFS_PATH}/sys/net/ipv4/tcp_tw_recycle"
|
||||||
|
if [ "$_f" ] ; then
|
||||||
|
echo 1 >"$_f"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
##################################################
|
||||||
|
# list share directories
|
||||||
|
|
||||||
|
nfs_monitor_list_shares ()
|
||||||
|
{
|
||||||
|
grep Path /etc/ganesha/$CTDB_CLUSTER_FILESYSTEM_TYPE.ganesha.exports.conf |
|
||||||
|
cut -f2 -d\" |
|
||||||
|
sort -u
|
||||||
|
}
|
||||||
|
|
||||||
|
##################################################
|
||||||
|
|
||||||
|
action="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
case "$action" in
|
||||||
|
shutdown) nfs_shutdown ;;
|
||||||
|
startup) nfs_startup ;;
|
||||||
|
stop) service_stop "$1" ;;
|
||||||
|
start) service_start "$1" ;;
|
||||||
|
check) service_check "$1" ;;
|
||||||
|
releaseip) nfs_releaseip "$@" ;;
|
||||||
|
takeip) nfs_takeip "$@" ;;
|
||||||
|
monitor-list-shares) nfs_monitor_list_shares ;;
|
||||||
|
monitor-pre|monitor-post)
|
||||||
|
# Not required/implemented
|
||||||
|
:
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
usage
|
||||||
|
esac
|
@ -121,11 +121,9 @@ case "$1" in
|
|||||||
# where the lock manager will respond "strangely" immediately
|
# where the lock manager will respond "strangely" immediately
|
||||||
# after restarting it, which causes clients to fail to reclaim
|
# after restarting it, which causes clients to fail to reclaim
|
||||||
# their locks.
|
# their locks.
|
||||||
if [ "${CTDB_NFS_SERVER_MODE:-${NFS_SERVER_MODE}}" != "ganesha" ] ; then
|
|
||||||
"$CTDB_NFS_CALLOUT" "stop" "nlockmgr" >/dev/null 2>&1
|
"$CTDB_NFS_CALLOUT" "stop" "nlockmgr" >/dev/null 2>&1
|
||||||
sleep 2
|
sleep 2
|
||||||
"$CTDB_NFS_CALLOUT" "start" "nlockmgr" >/dev/null 2>&1
|
"$CTDB_NFS_CALLOUT" "start" "nlockmgr" >/dev/null 2>&1
|
||||||
fi
|
|
||||||
|
|
||||||
# we now need to send out additional statd notifications to ensure
|
# we now need to send out additional statd notifications to ensure
|
||||||
# that clients understand that the lockmanager has restarted.
|
# that clients understand that the lockmanager has restarted.
|
||||||
|
@ -973,18 +973,17 @@ CTDB_PER_IP_ROUTING_TABLE_ID_HIGH=9000
|
|||||||
<title>NFS</title>
|
<title>NFS</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
This includes parameters for the kernel NFS server and the
|
This includes parameters for the kernel NFS server.
|
||||||
user-space
|
Alternative NFS subsystems (such as <ulink
|
||||||
<ulink url="https://github.com/nfs-ganesha/nfs-ganesha/wiki">NFS-Ganesha</ulink>
|
url="https://github.com/nfs-ganesha/nfs-ganesha/wiki">NFS-Ganesha</ulink>)
|
||||||
server.
|
can be integrated using <varname>CTDB_NFS_CALLOUT</varname>.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<refsect3>
|
<refsect3>
|
||||||
<title>Eventscripts</title>
|
<title>Eventscript</title>
|
||||||
|
|
||||||
<simplelist>
|
<simplelist>
|
||||||
<member><filename>60.nfs</filename></member>
|
<member><filename>60.nfs</filename></member>
|
||||||
<member><filename>60.ganesha</filename></member>
|
|
||||||
</simplelist>
|
</simplelist>
|
||||||
</refsect3>
|
</refsect3>
|
||||||
|
|
||||||
@ -1003,21 +1002,6 @@ CTDB_PER_IP_ROUTING_TABLE_ID_HIGH=9000
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>CTDB_GANESHA_REC_SUBDIR<parameter>SUBDIR</parameter></term>
|
|
||||||
<listitem>
|
|
||||||
<para>
|
|
||||||
SUBDIR is the name of a top-level subdirectory in the
|
|
||||||
first cluster filesystem. This subdirectory is used to
|
|
||||||
allow communication between NFS-Ganesha and the
|
|
||||||
<filename>60.ganesha</filename> script.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
Default is ".ganesha".
|
|
||||||
</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>CTDB_MANAGES_NFS=yes|no</term>
|
<term>CTDB_MANAGES_NFS=yes|no</term>
|
||||||
<listitem>
|
<listitem>
|
||||||
@ -1059,36 +1043,6 @@ CTDB_PER_IP_ROUTING_TABLE_ID_HIGH=9000
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>CTDB_NFS_SERVER_MODE=kernel|ganesha</term>
|
|
||||||
<listitem>
|
|
||||||
<para>
|
|
||||||
Selects which NFS server to be managed.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
This replaces the deprecated variable
|
|
||||||
<varname>NFS_SERVER_MODE</varname>.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
Default is "kernel".
|
|
||||||
</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>CTDB_NFS_SKIP_KNFSD_ALIVE_CHECK=yes|no</term>
|
|
||||||
<listitem>
|
|
||||||
<para>
|
|
||||||
During monitoring, should CTDB skip the
|
|
||||||
<command>rpcinfo</command> check that is used to see if
|
|
||||||
the NFS kernel server is functional.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
Default is no.
|
|
||||||
</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>CTDB_NFS_SKIP_SHARE_CHECK=yes|no</term>
|
<term>CTDB_NFS_SKIP_SHARE_CHECK=yes|no</term>
|
||||||
<listitem>
|
<listitem>
|
||||||
@ -1119,21 +1073,6 @@ CTDB_PER_IP_ROUTING_TABLE_ID_HIGH=9000
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>CTDB_SKIP_GANESHA_NFSD_CHECK=yes|no</term>
|
|
||||||
<listitem>
|
|
||||||
<para>
|
|
||||||
As part of monitoring, should CTDB skip the check for
|
|
||||||
the existence of each directory exported via
|
|
||||||
NFS-Ganesha. This may be desirable if there is a large
|
|
||||||
number of exports.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
Default is no.
|
|
||||||
</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
</refsect2>
|
</refsect2>
|
||||||
|
@ -180,13 +180,13 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%{_sysconfdir}/ctdb/events.d/49.winbind
|
%{_sysconfdir}/ctdb/events.d/49.winbind
|
||||||
%{_sysconfdir}/ctdb/events.d/50.samba
|
%{_sysconfdir}/ctdb/events.d/50.samba
|
||||||
%{_sysconfdir}/ctdb/events.d/60.nfs
|
%{_sysconfdir}/ctdb/events.d/60.nfs
|
||||||
%{_sysconfdir}/ctdb/events.d/60.ganesha
|
|
||||||
%{_sysconfdir}/ctdb/events.d/62.cnfs
|
%{_sysconfdir}/ctdb/events.d/62.cnfs
|
||||||
%{_sysconfdir}/ctdb/events.d/70.iscsi
|
%{_sysconfdir}/ctdb/events.d/70.iscsi
|
||||||
%{_sysconfdir}/ctdb/events.d/91.lvs
|
%{_sysconfdir}/ctdb/events.d/91.lvs
|
||||||
%{_sysconfdir}/ctdb/events.d/99.timeout
|
%{_sysconfdir}/ctdb/events.d/99.timeout
|
||||||
%config(noreplace) %{_sysconfdir}/ctdb/nfs-checks.d/10.status.check
|
%config(noreplace) %{_sysconfdir}/ctdb/nfs-checks.d/10.status.check
|
||||||
%config(noreplace) %{_sysconfdir}/ctdb/nfs-checks.d/20.nfs.check
|
%config(noreplace) %{_sysconfdir}/ctdb/nfs-checks.d/20.nfs.check
|
||||||
|
%config(noreplace) %{_sysconfdir}/ctdb/nfs-checks.d/20.nfs_ganesha.disabled
|
||||||
%config(noreplace) %{_sysconfdir}/ctdb/nfs-checks.d/30.nlockmgr.check
|
%config(noreplace) %{_sysconfdir}/ctdb/nfs-checks.d/30.nlockmgr.check
|
||||||
%config(noreplace) %{_sysconfdir}/ctdb/nfs-checks.d/40.mountd.check
|
%config(noreplace) %{_sysconfdir}/ctdb/nfs-checks.d/40.mountd.check
|
||||||
%config(noreplace) %{_sysconfdir}/ctdb/nfs-checks.d/50.rquotad.check
|
%config(noreplace) %{_sysconfdir}/ctdb/nfs-checks.d/50.rquotad.check
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
. "${TEST_SCRIPTS_DIR}/unit.sh"
|
|
||||||
|
|
||||||
define_test "all services available"
|
|
||||||
|
|
||||||
setup_nfs_ganesha
|
|
||||||
|
|
||||||
ok_null
|
|
||||||
|
|
||||||
simple_test
|
|
@ -1,10 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
. "${TEST_SCRIPTS_DIR}/unit.sh"
|
|
||||||
|
|
||||||
define_test "rquotad down, 2 iterations"
|
|
||||||
|
|
||||||
setup_nfs_ganesha
|
|
||||||
rpc_services_down "rquotad"
|
|
||||||
|
|
||||||
nfs_iterate_test 2 "rquotad"
|
|
@ -1,12 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
. "${TEST_SCRIPTS_DIR}/unit.sh"
|
|
||||||
|
|
||||||
define_test "statd down, 10 iterations"
|
|
||||||
|
|
||||||
# statd fails and attempts to restart it fail.
|
|
||||||
|
|
||||||
setup_nfs_ganesha
|
|
||||||
rpc_services_down "status"
|
|
||||||
|
|
||||||
nfs_iterate_test 10 "status"
|
|
@ -830,14 +830,11 @@ setup_nfs ()
|
|||||||
setup_nfs_ganesha ()
|
setup_nfs_ganesha ()
|
||||||
{
|
{
|
||||||
setup_nfs "$@"
|
setup_nfs "$@"
|
||||||
export CTDB_NFS_SERVER_MODE="ganesha"
|
export CTDB_NFS_CALLOUT="${CTDB_BASE}/nfs-ganesha-callout"
|
||||||
if [ "$1" != "down" ] ; then
|
if [ "$1" != "down" ] ; then
|
||||||
export CTDB_MANAGES_NFS="yes"
|
export CTDB_MANAGES_NFS="yes"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# We do not support testing the Ganesha-nfsd-specific part of the
|
|
||||||
# eventscript.
|
|
||||||
export CTDB_SKIP_GANESHA_NFSD_CHECK="yes"
|
|
||||||
export CTDB_NFS_SKIP_SHARE_CHECK="yes"
|
export CTDB_NFS_SKIP_SHARE_CHECK="yes"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user