summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2019-03-26 15:07:43 +1100
committerKarolin Seeger <kseeger@samba.org>2019-04-12 07:57:11 +0000
commit14069988a97ce9f32f10e8e851b6739083dc52ff (patch)
treee4ea9bcd66da4c8edca58ceb523f35d5b315dafc
parentaee71ea6863c45467b3e897ce8f5c093d88b8020 (diff)
downloadsamba-14069988a97ce9f32f10e8e851b6739083dc52ff.tar.gz
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@meltin.net> Reviewed-by: Amitay Isaacs <amitay@samba.org> (cherry picked from commit 2833ddcfcb780497264e0f412a9ad6e26a9bc657)
-rw-r--r--ctdb/tests/eventscripts/scripts/60.nfs.sh99
1 files changed, 93 insertions, 6 deletions
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)
+ case "$CTDB_NFS_DISTRO_STYLE" in
+ systemd-redhat)
+ echo "Stopping rpc-rquotad: OK"
+ ;;
+ esac
+ ;;
+ $CTDB_NFS_CALLOUT\ stop\ status)
+ case "$CTDB_NFS_DISTRO_STYLE" in
+ systemd-*)
+ echo "Stopping rpc-statd: OK"
+ ;;
+ esac
+ ;;
+ $CTDB_NFS_CALLOUT\ start\ mountd)
+ case "$CTDB_NFS_DISTRO_STYLE" in
+ systemd-*)
+ echo "&Starting nfs-mountd: OK"
+ ;;
+ esac
+ ;;
+ $CTDB_NFS_CALLOUT\ start\ rquotad)
+ case "$CTDB_NFS_DISTRO_STYLE" in
+ systemd-redhat)
+ echo "&Starting rpc-rquotad: OK"
+ ;;
+ esac
+ ;;
+ $CTDB_NFS_CALLOUT\ start\ status)
+ case "$CTDB_NFS_DISTRO_STYLE" in
+ systemd-*)
+ echo "&Starting rpc-statd: OK"
+ ;;
+ esac
;;
*)
: # Nothing
@@ -202,6 +287,8 @@ program $_rpc_service${_ver:+ version }${_ver} is not available"
echo "Trying to restart service \"${_rpc_service}\"..."\
>>"$_out"
+ guess_output "$service_stop_cmd" >>"$_out"
+
if [ -n "$service_debug_cmd" ] ; then
$service_debug_cmd 2>&1 >>"$_out"
fi