mirror of
https://github.com/samba-team/samba.git
synced 2025-01-03 01:18:10 +03:00
ctdb-scripts: Stop/start mount/rquotad/status via NFS call-out
When an NFS check restarts a failed service by hand then systemd will be unable to stop or start this service again because (at least) the PID file will be wrong. Do this via the NFS Linux kernel call-out instead. Allow the call-out to use the services instead of doing manual restarts. Add variables for mount, status and rquotad services to support this. Adding systemd NFS services to the call-out will follow. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13860 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@samba.org>
This commit is contained in:
parent
8de0a339b5
commit
42103b5686
@ -2,6 +2,6 @@
|
||||
version="1"
|
||||
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_stop_cmd="$CTDB_NFS_CALLOUT stop status"
|
||||
service_start_cmd="$CTDB_NFS_CALLOUT start status"
|
||||
service_debug_cmd="program_stack_traces rpc.statd 5"
|
||||
|
@ -2,6 +2,6 @@
|
||||
version="1"
|
||||
restart_every=2
|
||||
unhealthy_after=6
|
||||
service_stop_cmd="killall -q -9 rpc.mountd"
|
||||
service_start_cmd="rpc.mountd $RPCMOUNTDOPTS ${MOUNTD_PORT:+-p} $MOUNTD_PORT"
|
||||
service_stop_cmd="$CTDB_NFS_CALLOUT stop mountd"
|
||||
service_start_cmd="$CTDB_NFS_CALLOUT start mountd"
|
||||
service_debug_cmd="program_stack_traces rpc.mountd 5"
|
||||
|
@ -2,6 +2,6 @@
|
||||
version="1"
|
||||
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_stop_cmd="$CTDB_NFS_CALLOUT stop rquotad"
|
||||
service_start_cmd="$CTDB_NFS_CALLOUT start rquotad"
|
||||
service_debug_cmd="program_stack_traces rpc.rquotad 5"
|
||||
|
@ -21,7 +21,11 @@ sysvinit-*)
|
||||
# Defaults
|
||||
nfs_service="nfs"
|
||||
nfs_lock_service=""
|
||||
nfs_mountd_service=""
|
||||
nfs_status_service=""
|
||||
nfs_rquotad_service=""
|
||||
nfs_config="/etc/sysconfig/nfs"
|
||||
nfs_rquotad_config="$nfs_config"
|
||||
|
||||
case "$nfs_distro_style" in
|
||||
*-redhat)
|
||||
@ -33,6 +37,7 @@ sysvinit-*)
|
||||
*-debian)
|
||||
nfs_service="nfs-kernel-server"
|
||||
nfs_config="/etc/default/nfs-kernel-server"
|
||||
nfs_rquotad_config="/etc/default/quota"
|
||||
;;
|
||||
*)
|
||||
echo "Internal error"
|
||||
@ -134,6 +139,33 @@ service_stop ()
|
||||
nlockmgr)
|
||||
basic_stop "nfslock" >/dev/null 2>&1 || true
|
||||
;;
|
||||
mountd)
|
||||
if [ -n "$nfs_mountd_service" ] ; then
|
||||
service "$nfs_mountd_service" stop
|
||||
return
|
||||
fi
|
||||
|
||||
# Default to stopping by hand
|
||||
killall -q -9 rpc.mountd
|
||||
;;
|
||||
rquotad)
|
||||
if [ -n "$nfs_rquotad_service" ] ; then
|
||||
service "$nfs_rquotad_service" stop
|
||||
return
|
||||
fi
|
||||
|
||||
# Default to stopping by hand
|
||||
killall -q -9 rpc.rquotad
|
||||
;;
|
||||
status)
|
||||
if [ -n "$nfs_status_service" ] ; then
|
||||
service "$nfs_status_service" stop
|
||||
return
|
||||
fi
|
||||
|
||||
# Default to stopping by hand
|
||||
killall -q -9 rpc.statd
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
esac
|
||||
@ -148,6 +180,56 @@ service_start ()
|
||||
nlockmgr)
|
||||
basic_start "nfslock"
|
||||
;;
|
||||
mountd)
|
||||
if [ -n "$nfs_mountd_service" ] ; then
|
||||
service "$nfs_mountd_service" start
|
||||
return
|
||||
fi
|
||||
|
||||
# Default to starting by hand
|
||||
nfs_load_config
|
||||
if [ -z "$RPCMOUNTDOPTS" ] ; then
|
||||
RPCMOUNTDOPTS="${MOUNTD_PORT:+-p }$MOUNTD_PORT"
|
||||
fi
|
||||
# shellcheck disable=SC2086
|
||||
rpc.mountd $RPCMOUNTDOPTS
|
||||
;;
|
||||
rquotad)
|
||||
if [ -n "$nfs_rquotad_service" ] ; then
|
||||
service "$nfs_rquotad_service" start
|
||||
return
|
||||
fi
|
||||
|
||||
# Default to starting by hand
|
||||
nfs_load_config "$nfs_rquotad_config"
|
||||
if [ -z "$RPCRQUOTADOPTS" ] ; then
|
||||
RPCRQUOTADOPTS="${RQUOTAD_PORT:+-p }$RQUOTAD_PORT"
|
||||
fi
|
||||
# shellcheck disable=SC2086
|
||||
rpc.rquotad $RPCRQUOTADOPTS
|
||||
;;
|
||||
status)
|
||||
if [ -n "$nfs_status_service" ] ; then
|
||||
service "$nfs_status_service" start
|
||||
return
|
||||
fi
|
||||
|
||||
# Default to starting by hand
|
||||
nfs_load_config
|
||||
# Red Hat uses STATDARG, Debian uses STATDOPTS
|
||||
opts="${STATDARG:-${STATDOPTS:-''}}"
|
||||
if [ -z "$opts" ] ; then
|
||||
# shellcheck disable=SC2086
|
||||
set -- \
|
||||
${STATD_HA_CALLOUT:+-H} $STATD_HA_CALLOUT \
|
||||
${STATD_HOSTNAME:+-n} $STATD_HOSTNAME \
|
||||
${STATD_PORT:+-p} $STATD_PORT \
|
||||
${STATD_OUTGOING_PORT:+-o} $STATD_OUTGOING_PORT
|
||||
opts="$*"
|
||||
fi
|
||||
# shellcheck disable=SC2086
|
||||
rpc.statd $opts
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
esac
|
||||
|
Loading…
Reference in New Issue
Block a user