[SCM] Samba Shared Repository - branch v4-9-test updated

Karolin Seeger kseeger at samba.org
Fri Apr 12 11:30:03 UTC 2019


The branch, v4-9-test has been updated
       via  e974e44014b torture: Add test for talloc size accounting in memcache
       via  e09262b7a0f memcache: Increase size of default memcache to 512k
       via  a54038bf5f8 memcache: Properly track the size of talloc objects
       via  116c874f1ff memcache: Introduce struct for storing talloc pointer
       via  49fa08814e2 ctdb-scripts: Update statd-callout to try several configuration files
       via  dae0e8ec961 ctdb-scripts: Allow load_system_config() to take multiple alternatives
       via  14069988a97 ctdb-tests: Update NFS test infrastructure to support systemd services
       via  aee71ea6863 ctdb-scripts: Add systemd services to NFS call-out
       via  7932032de40 ctdb-scripts: Start NFS quota service if defined
       via  5a97b7f00ab ctdb-scripts: Stop/start mount/rquotad/status via NFS call-out
       via  f00827672cb ctdb-scripts: Factor out nfs_load_config()
       via  022b9a6ca7d ctdb-scripts: Add test variable CTDB_NFS_DISTRO_STYLE
       via  117586288be ctdb-scripts: Rename variable nfslock_service to nfs_lock_service
       via  d415458f6fc ctdb-scripts: Reindent some functions prior to making changes
      from  d78118d0af5 py/provision: fix for Python 2.6

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-9-test


- Log -----------------------------------------------------------------
commit e974e44014b9ea5b6c62f81b63a9288eec82d5ff
Author: Christof Schmitt <cs at samba.org>
Date:   Thu Mar 28 10:46:43 2019 -0700

    torture: Add test for talloc size accounting in memcache
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13865
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Sat Apr  6 06:08:42 UTC 2019 on sn-devel-144
    
    (cherry picked from commit b7028c42462c34cf86cb949bfdb16ebc7ed0a6c6)
    
    Autobuild-User(v4-9-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-9-test): Fri Apr 12 11:29:26 UTC 2019 on sn-devel-144

commit e09262b7a0feca27aff2a64c5b36cefd13c676a4
Author: Christof Schmitt <cs at samba.org>
Date:   Fri Apr 5 15:43:21 2019 -0700

    memcache: Increase size of default memcache to 512k
    
    With the fixed accounting of talloc objects, the default cache size
    needs to increase. The exact increase required depends on the workloads,
    going form 256k to 512k seems like a reasonable guess.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13865
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 9ff5c0bab76c5d3d7bea1fcb79861d0c9a3b9839)

commit a54038bf5f87189ebc46ae3da1335205efd03669
Author: Christof Schmitt <cs at samba.org>
Date:   Mon Apr 1 16:23:35 2019 -0700

    memcache: Properly track the size of talloc objects
    
    With memcache_add_talloc, the talloc object becomes part of the pool and
    the memcache_element stores a pointer to the talloc object. The
    size of the the talloc object was not used when tracking the used space,
    allowing the cache to grow larger than defined in the memcache_init
    call.
    
    Fix this by adding the size of the talloc object to the used space.
    
    Also record the initial size of the talloc object for proper adjustment
    of the used space in the cache later. This is in case the size of the
    talloc object is modified while being owned by the cache (e.g.
    allocating talloc child objects). This should never happen, but better
    be safe than ending up with a broken cache usage counter.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13865
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit a04ca6f3438595ba7e1a110877f53d1cac0f0402)

commit 116c874f1ff77d27a7ffb10c44a3cba8bad891a0
Author: Christof Schmitt <cs at samba.org>
Date:   Mon Apr 1 15:38:59 2019 -0700

    memcache: Introduce struct for storing talloc pointer
    
    This allows extending the additional data stored for talloced objects
    later.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13865
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 7c44f2f76eefb9156cb1d170c92b4ff07dd6a3d5)

commit 49fa08814e2a1032e88353eec42b952316d6ec18
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Mar 20 21:22:43 2019 +1100

    ctdb-scripts: Update statd-callout to try several configuration files
    
    The alternative seems to be to try something via CTDB_NFS_CALLOUT.
    That would be complicated and seems like overkill for something this
    simple.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13860
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at samba.org>
    (cherry picked from commit a2bd4085896804ee2da811e17f18c78a5bf4e658)

