testsuite: increase disk image size
parent
b1ae591945
commit
66a3d4053b
|
|
@ -7,10 +7,10 @@ rm -f -- /etc/lvm/lvm.conf
|
|||
udevadm control --reload
|
||||
# save a partition at the beginning for future flagging purposes
|
||||
sfdisk /dev/sda <<EOF
|
||||
,1M
|
||||
,10M
|
||||
,10M
|
||||
,10M
|
||||
,2M
|
||||
,20M
|
||||
,20M
|
||||
,20M
|
||||
EOF
|
||||
udevadm settle
|
||||
for i in sda2 sda3 sda4; do
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ test_run() {
|
|||
|
||||
test_setup() {
|
||||
# Create the blank file to use as a root filesystem
|
||||
dd if=/dev/null of=$TESTDIR/root.ext2 bs=1M seek=40
|
||||
dd if=/dev/null of=$TESTDIR/root.ext2 bs=1M seek=80
|
||||
|
||||
kernel=$KVERSION
|
||||
# Create what will eventually be our root filesystem onto an overlay
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ test_run() {
|
|||
|
||||
test_setup() {
|
||||
# Make server root
|
||||
dd if=/dev/null of=$TESTDIR/server.ext3 bs=1M seek=60
|
||||
dd if=/dev/null of=$TESTDIR/server.ext3 bs=1M seek=120
|
||||
mke2fs -j -F $TESTDIR/server.ext3
|
||||
mkdir $TESTDIR/mnt
|
||||
sudo mount -o loop $TESTDIR/server.ext3 $TESTDIR/mnt
|
||||
|
|
|
|||
|
|
@ -76,15 +76,6 @@ do_test_run() {
|
|||
"rd.iscsi.initiator=$initiator" \
|
||||
|| return 1
|
||||
|
||||
run_client "netroot=iscsi target1 target2" \
|
||||
"root=LABEL=sysroot" \
|
||||
"ip=192.168.50.101:::255.255.255.0::ens3:off" \
|
||||
"ip=192.168.51.101:::255.255.255.0::ens4:off" \
|
||||
"netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
|
||||
"netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
|
||||
"rd.iscsi.initiator=$initiator" \
|
||||
|| return 1
|
||||
|
||||
|
||||
echo "All tests passed [OK]"
|
||||
return 0
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hda", SYMLINK+="sda"
|
||||
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hda*", SYMLINK+="sda$env{MINOR}"
|
||||
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdb", SYMLINK+="sdb"
|
||||
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdb*", SYMLINK+="sdb$env{MINOR}"
|
||||
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdc", SYMLINK+="sdc"
|
||||
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdc*", SYMLINK+="sdc$env{MINOR}"
|
||||
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdd", SYMLINK+="sdd"
|
||||
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdd*", SYMLINK+="sdd$env{MINOR}"
|
||||
|
|
@ -0,0 +1 @@
|
|||
-include ../Makefile.testdir
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
#!/bin/sh
|
||||
getcmdline() {
|
||||
while read -r _line || [ -n "$_line" ]; do
|
||||
printf "%s" "$_line"
|
||||
done </proc/cmdline;
|
||||
}
|
||||
|
||||
_dogetarg() {
|
||||
local _o _val _doecho
|
||||
unset _val
|
||||
unset _o
|
||||
unset _doecho
|
||||
CMDLINE=$(getcmdline)
|
||||
|
||||
for _o in $CMDLINE; do
|
||||
if [ "${_o%%=*}" = "${1%%=*}" ]; then
|
||||
if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
|
||||
# if $1 has a "=<value>", we want the exact match
|
||||
if [ "$_o" = "$1" ]; then
|
||||
_val="1";
|
||||
unset _doecho
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ "${_o#*=}" = "$_o" ]; then
|
||||
# if cmdline argument has no "=<value>", we assume "=1"
|
||||
_val="1";
|
||||
unset _doecho
|
||||
continue
|
||||
fi
|
||||
|
||||
_val="${_o#*=}"
|
||||
_doecho=1
|
||||
fi
|
||||
done
|
||||
if [ -n "$_val" ]; then
|
||||
[ "x$_doecho" != "x" ] && echo "$_val";
|
||||
return 0;
|
||||
fi
|
||||
return 1;
|
||||
}
|
||||
|
||||
getarg() {
|
||||
local _deprecated _newoption
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
-d) _deprecated=1; shift;;
|
||||
-y) if _dogetarg $2 >/dev/null; then
|
||||
if [ "$_deprecated" = "1" ]; then
|
||||
[ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
|
||||
fi
|
||||
echo 1
|
||||
return 0
|
||||
fi
|
||||
_deprecated=0
|
||||
shift 2;;
|
||||
-n) if _dogetarg $2 >/dev/null; then
|
||||
echo 0;
|
||||
if [ "$_deprecated" = "1" ]; then
|
||||
[ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
_deprecated=0
|
||||
shift 2;;
|
||||
*) if [ -z "$_newoption" ]; then
|
||||
_newoption="$1"
|
||||
fi
|
||||
if _dogetarg $1; then
|
||||
if [ "$_deprecated" = "1" ]; then
|
||||
[ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
|
||||
fi
|
||||
return 0;
|
||||
fi
|
||||
_deprecated=0
|
||||
shift;;
|
||||
esac
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
getargbool() {
|
||||
local _b
|
||||
unset _b
|
||||
local _default
|
||||
_default="$1"; shift
|
||||
_b=$(getarg "$@")
|
||||
[ $? -ne 0 -a -z "$_b" ] && _b="$_default"
|
||||
if [ -n "$_b" ]; then
|
||||
[ $_b = "0" ] && return 1
|
||||
[ $_b = "no" ] && return 1
|
||||
[ $_b = "off" ] && return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
exec >/dev/console 2>&1
|
||||
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
|
||||
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
|
||||
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 || [ -n "$dev" ]; do
|
||||
[ "$fstype" != "ext3" ] && continue
|
||||
echo "iscsi-OK $dev $fstype $opts" > /dev/sda
|
||||
break
|
||||
done < /proc/mounts
|
||||
#sh -i
|
||||
if getargbool 0 rd.shell; then
|
||||
strstr "$(setsid --help)" "control" && CTTY="-c"
|
||||
setsid $CTTY sh -i
|
||||
fi
|
||||
poweroff -f
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
# don't let udev and this script step on eachother's toes
|
||||
for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
|
||||
> "/etc/udev/rules.d/$x"
|
||||
done
|
||||
rm -f -- /etc/lvm/lvm.conf
|
||||
udevadm control --reload
|
||||
mkfs.ext3 -j -L singleroot -F /dev/sda && \
|
||||
mkdir -p /sysroot && \
|
||||
mount /dev/sda /sysroot && \
|
||||
cp -a -t /sysroot /source/* && \
|
||||
umount /sysroot && \
|
||||
mdadm --create /dev/md0 --run --auto=yes --level=stripe --raid-devices=2 /dev/sdc /dev/sdd && \
|
||||
mdadm -W /dev/md0 || : && \
|
||||
lvm pvcreate -ff -y /dev/md0 && \
|
||||
lvm vgcreate dracut /dev/md0 && \
|
||||
lvm lvcreate -l 100%FREE -n root dracut && \
|
||||
lvm vgchange -ay && \
|
||||
mkfs.ext3 -j -L sysroot /dev/dracut/root && \
|
||||
mount /dev/dracut/root /sysroot && \
|
||||
cp -a -t /sysroot /source/* && \
|
||||
umount /sysroot && \
|
||||
lvm lvchange -a n /dev/dracut/root && \
|
||||
echo "dracut-root-block-created" >/dev/sdb
|
||||
poweroff -f
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
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";
|
||||
|
||||
# MAC numbering scheme:
|
||||
# NFSv3: last octect starts at 0x00 and works up
|
||||
|
||||
group {
|
||||
option root-path "iscsi:192.168.50.1:::1:iqn.2009-06.dracut:target0";
|
||||
|
||||
host iscsi-1 {
|
||||
hardware ethernet 52:54:00:12:34:00;
|
||||
fixed-address 192.168.50.101;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
subnet 192.168.51.0 netmask 255.255.255.0 {
|
||||
option subnet-mask 255.255.255.0;
|
||||
option routers 192.168.51.1;
|
||||
next-server 192.168.51.1;
|
||||
server-identifier 192.168.51.1;
|
||||
option domain-name-servers 192.168.51.1;
|
||||
option domain-search "example.com";
|
||||
option domain-name "other.com";
|
||||
|
||||
# MAC numbering scheme:
|
||||
# NFSv3: last octect starts at 0x00 and works up
|
||||
|
||||
group {
|
||||
option root-path "iscsi:192.168.51.1:::1:iqn.2009-06.dracut:target1";
|
||||
|
||||
host iscsi-2 {
|
||||
hardware ethernet 52:54:00:12:34:01;
|
||||
fixed-address 192.168.51.101;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
exit 1
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
getargbool 0 rd.shell || poweroff -f
|
||||
getargbool 0 failme && poweroff -f
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
#!/bin/sh
|
||||
exec </dev/console >/dev/console 2>&1
|
||||
set -x
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
export TERM=linux
|
||||
export PS1='nfstest-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 link set dev eth0 name ens3
|
||||
ip addr add 192.168.50.1/24 dev ens3
|
||||
ip link set ens3 up
|
||||
ip link set dev eth1 name ens4
|
||||
ip addr add 192.168.51.1/24 dev ens4
|
||||
ip link set ens4 up
|
||||
>/var/lib/dhcpd/dhcpd.leases
|
||||
chmod 777 /var/lib/dhcpd/dhcpd.leases
|
||||
dhcpd -d -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases &
|
||||
|
||||
tgtd
|
||||
tgtadm --lld iscsi --mode target --op new --tid 1 --targetname iqn.2009-06.dracut:target0
|
||||
tgtadm --lld iscsi --mode target --op new --tid 2 --targetname iqn.2009-06.dracut:target1
|
||||
tgtadm --lld iscsi --mode target --op new --tid 3 --targetname iqn.2009-06.dracut:target2
|
||||
tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /dev/sdb
|
||||
tgtadm --lld iscsi --mode logicalunit --op new --tid 2 --lun 2 -b /dev/sdc
|
||||
tgtadm --lld iscsi --mode logicalunit --op new --tid 3 --lun 3 -b /dev/sdd
|
||||
tgtadm --lld iscsi --mode target --op bind --tid 1 -I 192.168.50.101
|
||||
tgtadm --lld iscsi --mode target --op bind --tid 2 -I 192.168.51.101
|
||||
tgtadm --lld iscsi --mode target --op bind --tid 3 -I 192.168.50.101
|
||||
|
||||
|
||||
# Wait forever for the VM to die
|
||||
echo "Serving iSCSI"
|
||||
while :; do
|
||||
[ -n "$(jobs -rp)" ] && echo > /dev/watchdog
|
||||
sleep 10
|
||||
done
|
||||
mount -n -o remount,ro /
|
||||
poweroff -f
|
||||
|
|
@ -0,0 +1,243 @@
|
|||
#!/bin/bash
|
||||
TEST_DESCRIPTION="root filesystem over iSCSI"
|
||||
|
||||
KVERSION=${KVERSION-$(uname -r)}
|
||||
|
||||
DEBUGFAIL="loglevel=1"
|
||||
#DEBUGFAIL="rd.shell rd.break rd.debug loglevel=7 "
|
||||
#DEBUGFAIL="rd.debug loglevel=7 "
|
||||
#SERVER_DEBUG="rd.debug loglevel=7"
|
||||
#SERIAL="tcp:127.0.0.1:9999"
|
||||
|
||||
run_server() {
|
||||
# Start server first
|
||||
echo "iSCSI TEST SETUP: Starting DHCP/iSCSI server"
|
||||
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/server.ext3 \
|
||||
-drive format=raw,index=1,media=disk,file=$TESTDIR/root.ext3 \
|
||||
-drive format=raw,index=2,media=disk,file=$TESTDIR/iscsidisk2.img \
|
||||
-drive format=raw,index=3,media=disk,file=$TESTDIR/iscsidisk3.img \
|
||||
-m 512M -smp 2 \
|
||||
-display none \
|
||||
${SERIAL:+-serial "$SERIAL"} \
|
||||
${SERIAL:--serial file:"$TESTDIR"/server.log} \
|
||||
-net nic,macaddr=52:54:00:12:34:56,model=e1000 \
|
||||
-net nic,macaddr=52:54:00:12:34:57,model=e1000 \
|
||||
-net socket,listen=127.0.0.1:12330 \
|
||||
-no-reboot \
|
||||
-append "panic=1 root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \
|
||||
-initrd $TESTDIR/initramfs.server \
|
||||
-pidfile $TESTDIR/server.pid -daemonize || return 1
|
||||
sudo chmod 644 $TESTDIR/server.pid || return 1
|
||||
|
||||
# Cleanup the terminal if we have one
|
||||
tty -s && stty sane
|
||||
|
||||
echo Sleeping 20 seconds to give the server a head start
|
||||
sleep 20
|
||||
}
|
||||
|
||||
run_client() {
|
||||
local test_name=$1; shift
|
||||
echo "CLIENT TEST START: $test_name"
|
||||
|
||||
dd if=/dev/zero of=$TESTDIR/client.img bs=1M count=1
|
||||
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/client.img \
|
||||
-m 512M -smp 2 -nographic \
|
||||
-net nic,macaddr=52:54:00:12:34:00,model=e1000 \
|
||||
-net nic,macaddr=52:54:00:12:34:01,model=e1000 \
|
||||
-net socket,connect=127.0.0.1:12330 \
|
||||
-no-reboot \
|
||||
-append "panic=1 rw rd.auto rd.retry=50 console=ttyS0,115200n81 selinux=0 rd.debug=0 rd.shell=0 $DEBUGFAIL $*" \
|
||||
-initrd $TESTDIR/initramfs.testing
|
||||
if ! grep -F -m 1 -q iscsi-OK $TESTDIR/client.img; then
|
||||
echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "CLIENT TEST END: $test_name [OK]"
|
||||
return 0
|
||||
}
|
||||
|
||||
do_test_run() {
|
||||
initiator=$(iscsi-iname)
|
||||
run_client "netroot=iscsi target1 target2" \
|
||||
"root=LABEL=sysroot" \
|
||||
"ip=192.168.50.101:::255.255.255.0::ens3:off" \
|
||||
"ip=192.168.51.101:::255.255.255.0::ens4:off" \
|
||||
"netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
|
||||
"netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
|
||||
"rd.iscsi.initiator=$initiator" \
|
||||
|| return 1
|
||||
|
||||
|
||||
echo "All tests passed [OK]"
|
||||
return 0
|
||||
}
|
||||
|
||||
test_run() {
|
||||
if ! run_server; then
|
||||
echo "Failed to start server" 1>&2
|
||||
return 1
|
||||
fi
|
||||
do_test_run
|
||||
ret=$?
|
||||
if [[ -s $TESTDIR/server.pid ]]; then
|
||||
sudo kill -TERM $(cat $TESTDIR/server.pid)
|
||||
rm -f -- $TESTDIR/server.pid
|
||||
fi
|
||||
return $ret
|
||||
}
|
||||
|
||||
test_setup() {
|
||||
if ! command -v tgtd &>/dev/null || ! command -v tgtadm &>/dev/null; then
|
||||
echo "Need tgtd and tgtadm from scsi-target-utils"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Create the blank file to use as a root filesystem
|
||||
dd if=/dev/null of=$TESTDIR/root.ext3 bs=1M seek=20
|
||||
dd if=/dev/null of=$TESTDIR/iscsidisk2.img bs=1M seek=20
|
||||
dd if=/dev/null of=$TESTDIR/iscsidisk3.img bs=1M seek=20
|
||||
|
||||
kernel=$KVERSION
|
||||
# Create what will eventually be our root filesystem onto an overlay
|
||||
(
|
||||
export initdir=$TESTDIR/overlay/source
|
||||
. $basedir/dracut-init.sh
|
||||
(
|
||||
cd "$initdir"
|
||||
mkdir -p -- dev sys proc etc var/run tmp
|
||||
mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin
|
||||
for i in bin sbin lib lib64; do
|
||||
ln -sfnr usr/$i $i
|
||||
done
|
||||
mkdir -p -- var/lib/nfs/rpc_pipefs
|
||||
)
|
||||
inst_multiple sh shutdown poweroff stty cat ps ln ip \
|
||||
mount dmesg mkdir cp ping grep setsid
|
||||
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
|
||||
[ -f ${_terminfodir}/l/linux ] && break
|
||||
done
|
||||
inst_multiple -o ${_terminfodir}/l/linux
|
||||
inst_simple /etc/os-release
|
||||
inst ./client-init.sh /sbin/init
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
sudo ldconfig -r "$initdir"
|
||||
)
|
||||
|
||||
# second, install the files needed to make the root filesystem
|
||||
(
|
||||
export initdir=$TESTDIR/overlay
|
||||
. $basedir/dracut-init.sh
|
||||
inst_multiple sfdisk mkfs.ext3 poweroff cp umount setsid
|
||||
inst_hook initqueue 01 ./create-root.sh
|
||||
inst_hook initqueue/finished 01 ./finished-false.sh
|
||||
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
||||
)
|
||||
|
||||
# create an initramfs that will create the target root filesystem.
|
||||
# We do it this way so that we do not risk trashing the host mdraid
|
||||
# devices, volume groups, encrypted partitions, etc.
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-m "dash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules" \
|
||||
-d "piix ide-gd_mod ata_piix ext3 sd_mod" \
|
||||
--no-hostonly-cmdline -N \
|
||||
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
|
||||
rm -rf -- $TESTDIR/overlay
|
||||
|
||||
|
||||
# Need this so kvm-qemu will boot (needs non-/dev/zero local disk)
|
||||
if ! dd if=/dev/null of=$TESTDIR/client.img bs=1M seek=1; then
|
||||
echo "Unable to make client sdb image" 1>&2
|
||||
return 1
|
||||
fi
|
||||
# Invoke KVM and/or QEMU to actually create the target filesystem.
|
||||
$testdir/run-qemu \
|
||||
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext3 \
|
||||
-drive format=raw,index=1,media=disk,file=$TESTDIR/client.img \
|
||||
-drive format=raw,index=2,media=disk,file=$TESTDIR/iscsidisk2.img \
|
||||
-drive format=raw,index=3,media=disk,file=$TESTDIR/iscsidisk3.img \
|
||||
-smp 2 -m 512M -nographic -net none \
|
||||
-append "root=/dev/fakeroot rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
|
||||
-initrd $TESTDIR/initramfs.makeroot || return 1
|
||||
grep -F -m 1 -q dracut-root-block-created $TESTDIR/client.img || return 1
|
||||
rm -- $TESTDIR/client.img
|
||||
(
|
||||
export initdir=$TESTDIR/overlay
|
||||
. $basedir/dracut-init.sh
|
||||
inst_multiple poweroff shutdown
|
||||
inst_hook shutdown-emergency 000 ./hard-off.sh
|
||||
inst_hook emergency 000 ./hard-off.sh
|
||||
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
|
||||
)
|
||||
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-o "dash plymouth dmraid nfs" \
|
||||
-a "debug" \
|
||||
-d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod" \
|
||||
--no-hostonly-cmdline -N \
|
||||
-f $TESTDIR/initramfs.testing $KVERSION || return 1
|
||||
|
||||
# Make server root
|
||||
dd if=/dev/null of=$TESTDIR/server.ext3 bs=1M seek=60
|
||||
mkfs.ext3 -j -F $TESTDIR/server.ext3
|
||||
mkdir $TESTDIR/mnt
|
||||
sudo mount -o loop $TESTDIR/server.ext3 $TESTDIR/mnt
|
||||
|
||||
kernel=$KVERSION
|
||||
(
|
||||
export initdir=$TESTDIR/mnt
|
||||
. $basedir/dracut-init.sh
|
||||
(
|
||||
cd "$initdir";
|
||||
mkdir -p dev sys proc etc var/run tmp var/lib/dhcpd /etc/iscsi
|
||||
)
|
||||
inst /etc/passwd /etc/passwd
|
||||
inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
|
||||
dmesg mkdir cp ping \
|
||||
modprobe tcpdump setsid \
|
||||
/etc/services sleep mount chmod
|
||||
inst_multiple tgtd tgtadm
|
||||
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
|
||||
[ -f ${_terminfodir}/l/linux ] && break
|
||||
done
|
||||
inst_multiple -o ${_terminfodir}/l/linux
|
||||
instmods iscsi_tcp crc32c ipv6
|
||||
[ -f /etc/netconfig ] && inst_multiple /etc/netconfig
|
||||
type -P dhcpd >/dev/null && inst_multiple dhcpd
|
||||
[ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
|
||||
inst_simple /etc/os-release
|
||||
inst ./server-init.sh /sbin/init
|
||||
inst ./hosts /etc/hosts
|
||||
inst ./dhcpd.conf /etc/dhcpd.conf
|
||||
inst_multiple /etc/nsswitch.conf /etc/rpc /etc/protocols
|
||||
inst /etc/group /etc/group
|
||||
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
sudo ldconfig -r "$initdir"
|
||||
dracut_kernel_post
|
||||
)
|
||||
|
||||
sudo umount $TESTDIR/mnt
|
||||
rm -fr -- $TESTDIR/mnt
|
||||
|
||||
# Make server's dracut image
|
||||
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
|
||||
-a "dash udev-rules base rootfs-block fs-lib debug kernel-modules" \
|
||||
-d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod e1000 drbg" \
|
||||
--no-hostonly-cmdline -N \
|
||||
-f $TESTDIR/initramfs.server $KVERSION || return 1
|
||||
|
||||
}
|
||||
|
||||
test_cleanup() {
|
||||
if [[ -s $TESTDIR/server.pid ]]; then
|
||||
sudo kill -TERM $(cat $TESTDIR/server.pid)
|
||||
rm -f -- $TESTDIR/server.pid
|
||||
fi
|
||||
}
|
||||
|
||||
. $testdir/test-functions
|
||||
|
|
@ -5,7 +5,7 @@ TEST_DESCRIPTION="root filesystem on NBD"
|
|||
KVERSION=${KVERSION-$(uname -r)}
|
||||
|
||||
# Uncomment this to debug failures
|
||||
#DEBUGFAIL="rd.shell rd.break rd.debug"
|
||||
#DEBUGFAIL="rd.shell rd.break rd.debug systemd.log_target=console loglevel=7 systemd.log_level=debug"
|
||||
#SERIAL="tcp:127.0.0.1:9999"
|
||||
|
||||
run_server() {
|
||||
|
|
@ -187,7 +187,7 @@ client_run() {
|
|||
|
||||
make_encrypted_root() {
|
||||
# Create the blank file to use as a root filesystem
|
||||
dd if=/dev/null of=$TESTDIR/encrypted.ext2 bs=1M seek=20
|
||||
dd if=/dev/null of=$TESTDIR/encrypted.ext2 bs=1M seek=40
|
||||
dd if=/dev/null of=$TESTDIR/flag.img bs=1M seek=1
|
||||
|
||||
kernel=$KVERSION
|
||||
|
|
@ -258,7 +258,7 @@ make_encrypted_root() {
|
|||
}
|
||||
|
||||
make_client_root() {
|
||||
dd if=/dev/null of=$TESTDIR/nbd.ext2 bs=1M seek=30
|
||||
dd if=/dev/null of=$TESTDIR/nbd.ext2 bs=1M seek=60
|
||||
mke2fs -F -j $TESTDIR/nbd.ext2
|
||||
mkdir $TESTDIR/mnt
|
||||
sudo mount -o loop $TESTDIR/nbd.ext2 $TESTDIR/mnt
|
||||
|
|
@ -299,7 +299,7 @@ make_client_root() {
|
|||
}
|
||||
|
||||
make_server_root() {
|
||||
dd if=/dev/null of=$TESTDIR/server.ext2 bs=1M seek=30
|
||||
dd if=/dev/null of=$TESTDIR/server.ext2 bs=1M seek=60
|
||||
mke2fs -F $TESTDIR/server.ext2
|
||||
mkdir $TESTDIR/mnt
|
||||
sudo mount -o loop $TESTDIR/server.ext2 $TESTDIR/mnt
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ test_client() {
|
|||
|
||||
test_setup() {
|
||||
# Make server root
|
||||
dd if=/dev/null of="$TESTDIR"/server.ext3 bs=1M seek=60
|
||||
dd if=/dev/null of="$TESTDIR"/server.ext3 bs=1M seek=120
|
||||
mke2fs -j -F -- "$TESTDIR"/server.ext3
|
||||
mkdir -- "$TESTDIR"/mnt
|
||||
sudo mount -o loop -- "$TESTDIR"/server.ext3 "$TESTDIR"/mnt
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ run_server() {
|
|||
-hda "$TESTDIR"/server.ext3 \
|
||||
-m 512M -smp 2 \
|
||||
-display none \
|
||||
-net socket,vlan=0,listen=127.0.0.1:12350 \
|
||||
-net socket,vlan=1,listen=127.0.0.1:12351 \
|
||||
-net socket,vlan=2,listen=127.0.0.1:12352 \
|
||||
-net socket,vlan=3,listen=127.0.0.1:12353 \
|
||||
-net socket,vlan=0,listen=127.0.0.1:12370 \
|
||||
-net socket,vlan=1,listen=127.0.0.1:12371 \
|
||||
-net socket,vlan=2,listen=127.0.0.1:12372 \
|
||||
-net socket,vlan=3,listen=127.0.0.1:12373 \
|
||||
-net nic,vlan=0,macaddr=52:54:01:12:34:56,model=e1000 \
|
||||
-net nic,vlan=1,macaddr=52:54:01:12:34:57,model=e1000 \
|
||||
-net nic,vlan=2,macaddr=52:54:01:12:34:58,model=e1000 \
|
||||
|
|
@ -60,10 +60,10 @@ client_test() {
|
|||
fi
|
||||
|
||||
$testdir/run-qemu -hda "$TESTDIR"/client.img -m 512M -smp 2 -nographic \
|
||||
-net socket,vlan=0,connect=127.0.0.1:12350 \
|
||||
${do_vlan13:+-net socket,vlan=1,connect=127.0.0.1:12351} \
|
||||
-net socket,vlan=2,connect=127.0.0.1:12352 \
|
||||
${do_vlan13:+-net socket,vlan=3,connect=127.0.0.1:12353} \
|
||||
-net socket,vlan=0,connect=127.0.0.1:12370 \
|
||||
${do_vlan13:+-net socket,vlan=1,connect=127.0.0.1:12371} \
|
||||
-net socket,vlan=2,connect=127.0.0.1:12372 \
|
||||
${do_vlan13:+-net socket,vlan=3,connect=127.0.0.1:12373} \
|
||||
-net nic,vlan=0,macaddr=52:54:00:12:34:01,model=e1000 \
|
||||
-net nic,vlan=0,macaddr=52:54:00:12:34:02,model=e1000 \
|
||||
-net nic,vlan=1,macaddr=52:54:00:12:34:03,model=e1000 \
|
||||
|
|
@ -160,7 +160,7 @@ root=nfs:192.168.50.1:/nfs/client bootdev=br0
|
|||
|
||||
test_setup() {
|
||||
# Make server root
|
||||
dd if=/dev/null of="$TESTDIR"/server.ext3 bs=1M seek=60
|
||||
dd if=/dev/null of="$TESTDIR"/server.ext3 bs=1M seek=120
|
||||
mke2fs -j -F -- "$TESTDIR"/server.ext3
|
||||
mkdir -- "$TESTDIR"/mnt
|
||||
mount -o loop -- "$TESTDIR"/server.ext3 "$TESTDIR"/mnt
|
||||
|
|
|
|||
Loading…
Reference in New Issue