Browse Source

NFS test: additional option tests

Test additional combinations of command line and DHCP option formats. This
is by no means the complete list, but gets us started with some common ones.
master
David Dillow 16 years ago
parent
commit
ae227ca836
  1. 50
      test/TEST-20-NFS/dhcpd.conf
  2. 3
      test/TEST-20-NFS/server-init
  3. 55
      test/TEST-20-NFS/test.sh

50
test/TEST-20-NFS/dhcpd.conf

@ -20,4 +20,54 @@ subnet 192.168.50.0 netmask 255.255.255.0 {
fixed-address 192.168.50.101; fixed-address 192.168.50.101;
} }
} }

group {
# NFSv3 root=dhcp or root={/dev/,}nfs, use given IP
option root-path "192.168.50.1:/nfs/client";

host nfs3-2 {
hardware ethernet 52:54:00:12:34:01;
fixed-address 192.168.50.101;
}
}

group {
# NFSv3 root=dhcp, use protocol from root-path
option root-path "nfs:192.168.50.1:/nfs/client";

host nfs3-3 {
hardware ethernet 52:54:00:12:34:02;
fixed-address 192.168.50.101;
}
}

group {
# NFSv4 root={/dev/,}nfs4, use server-id
option root-path "/client";

host nfs4-1 {
hardware ethernet 52:54:00:12:34:03;
fixed-address 192.168.50.101;
}
}

group {
# NFSv4 root={/dev/,}nfs4, use given IP
option root-path "192.168.50.1:/client";

host nfs4-2 {
hardware ethernet 52:54:00:12:34:04;
fixed-address 192.168.50.101;
}
}

group {
# NFSv4 root=dhcp, use profocol from root-path
option root-path "nfs4:192.168.50.1:/client";

host nfs4-3 {
hardware ethernet 52:54:00:12:34:05;
fixed-address 192.168.50.101;
}
}
} }

3
test/TEST-20-NFS/server-init

@ -8,8 +8,11 @@ ip addr add 127.0.0.1/8 dev lo
ip link set lo up ip link set lo up
ip addr add 192.168.50.1/24 dev eth0 ip addr add 192.168.50.1/24 dev eth0
ip link set eth0 up ip link set eth0 up
modprobe sunrpc
mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs
rpcbind rpcbind
modprobe nfsd modprobe nfsd
mount -t nfsd nfsd /proc/fs/nfsd
exportfs -r exportfs -r
rpc.nfsd rpc.nfsd
rpc.mountd rpc.mountd

55
test/TEST-20-NFS/test.sh

@ -3,6 +3,9 @@ TEST_DESCRIPTION="root filesystem on NFS"


KVERSION=${KVERSION-$(uname -r)} KVERSION=${KVERSION-$(uname -r)}


# Uncomment this to debug failures
#DEBUGFAIL="rdinitdebug rdnetdebug"

