@ -3,6 +3,9 @@ TEST_DESCRIPTION="root filesystem on NFS"
@@ -3,6 +3,9 @@ TEST_DESCRIPTION="root filesystem on NFS"
KVERSION=${KVERSION-$(uname -r)}
# Uncomment this to debug failures
#DEBUGFAIL="rdinitdebug rdnetdebug"
run_server() {
# Start server first
echo "NFS TEST SETUP: Starting DHCP/NFS server"
@ -40,7 +43,7 @@ client_test() {
@@ -40,7 +43,7 @@ client_test() {
-net nic,macaddr=$mac,model=e1000 \
-net socket,mcast=230.0.0.1:1234 \
-kernel /boot/vmlinuz-$KVERSION \
-append "$cmdline rw quiet console=ttyS0,115200n81" \
-append "$cmdline $DEBUGFAIL ro quiet console=ttyS0,115200n81" \
-initrd initramfs.testing
if [[ $? -eq 0 ]] && grep -m 1 -q nfs-OK client.img; then
@ -58,12 +61,50 @@ test_run() {
@@ -58,12 +61,50 @@ test_run() {
return 1
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() {
# 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
mkdir mnt
sudo mount -o loop server.ext2 mnt
@ -75,7 +116,7 @@ test_setup() {
@@ -75,7 +116,7 @@ test_setup() {
dracut_install sh ls shutdown poweroff stty cat ps ln ip \
/lib/terminfo/l/linux dmesg mkdir cp ping exportfs \
rpcbind modprobe rpc.nfsd rpc.mountd dhcpd showmount tcpdump \
/etc/netconfig /etc/services sleep
/etc/netconfig /etc/services sleep mount
instmods nfsd sunrpc
inst ./server-init /sbin/init
inst ./hosts /etc/hosts
@ -83,14 +124,14 @@ test_setup() {
@@ -83,14 +124,14 @@ test_setup() {
inst ./dhcpd.conf /etc/dhcpd.conf
(
cd "$initdir";
mkdir -p dev sys proc etc var/run tmp var/lib/{dhcpd,rpcbind,nfs}
mkdir -p var/lib/nfs/v4recovery
mkdir -p dev sys proc etc var/run tmp var/lib/{dhcpd,rpcbind}
mkdir -p var/lib/nfs/{v4recovery,rpc_pipefs}
chmod 777 var/lib/rpcbind var/lib/nfs
)
inst /etc/nsswitch.conf /etc/nsswitch.conf
inst /etc/passwd /etc/passwd
inst /etc/group /etc/group
for i in /lib*/libnss_files*;do
for i in /lib*/libnss_files**;do
inst_library $i
done