blob: ce3a1bae7f99fdc92edd276e2bedbe5501553ea9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
#!/bin/bash
. $(dirname $0)/../nfs.rc
#
# This test ensures that GlusterFS provides NFS, Mount and its Management daemon
# over both IPv4 and IPv6. It uses netcat to check the services running on both
# IPv4 & IPv6 addresses as well as a mount to test that mount & nfs work.
#
IPV4_SUPPORT=false
IPV6_SUPPORT=false
host $HOSTNAME | grep -q "has address" && IPV4_SUPPORT=true
host $HOSTNAME | grep -q "has IPv6 address" && IPV6_SUPPORT=true
. $(dirname $0)/../include.rc
cleanup;
mkdir -p $B0/b{0,1,2}
# make sure no registered rpcbind services are running
service rpcbind restart
TEST glusterd
TEST pidof glusterd
TEST $CLI vol create $V0 replica 3 $H0:$B0/b0 $H0:$B0/b1 $H0:$B0/b2
TEST $CLI vol set $V0 cluster.self-heal-daemon off
TEST $CLI vol set $V0 nfs.disable off
TEST $CLI vol set $V0 cluster.choose-local off
TEST $CLI vol start $V0
MOUNTD_PORT=38465
MGMTD_PORT=24007
NFSD_PORT=2049
function check_ip_port {
ip=$1
port=$2
type=$3
nc_flags=""
if [ "$type" == "v6" ] && [ "$ip" == "NONE" ]; then
echo "Y"
return
else
nc_flags="-6"
fi
if [ "$type" == "v4" ] && [ "$ip" == "NONE" ]; then
echo "Y"
return
fi
if exec 3<>/dev/tcp/$ip/$port; then
echo "Y"
else
echo "N"
fi
}
function check_nfs {
ip=$1
type=$2
if [ "$ip" == "NONE" ]; then
echo "Y"
return
fi
if [ "$type" == "v6" ]; then
addr="[$ip]"
else
addr="$ip"
fi
if mount_nfs $addr:/$V0 $N0; then
umount_nfs $N0
echo "Y"
else
echo "N"
fi
}
if [ ! $IPV4_SUPPORT ] && [ ! $IPV6_SUPPORT ]; then
exit 1
fi
# Get the V4 & V6 addresses of this host
if $IPV4_SUPPORT; then
V4=$(host $HOSTNAME | head -n1 | awk -F ' ' '{print $4}')
else
V4="NONE"
fi
if $IPV6_SUPPORT; then
V6=$(host $HOSTNAME | tail -n1 | awk -F ' ' '{print $5}')
else
V6="NONE"
fi
# First check the management daemon
EXPECT "Y" check_ip_port $V6 $MGMTD_PORT "v6"
EXPECT "Y" check_ip_port $V4 $MGMTD_PORT "v4"
# Give the MOUNT/NFS Daemon some time to start up
sleep 4
EXPECT "Y" check_ip_port $V4 $MOUNTD_PORT "v6"
EXPECT "Y" check_ip_port $V6 $MOUNTD_PORT "v4"
EXPECT "Y" check_ip_port $V4 $NFSD_PORT "v6"
EXPECT "Y" check_ip_port $V6 $NFSD_PORT "v4"
# Mount the file system
EXPECT "Y" check_nfs $V6 "v6"
EXPECT "Y" check_nfs $V4 "v4"
# Test a rpcbind crash
pkill -9 rpcbind && service rpcbind start
sleep 15
# Test that the port re-registered
rpcinfo=$(rpcinfo -s | grep nfs | grep -v nfs_acl)
function check_rpcinfo {
support=$1
type=$2
if [ ! $support ]; then
echo "Y"
return
fi
if [ "$type" == "v6" ]; then
echo $(echo $rpcinfo | grep tcp6 && echo "Y" || echo "N")
else
echo $(echo $rpcinfo | grep tcp && echo "Y" || echo "N")
fi
}
EXPECT "Y" check_rpcinfo $IPV4_SUPPORT "v4"
EXPECT "Y" check_rpcinfo $IPV6_SUPPORT "v6"
cleanup;
|