commit dae0e8ec961dc96e2d75c9b5e7d1c47479a9c1e4
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Mar 20 21:19:49 2019 +1100

    ctdb-scripts: Allow load_system_config() to take multiple alternatives
    
    The situation for NFS config has got more complicated and is probably
    broken in statd-callout on Debian-like systems at the moment.  Allow
    several alternative configuration names to be tried.  Stop after the
    first that is found and loaded.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13860
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at samba.org>
    (cherry picked from commit 0d67ea5fcca766734ecc73ad6b0139f7c13a15c5)

commit 14069988a97ce9f32f10e8e851b6739083dc52ff
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Mar 26 15:07:43 2019 +1100

    ctdb-tests: Update NFS test infrastructure to support systemd services
    
    The tests are written around the default of sysvinit-redhat.  Add
    support for systemd-redhat.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13860
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at samba.org>
    (cherry picked from commit 2833ddcfcb780497264e0f412a9ad6e26a9bc657)

commit aee71ea6863c45467b3e897ce8f5c093d88b8020
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Mar 20 17:45:10 2019 +1100

    ctdb-scripts: Add systemd services to NFS call-out
    
    At least Red Hat and Debian appear to use (a variant of?) the upstream
    systemd units for NFS, so adding support for these services is
    relatively easy.  Distributions using Sys-V init can patch the
    call-out to use the relevant Sys-V init services.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13860
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at samba.org>
    (cherry picked from commit a8fafd377ff0cb07ab161e437c5fe024704345eb)

commit 7932032de40129e43cb5815ee747c41ebdecb07c
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Mar 21 15:30:00 2019 +1100

    ctdb-scripts: Start NFS quota service if defined
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13860
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at samba.org>
    (cherry picked from commit 708c04071af8d6ddc3bf2bddbde4d5847f440c0e)

commit 5a97b7f00ab0e4819daa41480c80d19c312ad37e
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Mar 20 17:35:44 2019 +1100

    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 at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at samba.org>
    (cherry picked from commit 42103b568698d8087d27f0848b402ccb7cfac86b)

commit f00827672cb061903d40b6c574e589febbb06a41
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Mar 20 16:11:32 2019 +1100

    ctdb-scripts: Factor out nfs_load_config()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13860
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at samba.org>
    (cherry picked from commit 8de0a339b550e7363d265af04ad69f2179af75c6)

commit 022b9a6ca7d8cb6f541b1b24b27da4e1a3bea04b
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Mar 26 14:49:49 2019 +1100

    ctdb-scripts: Add test variable CTDB_NFS_DISTRO_STYLE
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13860
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at samba.org>
    (cherry picked from commit e72c3c800a50fe746164e319e21180c44d041619)

commit 117586288be5606ef311a7f3c69f49d237c1ae60
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Mar 20 14:50:59 2019 +1100

    ctdb-scripts: Rename variable nfslock_service to nfs_lock_service
    
    There will be more of these variable for other services so, for
    readability, it makes sense for them to start with "nfs_".
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13860
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at samba.org>
    (cherry picked from commit 9981353ab79dce81b698c535977be4a681119d1e)

commit d415458f6fcdef149dc9adc6e34e063a40a22dbd
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Mar 18 14:42:36 2019 +1100

    ctdb-scripts: Reindent some functions prior to making changes
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13860
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at samba.org>
    (cherry picked from commit d7e187c1a7046196ec96637bdc14cc6b042eafcc)

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

Summary of changes:
 ctdb/config/functions                             |  19 +-
 ctdb/config/nfs-checks.d/10.status.check          |   4 +-
 ctdb/config/nfs-checks.d/40.mountd.check          |   4 +-
 ctdb/config/nfs-checks.d/50.rquotad.check         |   4 +-
 ctdb/config/nfs-linux-kernel-callout              | 259 +++++++++++++++++-----
 ctdb/config/statd-callout                         |   3 +-
 ctdb/tests/eventscripts/scripts/60.nfs.sh         |  99 ++++++++-
 docs-xml/smbdotconf/filename/maxstatcachesize.xml |   2 +-
 lib/param/loadparm.c                              |   2 +-
 lib/util/memcache.c                               |  54 +++--
 source3/param/loadparm.c                          |   2 +-
 source3/torture/torture.c                         |  70 +++++-
 12 files changed, 422 insertions(+), 100 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/config/functions b/ctdb/config/functions
