2 TEST_DESCRIPTION
="root filesystem on NFS with multiple nics"
4 KVERSION
=${KVERSION-$(uname -r)}
6 # Uncomment this to debug failures
11 echo "MULTINIC TEST SETUP: Starting DHCP/NFS server"
13 $testdir/run-qemu
-hda server.ext2
-m 256M
-nographic \
14 -net nic
,macaddr
=52:54:00:12:34:56,model
=e1000 \
15 -net socket
,mcast
=230.0.0.1:1234 \
16 -serial udp
:127.0.0.1:9999 \
17 -kernel /boot
/vmlinuz-
$KVERSION \
18 -append "selinux=0 root=/dev/sda rdinitdebug rdinfo rdnetdebug rw quiet console=ttyS0,115200n81" \
19 -initrd initramfs.server
-pidfile server.pid
-daemonize ||
return 1
20 sudo
chmod 644 server.pid ||
return 1
22 # Cleanup the terminal if we have one
25 echo Sleeping
10 seconds to give the server a
head start
37 echo "CLIENT TEST START: $test_name"
39 # Need this so kvm-qemu will boot (needs non-/dev/zero local disk)
40 if ! dd if=/dev
/zero of
=client.img bs
=1M count
=1; then
41 echo "Unable to make client sda image" 1>&2
45 $testdir/run-qemu
-hda client.img
-m 512M
-nographic \
46 -net nic
,macaddr
=52:54:00:12:34:$mac1,model
=e1000 \
47 -net nic
,macaddr
=52:54:00:12:34:$mac2,model
=e1000 \
48 -net nic
,macaddr
=52:54:00:12:34:$mac3,model
=e1000 \
49 -net socket
,mcast
=230.0.0.1:1234 \
50 -kernel /boot
/vmlinuz-
$KVERSION \
51 -append "$cmdline $DEBUGFAIL rdinitdebug rdinfo rdnetdebug ro quiet console=ttyS0,115200n81 selinux=0 rdshell rdcopystate" \
52 -initrd initramfs.testing
54 if [[ $?
-ne 0 ]] ||
! grep -m 1 -q OK client.img
; then
55 echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
62 if ! grep -m 1 -q $i client.img
; then
63 echo "CLIENT TEST END: $test_name [FAILED - BAD IF]"
68 echo "CLIENT TEST END: $test_name [OK]"
75 echo "Failed to start server" 1>&2
79 # Mac Numbering Scheme
80 # ...:00-02 receive IP adresses all others don't
81 # ...:02 receives a dhcp root-path
84 client_test
"MULTINIC root=nfs BOOTIF=" \
86 "root=nfs:192.168.50.1:/nfs/client BOOTIF=52-54-00-12-34-00" \
89 # PXE Style BOOTIF= with dhcp root-path
90 client_test
"MULTINIC root=dhcp BOOTIF=" \
92 "root=dhcp BOOTIF=52-54-00-12-34-02" \
95 # Multinic case, where only one nic works
96 client_test
"MULTINIC root=nfs ip=dhcp" \
98 "root=nfs:192.168.50.1:/nfs/client ip=dhcp" \
101 # Require two interfaces
102 client_test
"MULTINIC root=nfs ip=eth1:dhcp ip=eth2:dhcp bootdev=eth1" \
104 "root=nfs:192.168.50.1:/nfs/client ip=eth1:dhcp ip=eth2:dhcp bootdev=eth1" \
105 "eth1 eth2" ||
return 1
107 # Require three interfaces with dhcp root-path
108 client_test
"MULTINIC root=dhcp ip=eth0:dhcp ip=eth1:dhcp ip=eth2:dhcp bootdev=eth2" \
110 "root=dhcp ip=eth0:dhcp ip=eth1:dhcp ip=eth2:dhcp bootdev=eth2" \
111 "eth0 eth1 eth2" ||
return 1
116 dd if=/dev
/zero of
=server.ext2 bs
=1M count
=60
117 mke2fs
-F server.ext2
119 sudo mount
-o loop server.ext2 mnt
124 .
$basedir/dracut-functions
125 dracut_install sh
ls shutdown poweroff stty
cat ps
ln ip \
126 /lib
/terminfo
/l
/linux dmesg mkdir
cp ping exportfs \
127 modprobe rpc.nfsd rpc.mountd showmount tcpdump \
128 /etc
/services
sleep mount
chmod
129 which portmap
>/dev
/null
2>&1 && dracut_install portmap
130 which rpcbind
>/dev
/null
2>&1 && dracut_install rpcbind
131 [ -f /etc
/netconfig
] && dracut_install
/etc
/netconfig
132 which dhcpd
>/dev
/null
2>&1 && dracut_install dhcpd
133 [ -x /usr
/sbin
/dhcpd3
] && inst
/usr
/sbin
/dhcpd3
/usr
/sbin
/dhcpd
134 instmods nfsd sunrpc ipv6
135 inst .
/server-init
/sbin
/init
136 inst .
/hosts
/etc
/hosts
137 inst .
/exports
/etc
/exports
138 inst .
/dhcpd.conf
/etc
/dhcpd.conf
139 dracut_install
/etc
/nsswitch.conf
/etc
/rpc
/etc
/protocols
140 dracut_install rpc.idmapd
/etc
/idmapd.conf
141 if ldd $
(which rpc.idmapd
) |
grep -q lib64
; then
147 dracut_install $
(ls {/usr
,}$LIBDIR/libnfsidmap
*.so
* 2>/dev
/null
)
148 dracut_install $
(ls {/usr
,}$LIBDIR/libnss
*.so
2>/dev
/null
)
151 mkdir
-p dev sys proc etc var
/run tmp var
/lib
/{dhcpd
,rpcbind
}
152 mkdir
-p var
/lib
/nfs
/{v4recovery
,rpc_pipefs
}
153 chmod 777 var
/lib
/rpcbind var
/lib
/nfs
155 inst
/etc
/nsswitch.conf
/etc
/nsswitch.conf
156 inst
/etc
/passwd
/etc
/passwd
157 inst
/etc
/group
/etc
/group
158 for i
in /lib
*/libnss_files
**;do
162 /sbin
/depmod
-a -b "$initdir" $kernel
163 cp -a /etc
/ld.so.conf
* $initdir/etc
164 sudo ldconfig
-r "$initdir"
167 # Make client root inside server root
168 initdir
=mnt
/nfs
/client
172 .
$basedir/dracut-functions
173 dracut_install sh shutdown poweroff stty
cat ps
ln ip \
174 /lib
/terminfo
/l
/linux mount dmesg mkdir \
176 inst .
/client-init
/sbin
/init
179 mkdir
-p dev sys proc etc
180 mkdir
-p var
/lib
/nfs
/rpc_pipefs
182 inst
/etc
/nsswitch.conf
/etc
/nsswitch.conf
183 inst
/etc
/passwd
/etc
/passwd
184 inst
/etc
/group
/etc
/group
185 for i
in /lib
*/libnss_files
*;do
189 cp -a /etc
/ld.so.conf
* $initdir/etc
190 sudo ldconfig
-r "$initdir"
196 # Make an overlay with needed tools for the test harness
200 .
$basedir/dracut-functions
201 dracut_install poweroff shutdown
202 inst_simple .
/hard-off.sh
/emergency
/01hard-off.sh
203 inst_simple .
/99-idesymlinks.rules
/etc
/udev
/rules.d
/99-idesymlinks.rules
206 # Make server's dracut image
207 $basedir/dracut
-l -i overlay
/ \
208 -m "dash udev-rules base rootfs-block debug kernel-modules" \
209 -d "piix ide-gd_mod ata_piix ext2 sd_mod e1000" \
210 -f initramfs.server
$KVERSION ||
return 1
212 # Make client's dracut image
213 $basedir/dracut
-l -i overlay
/ \
216 -d "piix ide-gd_mod e1000 nfs sunrpc" \
217 -f initramfs.testing
$KVERSION ||
return 1
221 if [[ -s server.pid
]]; then
222 sudo
kill -TERM $
(cat server.pid
)
226 rm -f server.ext2 client.img initramfs.server initramfs.testing
229 .
$testdir/test-functions