run_server() { run_server() {
# Start server first # Start server first
echo "NFS TEST SETUP: Starting DHCP/NFS server" echo "NFS TEST SETUP: Starting DHCP/NFS server"
@ -40,7 +43,7 @@ client_test() {
-net nic,macaddr=$mac,model=e1000 \ -net nic,macaddr=$mac,model=e1000 \
-net socket,mcast=230.0.0.1:1234 \ -net socket,mcast=230.0.0.1:1234 \
-kernel /boot/vmlinuz-$KVERSION \ -kernel /boot/vmlinuz-$KVERSION \
-append "$cmdline rw quiet console=ttyS0,115200n81" \ -append "$cmdline $DEBUGFAIL ro quiet console=ttyS0,115200n81" \
-initrd initramfs.testing -initrd initramfs.testing


if [[ $? -eq 0 ]] && grep -m 1 -q nfs-OK client.img; then if [[ $? -eq 0 ]] && grep -m 1 -q nfs-OK client.img; then
@ -58,12 +61,50 @@ test_run() {
return 1 return 1
fi fi


client_test "NFSv3 root=dhcp" 52:54:00:12:34:00 "root=dhcp" || return 1 client_test "NFSv3 root=dhcp DHCP path only" 52:54:00:12:34:00 \
"root=dhcp" || return 1

client_test "NFSv3 root=nfs DHCP path only" 52:54:00:12:34:00 \
"root=nfs" || return 1

client_test "NFSv3 root=/dev/nfs DHCP path only" 52:54:00:12:34:00 \
"root=/dev/nfs" || return 1

client_test "NFSv3 root=dhcp DHCP IP:path" 52:54:00:12:34:01 \
"root=dhcp" || return 1

client_test "NFSv3 root=nfs DHCP IP:path" 52:54:00:12:34:01 \
"root=nfs" || return 1

client_test "NFSv3 root=/dev/nfs DHCP IP:path" 52:54:00:12:34:01 \
"root=/dev/nfs" || return 1

client_test "NFSv3 root=dhcp DHCP proto:IP:path" 52:54:00:12:34:02 \
"root=dhcp" || return 1

# There is a mandatory 90 second recovery when starting the NFSv4
# server, so put these later in the list to avoid a pause when doing
# switch_root

client_test "NFSv4 root=nfs4 DHCP path only" 52:54:00:12:34:03 \
"root=nfs4" || return 1

client_test "NFSv4 root=/dev/nfs4 DHCP path only" 52:54:00:12:34:03 \
"root=/dev/nfs4" || return 1

client_test "NFSv4 root=nfs4 DHCP IP:path" 52:54:00:12:34:04 \
"root=nfs4" || return 1

client_test "NFSv4 root=/dev/nfs4 DHCP IP:path" 52:54:00:12:34:04 \
"root=/dev/nfs4" || return 1

client_test "NFSv4 root=dhcp DHCP proto:IP:path" 52:54:00:12:34:05 \
"root=dhcp" || return 1
} }


test_setup() { test_setup() {
# Make server root # Make server root
dd if=/dev/zero of=server.ext2 bs=1M count=20 dd if=/dev/zero of=server.ext2 bs=1M count=30
mke2fs -F server.ext2 mke2fs -F server.ext2
mkdir mnt mkdir mnt
sudo mount -o loop server.ext2 mnt sudo mount -o loop server.ext2 mnt
@ -75,7 +116,7 @@ test_setup() {
dracut_install sh ls shutdown poweroff stty cat ps ln ip \ dracut_install sh ls shutdown poweroff stty cat ps ln ip \
/lib/terminfo/l/linux dmesg mkdir cp ping exportfs \ /lib/terminfo/l/linux dmesg mkdir cp ping exportfs \
rpcbind modprobe rpc.nfsd rpc.mountd dhcpd showmount tcpdump \ rpcbind modprobe rpc.nfsd rpc.mountd dhcpd showmount tcpdump \
/etc/netconfig /etc/services sleep /etc/netconfig /etc/services sleep mount
instmods nfsd sunrpc instmods nfsd sunrpc
inst ./server-init /sbin/init inst ./server-init /sbin/init
inst ./hosts /etc/hosts inst ./hosts /etc/hosts
@ -83,14 +124,14 @@ test_setup() {
inst ./dhcpd.conf /etc/dhcpd.conf inst ./dhcpd.conf /etc/dhcpd.conf
( (
cd "$initdir"; cd "$initdir";
mkdir -p dev sys proc etc var/run tmp var/lib/{dhcpd,rpcbind,nfs} mkdir -p dev sys proc etc var/run tmp var/lib/{dhcpd,rpcbind}
mkdir -p var/lib/nfs/v4recovery mkdir -p var/lib/nfs/{v4recovery,rpc_pipefs}
chmod 777 var/lib/rpcbind var/lib/nfs chmod 777 var/lib/rpcbind var/lib/nfs
) )
inst /etc/nsswitch.conf /etc/nsswitch.conf inst /etc/nsswitch.conf /etc/nsswitch.conf
inst /etc/passwd /etc/passwd inst /etc/passwd /etc/passwd
inst /etc/group /etc/group inst /etc/group /etc/group
for i in /lib*/libnss_files*;do for i in /lib*/libnss_files**;do
inst_library $i inst_library $i
done done



Loading…
Cancel
Save