* [PATCH 01/11] NFS test: verify that we used the right IP to get to the server
[not found] ` <cover.1244435634.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
@ 2009-06-08 4:40 ` David Dillow
2009-06-08 4:40 ` [PATCH 02/11] NFS test: add support for checking mount options used David Dillow
` (10 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: David Dillow @ 2009-06-08 4:40 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: David Dillow
---
test/TEST-20-NFS/client-init | 6 ++++-
test/TEST-20-NFS/dhcpd.conf | 8 +++---
test/TEST-20-NFS/hosts | 2 +
test/TEST-20-NFS/server-init | 2 +
test/TEST-20-NFS/test.sh | 46 ++++++++++++++++++++++++++---------------
5 files changed, 42 insertions(+), 22 deletions(-)
diff --git a/test/TEST-20-NFS/client-init b/test/TEST-20-NFS/client-init
index c0149b9..00fa3c9 100755
--- a/test/TEST-20-NFS/client-init
+++ b/test/TEST-20-NFS/client-init
@@ -4,6 +4,10 @@ export TERM=linux
export PS1='initramfs-test:\w\$ '
stty sane
echo "made it to the rootfs! Powering down."
+while read dev fs fstype opts rest; do
+ [ "$fstype" != "nfs" -a "$fstype" != "nfs4" ] && continue
+ echo "nfs-OK $dev $fstype $opts" > /dev/sda
+ break
+done < /proc/mounts
#sh -i
-echo nfs-OK > /dev/sda
poweroff -f
diff --git a/test/TEST-20-NFS/dhcpd.conf b/test/TEST-20-NFS/dhcpd.conf
index 14fee3e..a756195 100644
--- a/test/TEST-20-NFS/dhcpd.conf
+++ b/test/TEST-20-NFS/dhcpd.conf
@@ -23,7 +23,7 @@ subnet 192.168.50.0 netmask 255.255.255.0 {
group {
# NFSv3 root=dhcp or root={/dev/,}nfs, use given IP
- option root-path "192.168.50.1:/nfs/client";
+ option root-path "192.168.50.2:/nfs/client";
host nfs3-2 {
hardware ethernet 52:54:00:12:34:01;
@@ -33,7 +33,7 @@ subnet 192.168.50.0 netmask 255.255.255.0 {
group {
# NFSv3 root=dhcp, use protocol from root-path
- option root-path "nfs:192.168.50.1:/nfs/client";
+ option root-path "nfs:192.168.50.3:/nfs/client";
host nfs3-3 {
hardware ethernet 52:54:00:12:34:02;
@@ -53,7 +53,7 @@ subnet 192.168.50.0 netmask 255.255.255.0 {
group {
# NFSv4 root={/dev/,}nfs4, use given IP
- option root-path "192.168.50.1:/client";
+ option root-path "192.168.50.2:/client";
host nfs4-2 {
hardware ethernet 52:54:00:12:34:04;
@@ -63,7 +63,7 @@ subnet 192.168.50.0 netmask 255.255.255.0 {
group {
# NFSv4 root=dhcp, use profocol from root-path
- option root-path "nfs4:192.168.50.1:/client";
+ option root-path "nfs4:192.168.50.3:/client";
host nfs4-3 {
hardware ethernet 52:54:00:12:34:05;
diff --git a/test/TEST-20-NFS/hosts b/test/TEST-20-NFS/hosts
index 5aca4ed..f8c18b6 100644
--- a/test/TEST-20-NFS/hosts
+++ b/test/TEST-20-NFS/hosts
@@ -1,5 +1,7 @@
127.0.0.1 localhost
192.168.50.1 server
+192.168.50.2 server-ip
+192.168.50.3 server-proto-ip
192.168.50.100 workstation1
192.168.50.101 workstation2
192.168.50.102 workstation3
diff --git a/test/TEST-20-NFS/server-init b/test/TEST-20-NFS/server-init
index f6d3891..67af8fa 100755
--- a/test/TEST-20-NFS/server-init
+++ b/test/TEST-20-NFS/server-init
@@ -7,6 +7,8 @@ echo server > /proc/sys/kernel/hostname
ip addr add 127.0.0.1/8 dev lo
ip link set lo up
ip addr add 192.168.50.1/24 dev eth0
+ip addr add 192.168.50.2/24 dev eth0
+ip addr add 192.168.50.3/24 dev eth0
ip link set eth0 up
modprobe sunrpc
mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs
diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh
index 7fcc47b..77ec22a 100755
--- a/test/TEST-20-NFS/test.sh
+++ b/test/TEST-20-NFS/test.sh
@@ -30,6 +30,8 @@ client_test() {
local test_name="$1"
local mac=$2
local cmdline="$3"
+ local server="$4"
+ local nfsinfo
echo "CLIENT TEST START: $test_name"
@@ -46,13 +48,23 @@ client_test() {
-append "$cmdline $DEBUGFAIL ro quiet console=ttyS0,115200n81" \
-initrd initramfs.testing
- if [[ $? -eq 0 ]] && grep -m 1 -q nfs-OK client.img; then
- echo "CLIENT TEST END: $test_name [OK]"
- return 0
- else
- echo "CLIENT TEST END: $test_name [FAILED]"
+ if [[ $? -ne 0 ]] || ! grep -m 1 -q nfs-OK client.img; then
+ echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
return 1
fi
+
+ # nfsinfo=( server:/path nfs{,4} options )
+ nfsinfo=($(awk '{print $2, $3, $4; exit}' client.img))
+
+ if [[ "${nfsinfo[0]%%:*}" != "$server" ]]; then
+ echo "CLIENT TEST INFO: $test_name got: ${nfsinfo[0]%%:*}"
+ echo "CLIENT TEST INFO: $test_name expected: $server"
+ echo "CLIENT TEST END: $test_name [FAILED - WRONG SERVER]"
+ return 1
+ fi
+
+ echo "CLIENT TEST END: $test_name [OK]"
+ return 0
}
test_run() {
@@ -62,44 +74,44 @@ test_run() {
fi
client_test "NFSv3 root=dhcp DHCP path only" 52:54:00:12:34:00 \
- "root=dhcp" || return 1
+ "root=dhcp" 192.168.50.1 || return 1
client_test "NFSv3 root=nfs DHCP path only" 52:54:00:12:34:00 \
- "root=nfs" || return 1
+ "root=nfs" 192.168.50.1 || return 1
client_test "NFSv3 root=/dev/nfs DHCP path only" 52:54:00:12:34:00 \
- "root=/dev/nfs" || return 1
+ "root=/dev/nfs" 192.168.50.1 || return 1
client_test "NFSv3 root=dhcp DHCP IP:path" 52:54:00:12:34:01 \
- "root=dhcp" || return 1
+ "root=dhcp" 192.168.50.2 || return 1
client_test "NFSv3 root=nfs DHCP IP:path" 52:54:00:12:34:01 \
- "root=nfs" || return 1
+ "root=nfs" 192.168.50.2 || return 1
client_test "NFSv3 root=/dev/nfs DHCP IP:path" 52:54:00:12:34:01 \
- "root=/dev/nfs" || return 1
+ "root=/dev/nfs" 192.168.50.2 || return 1
client_test "NFSv3 root=dhcp DHCP proto:IP:path" 52:54:00:12:34:02 \
- "root=dhcp" || return 1
+ "root=dhcp" 192.168.50.3 || 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
+ "root=nfs4" 192.168.50.1 || return 1
client_test "NFSv4 root=/dev/nfs4 DHCP path only" 52:54:00:12:34:03 \
- "root=/dev/nfs4" || return 1
+ "root=/dev/nfs4" 192.168.50.1 || return 1
client_test "NFSv4 root=nfs4 DHCP IP:path" 52:54:00:12:34:04 \
- "root=nfs4" || return 1
+ "root=nfs4" 192.168.50.2 || return 1
client_test "NFSv4 root=/dev/nfs4 DHCP IP:path" 52:54:00:12:34:04 \
- "root=/dev/nfs4" || return 1
+ "root=/dev/nfs4" 192.168.50.2 || return 1
client_test "NFSv4 root=dhcp DHCP proto:IP:path" 52:54:00:12:34:05 \
- "root=dhcp" || return 1
+ "root=dhcp" 192.168.50.3 || return 1
}
test_setup() {
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 02/11] NFS test: add support for checking mount options used
[not found] ` <cover.1244435634.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
2009-06-08 4:40 ` [PATCH 01/11] NFS test: verify that we used the right IP to get to the server David Dillow
@ 2009-06-08 4:40 ` David Dillow
2009-06-08 4:40 ` [PATCH 03/11] NFS test: renumber MAC addresses to ease adding new test cases David Dillow
` (9 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: David Dillow @ 2009-06-08 4:40 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: David Dillow
---
test/TEST-20-NFS/dhcpd.conf | 20 +++++++++++++
test/TEST-20-NFS/test.sh | 65 +++++++++++++++++++++++++++++++++----------
2 files changed, 70 insertions(+), 15 deletions(-)
diff --git a/test/TEST-20-NFS/dhcpd.conf b/test/TEST-20-NFS/dhcpd.conf
index a756195..7d76180 100644
--- a/test/TEST-20-NFS/dhcpd.conf
+++ b/test/TEST-20-NFS/dhcpd.conf
@@ -42,6 +42,16 @@ subnet 192.168.50.0 netmask 255.255.255.0 {
}
group {
+ # NFSv3 root=dhcp, use protocol, options from root-path
+ option root-path "nfs:192.168.50.3:/nfs/client:wsize=4096";
+
+ host nfs3-4 {
+ hardware ethernet 52:54:00:12:34:06;
+ fixed-address 192.168.50.101;
+ }
+ }
+
+ group {
# NFSv4 root={/dev/,}nfs4, use server-id
option root-path "/client";
@@ -70,4 +80,14 @@ subnet 192.168.50.0 netmask 255.255.255.0 {
fixed-address 192.168.50.101;
}
}
+
+ group {
+ # NFSv4 root=dhcp, use profocol, options from root-path
+ option root-path "nfs4:192.168.50.3:/client:wsize=4096";
+
+ host nfs4-4 {
+ hardware ethernet 52:54:00:12:34:07;
+ fixed-address 192.168.50.101;
+ }
+ }
}
diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh
index 77ec22a..eb46ad1 100755
--- a/test/TEST-20-NFS/test.sh
+++ b/test/TEST-20-NFS/test.sh
@@ -31,7 +31,8 @@ client_test() {
local mac=$2
local cmdline="$3"
local server="$4"
- local nfsinfo
+ local check_opt="$5"
+ local nfsinfo opts found expected
echo "CLIENT TEST START: $test_name"
@@ -57,12 +58,40 @@ client_test() {
nfsinfo=($(awk '{print $2, $3, $4; exit}' client.img))
if [[ "${nfsinfo[0]%%:*}" != "$server" ]]; then
- echo "CLIENT TEST INFO: $test_name got: ${nfsinfo[0]%%:*}"
- echo "CLIENT TEST INFO: $test_name expected: $server"
+ echo "CLIENT TEST INFO: got server: ${nfsinfo[0]%%:*}"
+ echo "CLIENT TEST INFO: expected server: $server"
echo "CLIENT TEST END: $test_name [FAILED - WRONG SERVER]"
return 1
fi
+ found=0
+ expected=1
+ if [[ ${check_opt:0:1} == '-' ]]; then
+ expected=0
+ check_opt=${check_opt:1}
+ fi
+
+ opts=${nfsinfo[2]},
+ while [[ $opts ]]; do
+ if [[ ${opts%%,*} == $check_opt ]]; then
+ found=1
+ break
+ fi
+ opts=${opts#*,}
+ done
+
+ if [[ $found -ne $expected ]]; then
+ echo "CLIENT TEST INFO: got options: ${nfsinfo[2]%%:*}"
+ if [[ $expected -eq 0 ]]; then
+ echo "CLIENT TEST INFO: did not expect: $check_opt"
+ echo "CLIENT TEST END: $test_name [FAILED - UNEXPECTED OPTION]"
+ else
+ echo "CLIENT TEST INFO: missing: $check_opt"
+ echo "CLIENT TEST END: $test_name [FAILED - MISSING OPTION]"
+ fi
+ return 1
+ fi
+
echo "CLIENT TEST END: $test_name [OK]"
return 0
}
@@ -74,44 +103,50 @@ test_run() {
fi
client_test "NFSv3 root=dhcp DHCP path only" 52:54:00:12:34:00 \
- "root=dhcp" 192.168.50.1 || return 1
+ "root=dhcp" 192.168.50.1 -wsize=4096 || return 1
client_test "NFSv3 root=nfs DHCP path only" 52:54:00:12:34:00 \
- "root=nfs" 192.168.50.1 || return 1
+ "root=nfs" 192.168.50.1 -wsize=4096 || return 1
client_test "NFSv3 root=/dev/nfs DHCP path only" 52:54:00:12:34:00 \
- "root=/dev/nfs" 192.168.50.1 || return 1
+ "root=/dev/nfs" 192.168.50.1 -wsize=4096 || return 1
client_test "NFSv3 root=dhcp DHCP IP:path" 52:54:00:12:34:01 \
- "root=dhcp" 192.168.50.2 || return 1
+ "root=dhcp" 192.168.50.2 -wsize=4096 || return 1
client_test "NFSv3 root=nfs DHCP IP:path" 52:54:00:12:34:01 \
- "root=nfs" 192.168.50.2 || return 1
+ "root=nfs" 192.168.50.2 -wsize=4096 || return 1
client_test "NFSv3 root=/dev/nfs DHCP IP:path" 52:54:00:12:34:01 \
- "root=/dev/nfs" 192.168.50.2 || return 1
+ "root=/dev/nfs" 192.168.50.2 -wsize=4096 || return 1
client_test "NFSv3 root=dhcp DHCP proto:IP:path" 52:54:00:12:34:02 \
- "root=dhcp" 192.168.50.3 || return 1
+ "root=dhcp" 192.168.50.3 -wsize=4096 || return 1
+
+ client_test "NFSv3 root=dhcp DHCP proto:IP:path:options" 52:54:00:12:34:06 \
+ "root=dhcp" 192.168.50.3 wsize=4096 || 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" 192.168.50.1 || return 1
+ "root=nfs4" 192.168.50.1 -wsize=4096 || return 1
client_test "NFSv4 root=/dev/nfs4 DHCP path only" 52:54:00:12:34:03 \
- "root=/dev/nfs4" 192.168.50.1 || return 1
+ "root=/dev/nfs4" 192.168.50.1 -wsize=4096 || return 1
client_test "NFSv4 root=nfs4 DHCP IP:path" 52:54:00:12:34:04 \
- "root=nfs4" 192.168.50.2 || return 1
+ "root=nfs4" 192.168.50.2 -wsize=4096 || return 1
client_test "NFSv4 root=/dev/nfs4 DHCP IP:path" 52:54:00:12:34:04 \
- "root=/dev/nfs4" 192.168.50.2 || return 1
+ "root=/dev/nfs4" 192.168.50.2 -wsize=4096 || return 1
client_test "NFSv4 root=dhcp DHCP proto:IP:path" 52:54:00:12:34:05 \
- "root=dhcp" 192.168.50.3 || return 1
+ "root=dhcp" 192.168.50.3 -wsize=4096 || return 1
+
+ client_test "NFSv4 root=dhcp DHCP proto:IP:path:options" 52:54:00:12:34:07 \
+ "root=dhcp" 192.168.50.3 wsize=4096 || return 1
}
test_setup() {
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 03/11] NFS test: renumber MAC addresses to ease adding new test cases
[not found] ` <cover.1244435634.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
2009-06-08 4:40 ` [PATCH 01/11] NFS test: verify that we used the right IP to get to the server David Dillow
2009-06-08 4:40 ` [PATCH 02/11] NFS test: add support for checking mount options used David Dillow
@ 2009-06-08 4:40 ` David Dillow
2009-06-08 4:40 ` [PATCH 04/11] NFS root: add missing DHCP root-path/nfsroot=[IP:]/path[,options] format David Dillow
` (8 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: David Dillow @ 2009-06-08 4:40 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: David Dillow
---
test/TEST-20-NFS/dhcpd.conf | 16 +++++++++++-----
test/TEST-20-NFS/test.sh | 18 +++++++++++-------
2 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/test/TEST-20-NFS/dhcpd.conf b/test/TEST-20-NFS/dhcpd.conf
index 7d76180..3c6f17d 100644
--- a/test/TEST-20-NFS/dhcpd.conf
+++ b/test/TEST-20-NFS/dhcpd.conf
@@ -11,6 +11,9 @@ subnet 192.168.50.0 netmask 255.255.255.0 {
option domain-search "example.com";
option domain-name "other.com";
+ # MAC numbering scheme:
+ # NFSv3: last octect starts at 0x00 and works up
+
group {
# NFSv3 root=dhcp or root={/dev/,}nfs, use server-id
option root-path "/nfs/client";
@@ -46,17 +49,20 @@ subnet 192.168.50.0 netmask 255.255.255.0 {
option root-path "nfs:192.168.50.3:/nfs/client:wsize=4096";
host nfs3-4 {
- hardware ethernet 52:54:00:12:34:06;
+ hardware ethernet 52:54:00:12:34:03;
fixed-address 192.168.50.101;
}
}
+ # MAC numbering scheme:
+ # NFSv4: last octect starts at 0x80 and works up
+
group {
# NFSv4 root={/dev/,}nfs4, use server-id
option root-path "/client";
host nfs4-1 {
- hardware ethernet 52:54:00:12:34:03;
+ hardware ethernet 52:54:00:12:34:80;
fixed-address 192.168.50.101;
}
}
@@ -66,7 +72,7 @@ subnet 192.168.50.0 netmask 255.255.255.0 {
option root-path "192.168.50.2:/client";
host nfs4-2 {
- hardware ethernet 52:54:00:12:34:04;
+ hardware ethernet 52:54:00:12:34:81;
fixed-address 192.168.50.101;
}
}
@@ -76,7 +82,7 @@ subnet 192.168.50.0 netmask 255.255.255.0 {
option root-path "nfs4:192.168.50.3:/client";
host nfs4-3 {
- hardware ethernet 52:54:00:12:34:05;
+ hardware ethernet 52:54:00:12:34:82;
fixed-address 192.168.50.101;
}
}
@@ -86,7 +92,7 @@ subnet 192.168.50.0 netmask 255.255.255.0 {
option root-path "nfs4:192.168.50.3:/client:wsize=4096";
host nfs4-4 {
- hardware ethernet 52:54:00:12:34:07;
+ hardware ethernet 52:54:00:12:34:83;
fixed-address 192.168.50.101;
}
}
diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh
index eb46ad1..8adfdbb 100755
--- a/test/TEST-20-NFS/test.sh
+++ b/test/TEST-20-NFS/test.sh
@@ -102,6 +102,10 @@ test_run() {
return 1
fi
+ # MAC numbering scheme:
+ # NFSv3: last octect starts at 0x00 and works up
+ # NFSv4: last octect starts at 0x80 and works up
+
client_test "NFSv3 root=dhcp DHCP path only" 52:54:00:12:34:00 \
"root=dhcp" 192.168.50.1 -wsize=4096 || return 1
@@ -123,29 +127,29 @@ test_run() {
client_test "NFSv3 root=dhcp DHCP proto:IP:path" 52:54:00:12:34:02 \
"root=dhcp" 192.168.50.3 -wsize=4096 || return 1
- client_test "NFSv3 root=dhcp DHCP proto:IP:path:options" 52:54:00:12:34:06 \
+ client_test "NFSv3 root=dhcp DHCP proto:IP:path:options" 52:54:00:12:34:03 \
"root=dhcp" 192.168.50.3 wsize=4096 || 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 \
+ client_test "NFSv4 root=nfs4 DHCP path only" 52:54:00:12:34:80 \
"root=nfs4" 192.168.50.1 -wsize=4096 || return 1
- client_test "NFSv4 root=/dev/nfs4 DHCP path only" 52:54:00:12:34:03 \
+ client_test "NFSv4 root=/dev/nfs4 DHCP path only" 52:54:00:12:34:80 \
"root=/dev/nfs4" 192.168.50.1 -wsize=4096 || return 1
- client_test "NFSv4 root=nfs4 DHCP IP:path" 52:54:00:12:34:04 \
+ client_test "NFSv4 root=nfs4 DHCP IP:path" 52:54:00:12:34:81 \
"root=nfs4" 192.168.50.2 -wsize=4096 || return 1
- client_test "NFSv4 root=/dev/nfs4 DHCP IP:path" 52:54:00:12:34:04 \
+ client_test "NFSv4 root=/dev/nfs4 DHCP IP:path" 52:54:00:12:34:81 \
"root=/dev/nfs4" 192.168.50.2 -wsize=4096 || return 1
- client_test "NFSv4 root=dhcp DHCP proto:IP:path" 52:54:00:12:34:05 \
+ client_test "NFSv4 root=dhcp DHCP proto:IP:path" 52:54:00:12:34:82 \
"root=dhcp" 192.168.50.3 -wsize=4096 || return 1
- client_test "NFSv4 root=dhcp DHCP proto:IP:path:options" 52:54:00:12:34:07 \
+ client_test "NFSv4 root=dhcp DHCP proto:IP:path:options" 52:54:00:12:34:83 \
"root=dhcp" 192.168.50.3 wsize=4096 || return 1
}
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 04/11] NFS root: add missing DHCP root-path/nfsroot=[IP:]/path[,options] format
[not found] ` <cover.1244435634.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
` (2 preceding siblings ...)
2009-06-08 4:40 ` [PATCH 03/11] NFS test: renumber MAC addresses to ease adding new test cases David Dillow
@ 2009-06-08 4:40 ` David Dillow
2009-06-08 4:40 ` [PATCH 05/11] NFS test: add test cases for DHCP/nfsroot=[IP:]/path[,options] David Dillow
` (7 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: David Dillow @ 2009-06-08 4:40 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: David Dillow
Reported-by: Seewer Philippe <philippe.seewer-omB+W0Dpw2o@public.gmane.org>
---
modules.d/95nfs/nfs-netroot.sh | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/modules.d/95nfs/nfs-netroot.sh b/modules.d/95nfs/nfs-netroot.sh
index 0591a31..8d552e9 100755
--- a/modules.d/95nfs/nfs-netroot.sh
+++ b/modules.d/95nfs/nfs-netroot.sh
@@ -14,6 +14,10 @@ if [ "$root" = "dhcp" -o "$root" = "nfs" -o "$root" = "nfs4" ]; then
if check_occurances "$new_root_path" ':' 2; then
root="$nfsver:$new_root_path"
fi ;;
+ *:/*,*)
+ if check_occurances "$new_root_path" ':' 1; then
+ root="$nfsver:$new_root_path"
+ fi ;;
*:/*)
if check_occurances "$new_root_path" ':' 1; then
root="$nfsver:$new_root_path:"
@@ -22,6 +26,10 @@ if [ "$root" = "dhcp" -o "$root" = "nfs" -o "$root" = "nfs4" ]; then
if check_occurances "$new_root_path" ':' 1; then
root="$nfsver::$new_root_path"
fi ;;
+ /*,*)
+ if check_occurances "$new_root_path" ':' 0; then
+ root="$nfsver::$new_root_path"
+ fi ;;
/*)
if check_occurances "$new_root_path" ':' 0; then
root="$nfsver::$new_root_path:"
@@ -40,6 +48,14 @@ if [ -z "${root%%nfs:*}" -o -z "${root%%nfs4:*}" ]; then
if [ -z "$nfsserver" -o "$nfsserver" = "$nfspath" ]; then
nfsserver=$new_dhcp_server_identifier
fi
+
+ # Handle alternate syntax of path,options
+ if [ "$nfsflags" = "$nfspath" -a "${root#*,}" != "$root" ]; then
+ nfspath=${root%%,*}
+ nfsflags=${root#*,}
+ fi
+
+ # Catch the case when no additional flags are set
if [ "$nfspath" = "$nfsflags" ]; then
unset nfsflags
fi
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 05/11] NFS test: add test cases for DHCP/nfsroot=[IP:]/path[,options]
[not found] ` <cover.1244435634.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
` (3 preceding siblings ...)
2009-06-08 4:40 ` [PATCH 04/11] NFS root: add missing DHCP root-path/nfsroot=[IP:]/path[,options] format David Dillow
@ 2009-06-08 4:40 ` David Dillow
2009-06-08 4:40 ` [PATCH 06/11] NFS test: separate NFSv3 and NFSv4 tests into their own functions David Dillow
` (6 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: David Dillow @ 2009-06-08 4:40 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: David Dillow
---
test/TEST-20-NFS/dhcpd.conf | 78 +++++++++++++++++++++++++++++++++++++++++++
test/TEST-20-NFS/test.sh | 45 +++++++++++++++++++++++++
2 files changed, 123 insertions(+), 0 deletions(-)
diff --git a/test/TEST-20-NFS/dhcpd.conf b/test/TEST-20-NFS/dhcpd.conf
index 3c6f17d..a4f7fc1 100644
--- a/test/TEST-20-NFS/dhcpd.conf
+++ b/test/TEST-20-NFS/dhcpd.conf
@@ -54,6 +54,45 @@ subnet 192.168.50.0 netmask 255.255.255.0 {
}
}
+ group {
+ # NFSv3 root=dhcp, nfsroot=/path and nfsroot=IP:/path testing
+
+ host nfs3-5 {
+ hardware ethernet 52:54:00:12:34:04;
+ fixed-address 192.168.50.101;
+ }
+ }
+
+ group {
+ # NFSv3 root=dhcp, use path, comma-separated options
+ option root-path "/nfs/client,wsize=4096";
+
+ host nfs3-6 {
+ hardware ethernet 52:54:00:12:34:05;
+ fixed-address 192.168.50.101;
+ }
+ }
+
+ group {
+ # NFSv3 root=dhcp, use IP, path, comma-separated options
+ option root-path "192.168.50.2:/nfs/client,wsize=4096";
+
+ host nfs3-7 {
+ hardware ethernet 52:54:00:12:34:06;
+ fixed-address 192.168.50.101;
+ }
+ }
+
+ group {
+ # NFSv3 root=dhcp, use proto, IP, path, comma-separated options
+ option root-path "nfs:192.168.50.3:/nfs/client,wsize=4096";
+
+ host nfs3-8 {
+ hardware ethernet 52:54:00:12:34:07;
+ fixed-address 192.168.50.101;
+ }
+ }
+
# MAC numbering scheme:
# NFSv4: last octect starts at 0x80 and works up
@@ -96,4 +135,43 @@ subnet 192.168.50.0 netmask 255.255.255.0 {
fixed-address 192.168.50.101;
}
}
+
+ group {
+ # NFSv3 root=nfs4, nfsroot=/path and nfsroot=IP:/path testing
+ host nfs4-5 {
+ hardware ethernet 52:54:00:12:34:84;
+ fixed-address 192.168.50.101;
+ }
+ }
+
+ group {
+ # NFSv4 root={/dev/,}nfs4, use server-id, comma-separated opts
+ option root-path "/client,wsize=4096";
+
+ host nfs4-6 {
+ hardware ethernet 52:54:00:12:34:85;
+ fixed-address 192.168.50.101;
+ }
+ }
+
+ group {
+ # NFSv4 root={/dev/,}nfs4, use given IP, comma-separated opts
+ option root-path "192.168.50.2:/client,wsize=4096";
+
+ host nfs4-7 {
+ hardware ethernet 52:54:00:12:34:86;
+ fixed-address 192.168.50.101;
+ }
+ }
+
+ group {
+ # NFSv4 root=dhcp, use comma-separated opts
+ option root-path "nfs4:192.168.50.3:/client,wsize=4096";
+
+ host nfs4-8 {
+ hardware ethernet 52:54:00:12:34:87;
+ fixed-address 192.168.50.101;
+ }
+ }
+
}
diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh
index 8adfdbb..5888fdc 100755
--- a/test/TEST-20-NFS/test.sh
+++ b/test/TEST-20-NFS/test.sh
@@ -130,6 +130,31 @@ test_run() {
client_test "NFSv3 root=dhcp DHCP proto:IP:path:options" 52:54:00:12:34:03 \
"root=dhcp" 192.168.50.3 wsize=4096 || return 1
+ client_test "NFSv3 nfsroot=/nfs/client" 52:54:00:12:34:04 \
+ "nfsroot=/nfs/client" 192.168.50.1 -wsize=4096 || return 1
+
+ client_test "NFSv3 nfsroot=192.168.50.2:/nfs/client" 52:54:00:12:34:04 \
+ "nfsroot=192.168.50.2:/nfs/client" 192.168.50.2 -wsize=4096 || return 1
+
+ client_test "NFSv3 root=dhcp nfsroot=/nfs/client" 52:54:00:12:34:04 \
+ "root=dhcp nfsroot=/nfs/client" 192.168.50.1 -wsize=4096 || return 1
+
+ client_test "NFSv3 root=nfs nfsroot=/nfs/client" 52:54:00:12:34:04 \
+ "root=nfs nfsroot=/nfs/client" 192.168.50.1 -wsize=4096 || return 1
+
+ client_test "NFSv3 root=nfs nfsroot=/nfs/client,wsize=4096" \
+ 52:54:00:12:34:04 "root=nfs nfsroot=/nfs/client,wsize=4096" \
+ 192.168.50.1 wsize=4096 || return 1
+
+ client_test "NFSv3 root=nfs DHCP path,options" \
+ 52:54:00:12:34:05 "root=dhcp" 192.168.50.1 wsize=4096 || return 1
+
+ client_test "NFSv3 root=dhcp DHCP IP:path,options" \
+ 52:54:00:12:34:06 "root=dhcp" 192.168.50.2 wsize=4096 || return 1
+
+ client_test "NFSv3 root=dhcp DHCP proto:IP:path,options" \
+ 52:54:00:12:34:07 "root=dhcp" 192.168.50.3 wsize=4096 || 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
@@ -151,6 +176,26 @@ test_run() {
client_test "NFSv4 root=dhcp DHCP proto:IP:path:options" 52:54:00:12:34:83 \
"root=dhcp" 192.168.50.3 wsize=4096 || return 1
+
+ client_test "NFSv4 root=nfs4 nfsroot=/client" 52:54:00:12:34:84 \
+ "root=nfs4 nfsroot=/client" 192.168.50.1 -wsize=4096 || return 1
+
+ client_test "NFSv4 root=nfs4 nfsroot=192.168.50.2:/client" \
+ 52:54:00:12:34:84 "root=nfs4 nfsroot=192.168.50.2:/client" \
+ 192.168.50.2 -wsize=4096 || return 1
+
+ client_test "NFSv4 root=nfs4 nfsroot=path,opts" \
+ 52:54:00:12:34:84 "root=nfs4 nfsroot=/client,wsize=4096" \
+ 192.168.50.1 wsize=4096 || return 1
+
+ client_test "NFSv4 root=nfs4 DHCP path,options" \
+ 52:54:00:12:34:85 "root=nfs4" 192.168.50.1 wsize=4096 || return 1
+
+ client_test "NFSv4 root=nfs4 DHCP IP:path,options" \
+ 52:54:00:12:34:86 "root=nfs4" 192.168.50.2 wsize=4096 || return 1
+
+ client_test "NFSv4 root=dhcp DHCP proto:IP:path,options" \
+ 52:54:00:12:34:87 "root=dhcp" 192.168.50.3 wsize=4096 || return 1
}
test_setup() {
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 06/11] NFS test: separate NFSv3 and NFSv4 tests into their own functions
[not found] ` <cover.1244435634.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
` (4 preceding siblings ...)
2009-06-08 4:40 ` [PATCH 05/11] NFS test: add test cases for DHCP/nfsroot=[IP:]/path[,options] David Dillow
@ 2009-06-08 4:40 ` David Dillow
2009-06-08 4:40 ` [PATCH 07/11] NFS root: add support for default root path and %s substitution David Dillow
` (5 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: David Dillow @ 2009-06-08 4:40 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: David Dillow
The full tests take over 6 minutes to run, and commenting out unneeded
ones is time consuming -- this change lets me comment out one line to
temporarily avoid an entire class of tests.
---
test/TEST-20-NFS/test.sh | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh
index 5888fdc..4a997c4 100755
--- a/test/TEST-20-NFS/test.sh
+++ b/test/TEST-20-NFS/test.sh
@@ -96,12 +96,7 @@ client_test() {
return 0
}
-test_run() {
- if ! run_server; then
- echo "Failed to start server" 1>&2
- return 1
- fi
-
+test_nfsv3() {
# MAC numbering scheme:
# NFSv3: last octect starts at 0x00 and works up
# NFSv4: last octect starts at 0x80 and works up
@@ -154,7 +149,9 @@ test_run() {
client_test "NFSv3 root=dhcp DHCP proto:IP:path,options" \
52:54:00:12:34:07 "root=dhcp" 192.168.50.3 wsize=4096 || return 1
+}
+test_nfsv4() {
# 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
@@ -198,6 +195,16 @@ test_run() {
52:54:00:12:34:87 "root=dhcp" 192.168.50.3 wsize=4096 || return 1
}
+test_run() {
+ if ! run_server; then
+ echo "Failed to start server" 1>&2
+ return 1
+ fi
+
+ test_nfsv3 || return 1
+ test_nfsv4
+}
+
test_setup() {
# Make server root
dd if=/dev/zero of=server.ext2 bs=1M count=30
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 07/11] NFS root: add support for default root path and %s substitution
[not found] ` <cover.1244435634.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
` (5 preceding siblings ...)
2009-06-08 4:40 ` [PATCH 06/11] NFS test: separate NFSv3 and NFSv4 tests into their own functions David Dillow
@ 2009-06-08 4:40 ` David Dillow
2009-06-08 4:40 ` [PATCH 08/11] dracut init: add rdnetdebug to exclude list David Dillow
` (4 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: David Dillow @ 2009-06-08 4:40 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: David Dillow
This implements a default path of /tftpboot/%s if no path is provided,
and adds host name substitution for %s, with a fall back to the IP address,
as provided by the kernel's nfsroot handling.
The test suite is updated to test this functionality.
---
modules.d/95nfs/nfs-netroot.sh | 1 +
modules.d/95nfs/nfsroot | 14 ++++++++++++++
test/TEST-20-NFS/exports | 3 +++
test/TEST-20-NFS/server-init | 3 +++
test/TEST-20-NFS/test.sh | 18 ++++++++++++++++++
5 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/modules.d/95nfs/nfs-netroot.sh b/modules.d/95nfs/nfs-netroot.sh
index 8d552e9..365d394 100755
--- a/modules.d/95nfs/nfs-netroot.sh
+++ b/modules.d/95nfs/nfs-netroot.sh
@@ -34,6 +34,7 @@ if [ "$root" = "dhcp" -o "$root" = "nfs" -o "$root" = "nfs4" ]; then
if check_occurances "$new_root_path" ':' 0; then
root="$nfsver::$new_root_path:"
fi ;;
+ '') root="$nfsver:::" ;;
esac
fi
diff --git a/modules.d/95nfs/nfsroot b/modules.d/95nfs/nfsroot
index da002c5..cd3bc7c 100755
--- a/modules.d/95nfs/nfsroot
+++ b/modules.d/95nfs/nfsroot
@@ -21,6 +21,20 @@ nfsserver=${root%%:*}; root=${root#*:}
nfspath=${root%%:*}
flags=${root#*:}
+[ -z "$nfspath" ] && nfspath=/tftpboot/%s
+
+# Kernel replaces first %s with host name, and falls back to the ip address
+# if it isn't set. Only the first %s is substituted.
+#
+if [ "${nfspath#*%s}" != "$nfspath" ]; then
+ ip=$(ip -o -f inet addr show $netif)
+ ip=${ip%%/*}
+ ip=${ip##* }
+ read node < /proc/sys/kernel/hostname
+ [ "$node" = "(none)" ] && node=$ip
+ nfspath=${nfspath%%%s*}$node${nfspath#*%s}
+fi
+
# look through the flags and see if any are overridden by the command line
# Append a , so we know we terminate
flags=${flags},
diff --git a/test/TEST-20-NFS/exports b/test/TEST-20-NFS/exports
index 2701877..95619e7 100644
--- a/test/TEST-20-NFS/exports
+++ b/test/TEST-20-NFS/exports
@@ -1,2 +1,5 @@
/nfs 192.168.50.0/24(ro,fsid=0,insecure,no_subtree_check,no_root_squash)
/nfs/client 192.168.50.0/24(ro,insecure,no_subtree_check,no_root_squash)
+/nfs/nfs3-5 192.168.50.0/24(ro,insecure,no_subtree_check,no_root_squash,nohide)
+/nfs/ip/192.168.50.101 192.168.50.0/24(ro,insecure,no_subtree_check,no_root_squash,nohide)
+/nfs/tftpboot/nfs4-5 192.168.50.0/24(ro,insecure,no_subtree_check,no_root_squash,nohide)
diff --git a/test/TEST-20-NFS/server-init b/test/TEST-20-NFS/server-init
index 67af8fa..ed7e43e 100755
--- a/test/TEST-20-NFS/server-init
+++ b/test/TEST-20-NFS/server-init
@@ -10,6 +10,9 @@ ip addr add 192.168.50.1/24 dev eth0
ip addr add 192.168.50.2/24 dev eth0
ip addr add 192.168.50.3/24 dev eth0
ip link set eth0 up
+mount --bind /nfs/client /nfs/nfs3-5
+mount --bind /nfs/client /nfs/ip/192.168.50.101
+mount --bind /nfs/client /nfs/tftpboot/nfs4-5
modprobe sunrpc
mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs
rpcbind
diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh
index 4a997c4..6583366 100755
--- a/test/TEST-20-NFS/test.sh
+++ b/test/TEST-20-NFS/test.sh
@@ -137,6 +137,15 @@ test_nfsv3() {
client_test "NFSv3 root=nfs nfsroot=/nfs/client" 52:54:00:12:34:04 \
"root=nfs nfsroot=/nfs/client" 192.168.50.1 -wsize=4096 || return 1
+ client_test "NFSv3 root=nfs nfsroot=/nfs/%s" 52:54:00:12:34:04 \
+ "root=nfs nfsroot=/nfs/%s" 192.168.50.1 -wsize=4096 || return 1
+
+ client_test "NFSv3 root=nfs nfsroot=/nfs/ip/%s no host name (use IP)" \
+ 52:54:00:12:34:7f \
+ "root=nfs nfsroot=/nfs/ip/%s \
+ ip=192.168.50.101:192.168.50.1::255.255.255.0::eth0:static" \
+ 192.168.50.1 -wsize=4096 || return 1
+
client_test "NFSv3 root=nfs nfsroot=/nfs/client,wsize=4096" \
52:54:00:12:34:04 "root=nfs nfsroot=/nfs/client,wsize=4096" \
192.168.50.1 wsize=4096 || return 1
@@ -185,6 +194,11 @@ test_nfsv4() {
52:54:00:12:34:84 "root=nfs4 nfsroot=/client,wsize=4096" \
192.168.50.1 wsize=4096 || return 1
+ # This one only works with NFSv4 in the test suite -- NFSv3 needs
+ # a /nfs prefix due to our server configuration
+ client_test "NFSv4 root=nfs4" 52:54:00:12:34:84 \
+ "root=nfs4" 192.168.50.1 -wsize=4096 || return 1
+
client_test "NFSv4 root=nfs4 DHCP path,options" \
52:54:00:12:34:85 "root=nfs4" 192.168.50.1 wsize=4096 || return 1
@@ -267,6 +281,10 @@ test_setup() {
ldconfig -n -r "$initdir" /lib* /usr/lib*
)
+ mkdir -p mnt/nfs/nfs3-5
+ mkdir -p mnt/nfs/ip/192.168.50.101
+ mkdir -p mnt/nfs/tftpboot/nfs4-5
+
sudo umount mnt
rm -fr mnt
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 08/11] dracut init: add rdnetdebug to exclude list
[not found] ` <cover.1244435634.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
` (6 preceding siblings ...)
2009-06-08 4:40 ` [PATCH 07/11] NFS root: add support for default root path and %s substitution David Dillow
@ 2009-06-08 4:40 ` David Dillow
2009-06-08 4:40 ` [PATCH 09/11] NFS test: add test for nfs[4]:srv:/path syntax David Dillow
` (3 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: David Dillow @ 2009-06-08 4:40 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: David Dillow
---
modules.d/99base/init | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/modules.d/99base/init b/modules.d/99base/init
index 53e28ef..b1115e1 100755
--- a/modules.d/99base/init
+++ b/modules.d/99base/init
@@ -133,6 +133,7 @@ for x in "$@"; do
[ "${x%%=*}" = "rdinitdebug" ] && continue
[ "${x%%=*}" = "rdudevinfo" ] && continue
[ "${x%%=*}" = "rdudevdebug" ] && continue
+ [ "${x%%=*}" = "rdnetdebug" ] && continue
initargs="$initargs $x"
done
exec switch_root "$NEWROOT" "$INIT" $initargs || {
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 09/11] NFS test: add test for nfs[4]:srv:/path syntax
[not found] ` <cover.1244435634.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
` (7 preceding siblings ...)
2009-06-08 4:40 ` [PATCH 08/11] dracut init: add rdnetdebug to exclude list David Dillow
@ 2009-06-08 4:40 ` David Dillow
2009-06-08 4:40 ` [PATCH 10/11] NBD: fix parsing of Debian-style nbdroot config David Dillow
` (2 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: David Dillow @ 2009-06-08 4:40 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: David Dillow
---
test/TEST-20-NFS/test.sh | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh
index 6583366..e66d288 100755
--- a/test/TEST-20-NFS/test.sh
+++ b/test/TEST-20-NFS/test.sh
@@ -125,6 +125,9 @@ test_nfsv3() {
client_test "NFSv3 root=dhcp DHCP proto:IP:path:options" 52:54:00:12:34:03 \
"root=dhcp" 192.168.50.3 wsize=4096 || return 1
+ client_test "NFSv3 root=nfs:..." 52:54:00:12:34:04 \
+ "root=nfs:192.168.50.1:/nfs/client" 192.168.50.1 -wsize=4096 || return 1
+
client_test "NFSv3 nfsroot=/nfs/client" 52:54:00:12:34:04 \
"nfsroot=/nfs/client" 192.168.50.1 -wsize=4096 || return 1
@@ -183,6 +186,10 @@ test_nfsv4() {
client_test "NFSv4 root=dhcp DHCP proto:IP:path:options" 52:54:00:12:34:83 \
"root=dhcp" 192.168.50.3 wsize=4096 || return 1
+ client_test "NFSv4 root=nfs4:..." 52:54:00:12:34:84 \
+ "root=nfs4:192.168.50.1:/client" 192.168.50.1 \
+ -wsize=4096 || return 1
+
client_test "NFSv4 root=nfs4 nfsroot=/client" 52:54:00:12:34:84 \
"root=nfs4 nfsroot=/client" 192.168.50.1 -wsize=4096 || return 1
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 10/11] NBD: fix parsing of Debian-style nbdroot config
[not found] ` <cover.1244435634.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
` (8 preceding siblings ...)
2009-06-08 4:40 ` [PATCH 09/11] NFS test: add test for nfs[4]:srv:/path syntax David Dillow
@ 2009-06-08 4:40 ` David Dillow
2009-06-08 4:40 ` [PATCH 11/11] NBD: add test suite David Dillow
2009-06-08 4:42 ` [PATCH 00/11] More test suite stuff (and bug fixes) David Dillow
11 siblings, 0 replies; 14+ messages in thread
From: David Dillow @ 2009-06-08 4:40 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: David Dillow
---
modules.d/95nbd/parse-nbdroot.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules.d/95nbd/parse-nbdroot.sh b/modules.d/95nbd/parse-nbdroot.sh
index 84d1c23..ba40207 100755
--- a/modules.d/95nbd/parse-nbdroot.sh
+++ b/modules.d/95nbd/parse-nbdroot.sh
@@ -34,7 +34,7 @@ case "$root" in
nbd:*,*)
if check_occurances "$root" ',' 1 && check_occurances "$root" ':' 1;
then
- root=${root%*,}:${root#*,}
+ root=${root%,*}:${root#*,}
fi
;;
esac
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 11/11] NBD: add test suite
[not found] ` <cover.1244435634.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
` (9 preceding siblings ...)
2009-06-08 4:40 ` [PATCH 10/11] NBD: fix parsing of Debian-style nbdroot config David Dillow
@ 2009-06-08 4:40 ` David Dillow
2009-06-08 4:42 ` [PATCH 00/11] More test suite stuff (and bug fixes) David Dillow
11 siblings, 0 replies; 14+ messages in thread
From: David Dillow @ 2009-06-08 4:40 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: David Dillow
This is an initial test suite for the NBD root. It does the basics, and
needs to be extended to check more parts of the configuration.
---
test/TEST-40-NBD/Makefile | 10 +++
test/TEST-40-NBD/client-init | 10 +++
test/TEST-40-NBD/dhcpd.conf | 29 +++++++
test/TEST-40-NBD/hard-off.sh | 2 +
test/TEST-40-NBD/hosts | 8 ++
test/TEST-40-NBD/server-init | 18 ++++
test/TEST-40-NBD/test.sh | 179 ++++++++++++++++++++++++++++++++++++++++++
7 files changed, 256 insertions(+), 0 deletions(-)
create mode 100644 test/TEST-40-NBD/Makefile
create mode 100755 test/TEST-40-NBD/client-init
create mode 100644 test/TEST-40-NBD/dhcpd.conf
create mode 100755 test/TEST-40-NBD/hard-off.sh
create mode 100644 test/TEST-40-NBD/hosts
create mode 100755 test/TEST-40-NBD/server-init
create mode 100755 test/TEST-40-NBD/test.sh
diff --git a/test/TEST-40-NBD/Makefile b/test/TEST-40-NBD/Makefile
new file mode 100644
index 0000000..bc0ddb6
--- /dev/null
+++ b/test/TEST-40-NBD/Makefile
@@ -0,0 +1,10 @@
+all:
+ @make -s --no-print-directory -C ../.. all
+ @basedir=../.. testdir=../ ./test.sh --all
+setup:
+ @make --no-print-directory -C ../.. all
+ @basedir=../.. testdir=../ ./test.sh --setup
+clean:
+ @basedir=../.. testdir=../ ./test.sh --clean
+run:
+ @basedir=../.. testdir=../ ./test.sh --run
diff --git a/test/TEST-40-NBD/client-init b/test/TEST-40-NBD/client-init
new file mode 100755
index 0000000..dde5c16
--- /dev/null
+++ b/test/TEST-40-NBD/client-init
@@ -0,0 +1,10 @@
+#!/bin/sh
+exec >/dev/console 2>&1
+echo "nbd-OK" >/dev/sda
+export TERM=linux
+export PS1='nbdclient-test:\w\$ '
+stty sane
+echo "made it to the rootfs! Powering down."
+#sh -i
+mount -n -o remount,ro / &> /dev/null
+poweroff -f
diff --git a/test/TEST-40-NBD/dhcpd.conf b/test/TEST-40-NBD/dhcpd.conf
new file mode 100644
index 0000000..e7d5a08
--- /dev/null
+++ b/test/TEST-40-NBD/dhcpd.conf
@@ -0,0 +1,29 @@
+ddns-update-style none;
+
+use-host-decl-names true;
+
+subnet 192.168.50.0 netmask 255.255.255.0 {
+ option subnet-mask 255.255.255.0;
+ option routers 192.168.50.1;
+ next-server 192.168.50.1;
+ server-identifier 192.168.50.1;
+ option domain-name-servers 192.168.50.1;
+ option domain-search "example.com";
+ option domain-name "other.com";
+
+ group {
+ host nbd-1 {
+ hardware ethernet 52:54:00:12:34:00;
+ fixed-address 192.168.50.101;
+ }
+ }
+
+ group {
+ host nbd-2 {
+ option root-path "nbd:192.168.50.1:2000";
+
+ hardware ethernet 52:54:00:12:34:01;
+ fixed-address 192.168.50.101;
+ }
+ }
+}
diff --git a/test/TEST-40-NBD/hard-off.sh b/test/TEST-40-NBD/hard-off.sh
new file mode 100755
index 0000000..85fd849
--- /dev/null
+++ b/test/TEST-40-NBD/hard-off.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+getarg rdinitdebug || poweroff -f
diff --git a/test/TEST-40-NBD/hosts b/test/TEST-40-NBD/hosts
new file mode 100644
index 0000000..f8c18b6
--- /dev/null
+++ b/test/TEST-40-NBD/hosts
@@ -0,0 +1,8 @@
+127.0.0.1 localhost
+192.168.50.1 server
+192.168.50.2 server-ip
+192.168.50.3 server-proto-ip
+192.168.50.100 workstation1
+192.168.50.101 workstation2
+192.168.50.102 workstation3
+192.168.50.103 workstation4
diff --git a/test/TEST-40-NBD/server-init b/test/TEST-40-NBD/server-init
new file mode 100755
index 0000000..1bdc4cc
--- /dev/null
+++ b/test/TEST-40-NBD/server-init
@@ -0,0 +1,18 @@
+#!/bin/sh
+export TERM=linux
+export PS1='nbdtest-server:\w\$ '
+stty sane
+echo "made it to the rootfs!"
+echo server > /proc/sys/kernel/hostname
+ip addr add 127.0.0.1/8 dev lo
+ip link set lo up
+ip addr add 192.168.50.1/24 dev eth0
+ip link set eth0 up
+nbd-server 2000 /dev/sdb -C /dev/null
+>/var/lib/dhcpd/dhcpd.leases
+dhcpd
+sh -i
+# Wait forever for the VM to die
+while sleep 60; do sleep 60; done
+mount -n -o remount,ro /
+poweroff -f
diff --git a/test/TEST-40-NBD/test.sh b/test/TEST-40-NBD/test.sh
new file mode 100755
index 0000000..aabe916
--- /dev/null
+++ b/test/TEST-40-NBD/test.sh
@@ -0,0 +1,179 @@
+#!/bin/bash
+TEST_DESCRIPTION="root filesystem on NBD"
+
+KVERSION=${KVERSION-$(uname -r)}
+
+# Uncomment this to debug failures
+#DEBUGFAIL="rdinitdebug rdnetdebug rdbreak"
+
+run_server() {
+ # Start server first
+ echo "NBD TEST SETUP: Starting DHCP/NFS server"
+
+ $testdir/run-qemu -hda server.ext2 -hdb nbd.ext2 -m 512M -nographic \
+ -net nic,macaddr=52:54:00:12:34:56,model=e1000 \
+ -net socket,mcast=230.0.0.1:1234 \
+ -serial udp:127.0.0.1:9999 \
+ -kernel /boot/vmlinuz-$KVERSION \
+ -append "root=/dev/sda rw quiet console=ttyS0,115200n81" \
+ -initrd initramfs.server -pidfile server.pid -daemonize || return 1
+ sudo chmod 644 server.pid || return 1
+
+ # Cleanup the terminal if we have one
+ tty -s && stty sane
+
+ echo Sleeping 10 seconds to give the server a head start
+ sleep 10
+}
+
+client_test() {
+ local test_name="$1"
+ local mac=$2
+ local cmdline="$3"
+
+ echo "CLIENT TEST START: $test_name"
+
+ # Clear out the flags for each test
+ if ! dd if=/dev/zero of=flag.img bs=1M count=1; then
+ echo "Unable to make client sda image" 1>&2
+ return 1
+ fi
+
+ $testdir/run-qemu -hda flag.img -m 512M -nographic \
+ -net nic,macaddr=$mac,model=e1000 \
+ -net socket,mcast=230.0.0.1:1234 \
+ -kernel /boot/vmlinuz-$KVERSION \
+ -append "$cmdline $DEBUGFAIL ro quiet console=ttyS0,115200n81" \
+ -initrd initramfs.testing
+
+ if [[ $? -ne 0 ]] || ! grep -m 1 -q nbd-OK flag.img; then
+ echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
+ return 1
+ fi
+
+ echo "CLIENT TEST END: $test_name [OK]"
+}
+
+test_run() {
+ if ! run_server; then
+ echo "Failed to start server" 1>&2
+ return 1
+ fi
+
+ client_test "NBD root=nbd:..." 52:54:00:12:34:00 \
+ "root=nbd:192.168.50.1:2000" || return 1
+
+ client_test "NBD root=nbd nbdroot=srv:port" 52:54:00:12:34:00 \
+ "root=nbd nbdroot=192.168.50.1:2000" || return 1
+
+ client_test "NBD root=dhcp nbdroot=srv:port" 52:54:00:12:34:00 \
+ "root=dhcp nbdroot=192.168.50.1:2000" || return 1
+
+ client_test "NBD root=nbd nbdroot=srv,port" 52:54:00:12:34:00 \
+ "root=nbd nbdroot=192.168.50.1,2000" || return 1
+
+ client_test "NBD root=dhcp nbdroot=srv,port" 52:54:00:12:34:00 \
+ "root=dhcp nbdroot=192.168.50.1,2000" || return 1
+
+ client_test "NBD root=dhcp DHCP root-path nbd:srv:port" 52:54:00:12:34:01 \
+ "root=dhcp" || return 1
+}
+
+make_client_root() {
+ dd if=/dev/zero of=nbd.ext2 bs=1M count=30
+ mke2fs -F nbd.ext2
+ mkdir mnt
+ sudo mount -o loop nbd.ext2 mnt
+
+ kernel=$KVERSION
+ (
+ initdir=mnt
+ . $basedir/dracut-functions
+ dracut_install sh ls shutdown poweroff stty cat ps ln ip \
+ /lib/terminfo/l/linux dmesg mkdir cp ping
+ inst ./client-init /sbin/init
+ (
+ cd "$initdir";
+ mkdir -p dev sys proc etc var/run tmp
+ )
+ inst /etc/nsswitch.conf /etc/nsswitch.conf
+ inst /etc/passwd /etc/passwd
+ inst /etc/group /etc/group
+ for i in /lib*/libnss_files**;do
+ inst_library $i
+ done
+
+ ldconfig -n -r "$initdir" /lib* /usr/lib*
+ )
+
+ sudo umount mnt
+ rm -fr mnt
+}
+
+make_server_root() {
+ dd if=/dev/zero of=server.ext2 bs=1M count=30
+ mke2fs -F server.ext2
+ mkdir mnt
+ sudo mount -o loop server.ext2 mnt
+
+ kernel=$KVERSION
+ (
+ initdir=mnt
+ . $basedir/dracut-functions
+ dracut_install sh ls shutdown poweroff stty cat ps ln ip \
+ /lib/terminfo/l/linux dmesg mkdir cp ping grep dhcpd \
+ sleep nbd-server
+ inst ./server-init /sbin/init
+ inst ./hosts /etc/hosts
+ inst ./dhcpd.conf /etc/dhcpd.conf
+ (
+ cd "$initdir";
+ mkdir -p dev sys proc etc var/run var/lib/dhcpd tmp
+ )
+ inst /etc/nsswitch.conf /etc/nsswitch.conf
+ inst /etc/passwd /etc/passwd
+ inst /etc/group /etc/group
+ for i in /lib*/libnss_files**;do
+ inst_library $i
+ done
+
+ ldconfig -n -r "$initdir" /lib* /usr/lib*
+ )
+
+ sudo umount mnt
+ rm -fr mnt
+}
+
+test_setup() {
+ make_client_root || return 1
+ make_server_root || return 1
+
+ # Make the test image
+ (
+ initdir=overlay
+ . $basedir/dracut-functions
+ dracut_install poweroff shutdown
+ inst_simple ./hard-off.sh /emergency/01hard-off.sh
+ )
+
+ sudo $basedir/dracut -l -i overlay / \
+ -m "dash crypt lvm mdraid udev-rules rootfs-block base debug" \
+ -d "ata_piix ext2 sd_mod e1000" \
+ -f initramfs.server $KVERSION || return 1
+
+ sudo $basedir/dracut -l -i overlay / \
+ -m "dash crypt lvm mdraid udev-rules base rootfs-block nbd debug" \
+ -d "ata_piix ext2 sd_mod e1000" \
+ -f initramfs.testing $KVERSION || return 1
+}
+
+test_cleanup() {
+ if [[ -s server.pid ]]; then
+ sudo kill -TERM $(cat server.pid)
+ rm -f server.pid
+ fi
+ rm -fr overlay mnt
+ rm -f flag.img server.ext2 nbd.ext2 initramfs.server initramfs.testing
+}
+
+. $testdir/test-functions
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH 00/11] More test suite stuff (and bug fixes)
[not found] ` <cover.1244435634.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
` (10 preceding siblings ...)
2009-06-08 4:40 ` [PATCH 11/11] NBD: add test suite David Dillow
@ 2009-06-08 4:42 ` David Dillow
[not found] ` <1244436164.23139.8.camel-1q1vX8mYZiGLUyTwlgNVppKKF0rrzTr+@public.gmane.org>
11 siblings, 1 reply; 14+ messages in thread
From: David Dillow @ 2009-06-08 4:42 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA
On Mon, 2009-06-08 at 00:40 -0400, David Dillow wrote:
> This add more comprehensive tests to the NFS test suite, such as
> verifying that we used the right server IP address, and that we
> added mount options appropriately. It may be a bit too comprehensive,
> as it takes over 7 minutes to run for me.
>
> Also of note, I addded support for a default NFS path and %s
> substitution as done by the kernel's nfsroot handling.
>
> This also has the first round of testing for NBD root, and a fix
> for a bug found by the test suite.
Of course, I forgot to mention that this series is based on the one I
posted Saturday morning.
You can get all of the changes at http://thedillows.org/dracut.git
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 14+ messages in thread