- Use 'getfattr' properly avoid redundant options during xattr query - Untabify certain parts of tests (remove tabs) - Avoid backtick evaluation for certain values to make code more portable. - Use awk on FreeBSD/Darwin, since 'wc' implementation is broken and adds spurious spaces in its output. Change-Id: I7dcc0b70874e43b4cda8c306ed18a31b7a3f990a BUG: 1131713 Signed-off-by: Harshavardhana <harsha@harshavardhana.net> Reviewed-on: http://review.gluster.org/8520 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Emmanuel Dreyfus <manu@netbsd.org> Tested-by: Emmanuel Dreyfus <manu@netbsd.org>
71 lines
1.9 KiB
Bash
71 lines
1.9 KiB
Bash
#!/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
|
|
opt="soft,intr,vers=3$opt"
|
|
|
|
nopt=""
|
|
for o in ${opt//,/ }; do
|
|
case $OSTYPE in
|
|
NetBSD)
|
|
test "x${nopt}" = "x" && nopt="tcp,"
|
|
|
|
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
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
if [ ! -z "$nopt" ]; then nopt="${nopt},"; fi
|
|
nopt="${nopt}$o"
|
|
done
|
|
|
|
mount -t nfs -o $nopt $e $m
|
|
}
|
|
|
|
function umount_nfs {
|
|
umount -f $1
|
|
if [ $? -eq 0 ]; then echo "Y"; else echo "N"; fi
|
|
}
|