glusterfs/tests/nfs.rc

71 lines
1.9 KiB
Plaintext
Raw Normal View History

#!/bin/bash
# Due to portmap registration NFS takes some time to
# export all volumes. Therefore tests should start only
# after exports are visible by showmount command. This
# routine will check if showmount shows the exports or not
#
function is_nfs_export_available ()
{
local vol=$1
if [ "$vol" == "" ]; then
vol=$V0
fi
exp=$(showmount -e localhost 2> /dev/null | grep $vol | wc -l)
echo "$exp"
}
function mount_nfs ()
{
local e=$1
local m=$2
local opt=$3
if [ ! -z "$opt" ]; then opt=",$opt"; fi
2014-08-19 17:55:46 +02:00
opt="soft,intr,vers=3$opt"
nopt=""
for o in ${opt//,/ }; do
2014-08-19 17:55:46 +02:00
case $OSTYPE in
NetBSD)
test "x${nopt}" = "x" && nopt="tcp,-R=2,"
2014-08-19 17:55:46 +02:00
case $o in
nolock|noac|actimeo=*|mountproto=udp)
continue
;;
proto=tcp)
o="tcp"
;;
vers=3)
o="nfsv3"
;;
retry=*)
o=${o/retry=/-R}
;;
timeo=*)
o=${o/timeo=/-t}
;;
retrans=*)
o=${o/retrans=/-x}
;;
*)
;;
esac
2014-08-19 17:55:46 +02:00
;;
*)
;;
esac
if [ ! -z "$nopt" ]; then nopt="${nopt},"; fi
nopt="${nopt}$o"
done
mount -t nfs -o $nopt $e $m
}
2014-08-19 17:55:46 +02:00
function umount_nfs {
${UMOUNT_F} $1
2014-08-19 17:55:46 +02:00
if [ $? -eq 0 ]; then echo "Y"; else echo "N"; fi
}