index 7a47c9d8e79..1dc16532890 100755
--- a/ctdb/config/functions
+++ b/ctdb/config/functions
@@ -33,15 +33,16 @@ fi
 
 load_system_config ()
 {
-	if [ -z "$1" ] ; then
-		return
-	fi
-
-	if [ -f "${CTDB_SYS_ETCDIR}/sysconfig/$1" ]; then
-		. "${CTDB_SYS_ETCDIR}/sysconfig/$1"
-	elif [ -f "${CTDB_SYS_ETCDIR}/default/$1" ]; then
-		. "${CTDB_SYS_ETCDIR}/default/$1"
-	fi
+	for _i ; do
+
+		if [ -f "${CTDB_SYS_ETCDIR}/sysconfig/${_i}" ]; then
+			. "${CTDB_SYS_ETCDIR}/sysconfig/${_i}"
+			return
+		elif [ -f "${CTDB_SYS_ETCDIR}/default/${_i}" ]; then
+			. "${CTDB_SYS_ETCDIR}/default/${_i}"
+			return
+		fi
+	done
 }
 
 # load_script_options [ component script ]
diff --git a/ctdb/config/nfs-checks.d/10.status.check b/ctdb/config/nfs-checks.d/10.status.check
index dfa5c59117e..b8ce1e0ad0b 100644
--- a/ctdb/config/nfs-checks.d/10.status.check
+++ b/ctdb/config/nfs-checks.d/10.status.check
@@ -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"
diff --git a/ctdb/config/nfs-checks.d/40.mountd.check b/ctdb/config/nfs-checks.d/40.mountd.check
index 56b3fd29512..bfe4c277ce9 100644
--- a/ctdb/config/nfs-checks.d/40.mountd.check
+++ b/ctdb/config/nfs-checks.d/40.mountd.check
@@ -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"
diff --git a/ctdb/config/nfs-checks.d/50.rquotad.check b/ctdb/config/nfs-checks.d/50.rquotad.check
index b7bd9d2c757..98bd8d98fce 100644
--- a/ctdb/config/nfs-checks.d/50.rquotad.check
+++ b/ctdb/config/nfs-checks.d/50.rquotad.check
@@ -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"
diff --git a/ctdb/config/nfs-linux-kernel-callout b/ctdb/config/nfs-linux-kernel-callout
index 9b72446b44e..3d1dc63c590 100755
--- a/ctdb/config/nfs-linux-kernel-callout
+++ b/ctdb/config/nfs-linux-kernel-callout
@@ -12,20 +12,66 @@ set -e
 # hook for testing.
 nfs_exports_file="${CTDB_NFS_EXPORTS_FILE:-/var/lib/nfs/etab}"
 
-# Red Hat
-nfs_service="nfs"
-nfslock_service="nfslock"
-nfs_config="/etc/sysconfig/nfs"
+# As above, edit the default value below.  CTDB_NFS_DISTRO_STYLE is a
+# test variable only.
+nfs_distro_style="${CTDB_NFS_DISTRO_STYLE:-sysvinit-redhat}"
+
+case "$nfs_distro_style" in
+systemd-*)
+	# Defaults
+	nfs_service="nfs-server"
+	nfs_lock_service="rpc-statd"
+	nfs_mountd_service="nfs-mountd"
+	nfs_status_service="rpc-statd"
+	nfs_rquotad_service="rpc-rquotad"
+	nfs_config="/etc/sysconfig/nfs"
+	nfs_rquotad_config="" # Not use with systemd, restart via service
+
+	case "$nfs_distro_style" in
+	*-redhat|*-suse)
+		: # Defaults only
+		;;
+	*-debian)
+		nfs_rquotad_service="quotarpc"
+		;;
+	*)
+		echo "Internal error"
+		exit 1
+	esac
+	;;
 
