From: Alex Deiter Date: Mon, 7 Nov 2022 17:47:21 +0000 (+0400) Subject: LU-14294 tests: fixed NFS configuration issue X-Git-Tag: 2.15.56~79 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;ds=sidebyside;h=refs%2Fchanges%2F62%2F49062%2F46;p=fs%2Flustre-release.git LU-14294 tests: fixed NFS configuration issue * Used the systemctl command to manage system services * Used the same order of parameters to setup and cleanup NFS * Used tab for indentation Test-Parameters: trivial clientdistro=el7.9 \ testlist=parallel-scale-nfsv3,parallel-scale-nfsv4 Test-Parameters: clientdistro=el8.7 \ testlist=parallel-scale-nfsv3,parallel-scale-nfsv4 Test-Parameters: clientdistro=el9.0 \ testlist=parallel-scale-nfsv3,parallel-scale-nfsv4 Test-Parameters: clientdistro=sles12sp5 \ testlist=parallel-scale-nfsv3,parallel-scale-nfsv4 Test-Parameters: clientdistro=sles15sp4 \ testlist=parallel-scale-nfsv3,parallel-scale-nfsv4 Test-Parameters: clientdistro=ubuntu2004 \ testlist=parallel-scale-nfsv3,parallel-scale-nfsv4 Test-Parameters: clientdistro=ubuntu2204 \ testlist=parallel-scale-nfsv3,parallel-scale-nfsv4 Change-Id: I6b087035ac7524aa99c0facad48f8c3fb7444cbc Signed-off-by: Alex Deiter Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49062 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Jian Yu Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/parallel-scale-nfs.sh b/lustre/tests/parallel-scale-nfs.sh index 34ca53e..9b4627e 100755 --- a/lustre/tests/parallel-scale-nfs.sh +++ b/lustre/tests/parallel-scale-nfs.sh @@ -47,7 +47,8 @@ cleanup_exit () { } cleanup () { - cleanup_nfs "$NFS_CLIMNTPT" "$LUSTRE_CLIENT_NFSSRV" "$NFS_CLIENTS" || + cleanup_nfs "$LUSTRE_CLIENT_NFSSRV" "$NFS_SRVMNTPT" \ + "$NFS_CLIENTS" "$NFS_CLIMNTPT" || \ error_noexit false "failed to cleanup nfs" zconf_umount $LUSTRE_CLIENT_NFSSRV $NFS_SRVMNTPT force || error_noexit false "failed to umount lustre on"\ @@ -63,8 +64,8 @@ zconf_mount $LUSTRE_CLIENT_NFSSRV $NFS_SRVMNTPT "$cl_mnt_opt" || error "mount lustre on $LUSTRE_CLIENT_NFSSRV failed" # setup the nfs -setup_nfs "$NFSVERSION" "$NFS_SRVMNTPT" "$LUSTRE_CLIENT_NFSSRV" \ - "$NFS_CLIENTS" "$NFS_CLIMNTPT" || +setup_nfs "$LUSTRE_CLIENT_NFSSRV" "$NFS_SRVMNTPT" "$NFS_CLIENTS" \ + "$NFS_CLIMNTPT" "$NFSVERSION" || \ error false "setup nfs failed!" NFSCLIENT=true @@ -101,6 +102,10 @@ MPI_RUNAS=${MPI_RUNAS:-"runas -u $MPI_USER_UID -g $MPI_USER_GID"} $GSS_KRB5 && refresh_krb5_tgt $MPI_USER_UID $MPI_USER_GID $MPI_RUNAS test_compilebench() { + if [[ "$TESTSUITE" =~ "parallel-scale-nfs" ]]; then + skip "LU-12957 and LU-13068: compilebench for $TESTSUITE" + fi + run_compilebench $TESTDIR } run_test compilebench "compilebench" diff --git a/lustre/tests/setup-nfs.sh b/lustre/tests/setup-nfs.sh index ab3afff..eb6720f 100755 --- a/lustre/tests/setup-nfs.sh +++ b/lustre/tests/setup-nfs.sh @@ -1,77 +1,48 @@ #!/bin/bash -#set -x -EXPORT_OPTS=${EXPORT_OPTS:-"rw,async,no_root_squash"} -setup_nfs() { - local NFS_VER=${1} - local MNTPNT=${2} - local LUSTRE_CLIENT=${3} - local NFS_CLIENTS=${4} - local nfs_climntpt=${5:-$MNTPNT} - - local export_opts_v=$EXPORT_OPTS - - echo "Exporting Lustre filesystem..." - - if [ "$NFS_VER" = "4" ]; then - export_opts_v="$EXPORT_OPTS,fsid=0" - do_nodes $LUSTRE_CLIENT "mkdir -p /var/lib/nfs/v4recovery" - fi - - do_nodes $LUSTRE_CLIENT,$NFS_CLIENTS "grep -q rpc_pipefs' ' /proc/mounts ||\ - { mkdir -p /var/lib/nfs/rpc_pipefs && \ - mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs; }" || return 1 - sleep 5 - - # get rid of old $MNTPNT entries in /etc/exports - do_nodes $LUSTRE_CLIENT "sed -i '/${MNTPNT##*/}/d' /etc/exports && - echo $MNTPNT *\($export_opts_v\) >> /etc/exports" || - return 1 - - # restart nfs server according to distro - do_nodes $LUSTRE_CLIENT "{ [[ -e /etc/SuSE-release ]] && - service nfsserver restart; } || - service nfs restart || - service nfs-server restart" || return 1 +DEFAULT_NFS_OPTIONS=${DEFAULT_NFS_OPTIONS:-"rw,async,no_root_squash"} +DEFAULT_EXPORTS_FILE=${DEFAULT_EXPORTS_FILE:-"/etc/exports.d/lustre.exports"} - do_nodes $NFS_CLIENTS "chkconfig --list rpcidmapd 2>/dev/null | - grep -q rpcidmapd && service rpcidmapd restart || - true" - - echo -e "\nMounting NFS clients (version $NFS_VER)..." +setup_nfs() { + local LUSTRE_CLIENT=$1 + local LUSTRE_MOUNT_POINT=$2 + local NFS_CLIENTS=$3 + local NFS_MOUNT_POINT=$4 + local NFS_VERSION=$5 + local EXPORTS_FILE=$DEFAULT_EXPORTS_FILE + local NFS_OPTIONS=$DEFAULT_NFS_OPTIONS + + echo "Exporting Lustre filesystem via NFS version $NFS_VERSION" + do_nodes "$LUSTRE_CLIENT" \ + "echo '$LUSTRE_MOUNT_POINT *($NFS_OPTIONS)' | \ + tee $EXPORTS_FILE" || return 1 + do_nodes "$LUSTRE_CLIENT" "systemctl restart nfs-server" || return 1 + do_nodes "$LUSTRE_CLIENT" "systemctl restart nfs-idmapd" || return 1 + + echo "Mounting NFS clients version $NFS_VERSION" + do_nodes "$NFS_CLIENTS" "systemctl restart nfs-idmapd" || return 1 + do_nodes "$NFS_CLIENTS" "mkdir -p $NFS_MOUNT_POINT" || return 1 + do_nodes "$NFS_CLIENTS" \ + "mount -v -t nfs -o nfsvers=$NFS_VERSION,async \ + $LUSTRE_CLIENT:$LUSTRE_MOUNT_POINT \ + $NFS_MOUNT_POINT" || return 1 - do_nodes $NFS_CLIENTS "mkdir -p $nfs_climntpt" || return 1 - if [ "$NFS_VER" = "4" ]; then - do_nodes $NFS_CLIENTS \ - "mount -t nfs$NFS_VER -o async \ - $LUSTRE_CLIENT:/ $nfs_climntpt" || return 1 - else - do_nodes $NFS_CLIENTS \ - "mount -t nfs -o nfsvers=$NFS_VER,async \ - $LUSTRE_CLIENT:$MNTPNT $nfs_climntpt" || return 1 - fi return 0 } cleanup_nfs() { - local MNTPNT=${1} - local LUSTRE_CLIENT=${2} - local NFS_CLIENTS=${3} - - echo -e "\nUnmounting NFS clients..." - do_nodes $NFS_CLIENTS "umount -f $MNTPNT" || true - - echo -e "\nUnexporting Lustre filesystem..." - do_nodes $NFS_CLIENTS "chkconfig --list rpcidmapd 2>/dev/null | - grep -q rpcidmapd && service rpcidmapd stop || - true" - - do_nodes $LUSTRE_CLIENT "{ [[ -e /etc/SuSE-release ]] && - service nfsserver stop; } || - service nfs stop || - service nfs-server stop" || return 1 - - do_nodes $LUSTRE_CLIENT "sed -i '/${MNTPNT##*/}/d' /etc/exports" || return 1 - - do_nodes $LUSTRE_CLIENT "exportfs -v" + local LUSTRE_CLIENT=$1 + local LUSTRE_MOUNT_POINT=$2 + local NFS_CLIENTS=$3 + local NFS_MOUNT_POINT=$4 + local EXPORTS_FILE=$DEFAULT_EXPORTS_FILE + + echo "Unmounting NFS clients" + do_nodes "$NFS_CLIENTS" "umount -v -f $NFS_MOUNT_POINT" || return 1 + do_nodes "$NFS_CLIENTS" "systemctl stop nfs-idmapd" || return 1 + + echo "Unexporting Lustre filesystem" + do_nodes "$LUSTRE_CLIENT" "systemctl stop nfs-server" || return 1 + do_nodes "$LUSTRE_CLIENT" "systemctl stop nfs-idmapd" || return 1 + do_nodes "$LUSTRE_CLIENT" "rm -v $EXPORTS_FILE" || return 1 }