-# SUSE
-#nfs_service="nfsserver"
-#nfslock_service=""
-#nfs_config="/etc/sysconfig/nfs"
+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)
+		nfs_lock_service="nfslock"
+		;;
+	*-suse)
+		nfs_service="nfsserver"
+		;;
+	*-debian)
+		nfs_service="nfs-kernel-server"
+		nfs_config="/etc/default/nfs-kernel-server"
+		nfs_rquotad_config="/etc/default/quota"
+		;;
+	*)
+		echo "Internal error"
+		exit 1
+	esac
+	;;
 
-# Debian
-#nfs_service="nfs-kernel-server"
-#nfslock_service=""
-#nfs_config="/etc/default/nfs-kernel-server"
+*)
+	echo "Internal error"
+	exit 1
+esac
 
 # Override for unit testing
 if [ -z "$PROCFS_PATH" ] ; then
@@ -46,50 +92,70 @@ EOF
     exit 1
 }
 
+##################################################
+
+nfs_load_config ()
+{
+	_config="${1:-${nfs_config}}"
+
+	if [ -r "$_config" ] ; then
+		. "$_config"
+	fi
+}
 
 ##################################################
 # Basic service stop and start
 
 basic_stop ()
 {
-    case "$1" in
+	case "$1" in
 	nfs)
-	    service "$nfs_service" stop
-	    if [ -n "$nfslock_service" ] ; then
-		service "$nfslock_service" stop
-	    fi
-	    ;;
-	nfslock)
-	    if [ -n "$nfslock_service" ] ; then
-		service "$nfslock_service" stop
-	    else
+		if [ -n "$nfs_rquotad_service" ] ; then
+			service "$nfs_rquotad_service" stop
+		fi
+
 		service "$nfs_service" stop
-	    fi
-	    ;;
+
+		if [ -n "$nfs_lock_service" ] ; then
+			service "$nfs_lock_service" stop
+		fi
+		;;
+	nfslock)
+		if [ -n "$nfs_lock_service" ] ; then
+			service "$nfs_lock_service" stop
+		else
+			service "$nfs_service" stop
+		fi
+		;;
 	*)
-	    usage
-    esac
+		usage
+	esac
 }
 
 basic_start ()
 {
-    case "$1" in
+	case "$1" in
 	nfs)
-	    if [ -n "$nfslock_service" ] ; then
-		service "$nfslock_service" start
-	    fi
-	    service "$nfs_service" start
-	    ;;
-	nfslock)
-	    if [ -n "$nfslock_service" ] ; then
-		service "$nfslock_service" start
-	    else
+		if [ -n "$nfs_lock_service" ] ; then
+			service "$nfs_lock_service" start
+		fi
+
 		service "$nfs_service" start
-	    fi
-	    ;;
+
+		if [ -n "$nfs_rquotad_service" ] ; then
+			service "$nfs_rquotad_service" start
+		fi
+		;;
+	nfslock)
+		if [ -n "$nfs_lock_service" ] ; then
+			service "$nfs_lock_service" start
+		else
+			service "$nfs_service" start
+		fi
+		;;
 	*)
-	    usage
-    esac
+		usage
+	esac
 }
 
 ##################################################
@@ -97,32 +163,109 @@ basic_start ()
 
 service_stop ()
 {
-    case "$1" in
+	case "$1" in
 	nfs)
-	    echo 0 >"${PROCFS_PATH}/fs/nfsd/threads"
-	    basic_stop "nfs" >/dev/null 2>&1 || true
-	    pkill -9 nfsd
-	    ;;
+		echo 0 >"${PROCFS_PATH}/fs/nfsd/threads"
+		basic_stop "nfs" >/dev/null 2>&1 || true
+		pkill -9 nfsd
+		;;
 	nlockmgr)
-	    basic_stop "nfslock" >/dev/null 2>&1 || true
-	    ;;
+		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
+		usage
+	esac
 }
 
 service_start ()
 {
-    case "$1" in
+	case "$1" in
 	nfs)
-	    basic_start "nfs"
-	    ;;
+		basic_start "nfs"
+		;;
 	nlockmgr)
-	    basic_start "nfslock"
-	    ;;
+		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
+		usage
+	esac
 }
 
 ##################################################
@@ -149,9 +292,7 @@ nfs_startup ()
 nfs_check_thread_count ()
 {
     # Load NFS configuration to get desired number of threads.
-    if [ -r "$nfs_config" ] ; then
-	. "$nfs_config"
-    fi
+    nfs_load_config
 
     # If $RPCNFSDCOUNT/$USE_KERNEL_NFSD_NUMBER isn't set then we could
     # guess the default from the initscript.  However, let's just
diff --git a/ctdb/config/statd-callout b/ctdb/config/statd-callout
index bf18b5586b3..b75135bbde5 100755
--- a/ctdb/config/statd-callout
+++ b/ctdb/config/statd-callout
@@ -20,7 +20,8 @@ die ()
     exit 1
 }
 
-load_system_config "nfs"
+# Try different variables to find config file for NFS_HOSTNAME
+load_system_config "nfs" "nfs-common"
 
 [ -n "$NFS_HOSTNAME" ] || \
     die "NFS_HOSTNAME is not configured. statd-callout failed"
diff --git a/ctdb/tests/eventscripts/scripts/60.nfs.sh b/ctdb/tests/eventscripts/scripts/60.nfs.sh
index 15670e76910..0b206399d00 100644
--- a/ctdb/tests/eventscripts/scripts/60.nfs.sh
+++ b/ctdb/tests/eventscripts/scripts/60.nfs.sh
@@ -5,6 +5,11 @@ setup ()
 
 	service_name="nfs"
 
+	if [ -z "$CTDB_NFS_DISTRO_STYLE" ] ; then
+		# Currently supported: sysvinit-redhat, systemd-redhat
+		CTDB_NFS_DISTRO_STYLE="sysvinit-redhat"
+	fi
+
 	export FAKE_RPCINFO_SERVICES=""
 
 	setup_script_options <<EOF
@@ -20,8 +25,18 @@ EOF
 Setting up NFS environment: all RPC services up, NFS managed by CTDB
 EOF
 
-		service "nfs" force-started
-		service "nfslock" force-started
+		case "$CTDB_NFS_DISTRO_STYLE" in
+		sysvinit-*)
+			service "nfs" force-started
+			service "nfslock" force-started
+			;;
+		systemd-*)
+			service "nfs-service" force-started
+			service "nfs-mountd" force-started
+			service "rpc-rquotad" force-started
+			service "rpc-statd" force-started
+			;;
+		esac
 
 		rpc_services_up \
 			"portmapper" "nfs" "mountd" "rquotad" \
@@ -34,8 +49,18 @@ EOF
 Setting up NFS environment: all RPC services down, NFS not managed by CTDB
 EOF
 
-		service "nfs" force-stopped
-		service "nfslock" force-stopped
+		case "$CTDB_NFS_DISTRO_STYLE" in
+		sysvinit-*)
+			service "nfs" force-stopped
+			service "nfslock" force-stopped
+			;;
+		systemd-*)
+			service "nfs-server" force-stopped
+			service "nfs-mountd" force-stopped
+			service "rpc-quotad" force-stopped
+			service "rpc-statd" force-stopped
+			;;
+		esac
 	fi
 
 	# This is really nasty.  However, when we test NFS we don't
@@ -103,13 +128,73 @@ guess_output ()
 {
 	case "$1" in
 	$CTDB_NFS_CALLOUT\ start\ nlockmgr)
-		echo "&Starting nfslock: OK"
+		case "$CTDB_NFS_DISTRO_STYLE" in
+		sysvinit-redhat)
+			echo "&Starting nfslock: OK"
+			;;
+		systemd-redhat)
+			echo "&Starting rpc-statd: OK"
+			;;
+		esac
 		;;
 	$CTDB_NFS_CALLOUT\ start\ nfs)
-		cat <<EOF
+		case "$CTDB_NFS_DISTRO_STYLE" in
+		sysvinit-redhat)
+			cat <<EOF
 &Starting nfslock: OK
 &Starting nfs: OK
 EOF
+			;;
+		systemd-redhat)
+			cat <<EOF
+&Starting rpc-statd: OK
+&Starting nfs-server: OK
+&Starting rpc-rquotad: OK
+EOF
+			;;
+		esac
+		;;
+	$CTDB_NFS_CALLOUT\ stop\ mountd)
+		case "$CTDB_NFS_DISTRO_STYLE" in
+		systemd-*)
+			echo "Stopping nfs-mountd: OK"
+			;;
+		esac
+		;;
+	$CTDB_NFS_CALLOUT\ stop\ rquotad)


-- 
Samba Shared Repository



More information about the samba-cvs mailing list