diff options
Diffstat (limited to '')
-rwxr-xr-x | test/TEST-35-ISCSI-MULTI/client-init.sh | 2 | ||||
-rwxr-xr-x | test/TEST-35-ISCSI-MULTI/create-client-root.sh | 10 | ||||
-rwxr-xr-x | test/TEST-35-ISCSI-MULTI/create-server-root.sh | 6 | ||||
-rwxr-xr-x | test/TEST-35-ISCSI-MULTI/finished-false.sh | 2 | ||||
-rwxr-xr-x | test/TEST-35-ISCSI-MULTI/hard-off.sh | 3 | ||||
-rwxr-xr-x | test/TEST-35-ISCSI-MULTI/server-init.sh | 6 | ||||
-rwxr-xr-x | test/TEST-35-ISCSI-MULTI/test.sh | 203 |
7 files changed, 68 insertions, 164 deletions
diff --git a/test/TEST-35-ISCSI-MULTI/client-init.sh b/test/TEST-35-ISCSI-MULTI/client-init.sh index 46a5e3f..d7f1370 100755 --- a/test/TEST-35-ISCSI-MULTI/client-init.sh +++ b/test/TEST-35-ISCSI-MULTI/client-init.sh @@ -11,7 +11,7 @@ stty sane echo "made it to the rootfs! Powering down." while read -r dev _ fstype opts rest || [ -n "$dev" ]; do [ "$fstype" != "ext4" ] && continue - echo "iscsi-OK $dev $fstype $opts" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker + echo "iscsi-OK $dev $fstype $opts" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none break done < /proc/mounts diff --git a/test/TEST-35-ISCSI-MULTI/create-client-root.sh b/test/TEST-35-ISCSI-MULTI/create-client-root.sh index 267c93a..6c6bc9a 100755 --- a/test/TEST-35-ISCSI-MULTI/create-client-root.sh +++ b/test/TEST-35-ISCSI-MULTI/create-client-root.sh @@ -12,22 +12,22 @@ udevadm settle set -ex -mkfs.ext4 -j -L singleroot -F /dev/disk/by-id/ata-disk_singleroot +mkfs.ext4 -q -j -L singleroot -F /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_singleroot mkdir -p /sysroot -mount -t ext4 /dev/disk/by-id/ata-disk_singleroot /sysroot +mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_singleroot /sysroot cp -a -t /sysroot /source/* umount /sysroot -mdadm --create /dev/md0 --run --auto=yes --level=stripe --raid-devices=2 /dev/disk/by-id/ata-disk_raid0-1 /dev/disk/by-id/ata-disk_raid0-2 +mdadm --create /dev/md0 --run --auto=yes --level=stripe --raid-devices=2 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-1 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-2 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.ext4 -j -L sysroot /dev/dracut/root +mkfs.ext4 -q -j -L sysroot /dev/dracut/root mount -t ext4 /dev/dracut/root /sysroot cp -a -t /sysroot /source/* umount /sysroot lvm lvchange -a n /dev/dracut/root -echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none sync poweroff -f diff --git a/test/TEST-35-ISCSI-MULTI/create-server-root.sh b/test/TEST-35-ISCSI-MULTI/create-server-root.sh index 2dbc2da..004e79b 100755 --- a/test/TEST-35-ISCSI-MULTI/create-server-root.sh +++ b/test/TEST-35-ISCSI-MULTI/create-server-root.sh @@ -10,11 +10,11 @@ rm -f -- /etc/lvm/lvm.conf udevadm control --reload udevadm settle -mkfs.ext4 -L dracut /dev/disk/by-id/ata-disk_root +mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root mkdir -p /root -mount -t ext4 /dev/disk/by-id/ata-disk_root /root +mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /root cp -a -t /root /source/* mkdir -p /root/run umount /root -echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker +echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none poweroff -f diff --git a/test/TEST-35-ISCSI-MULTI/finished-false.sh b/test/TEST-35-ISCSI-MULTI/finished-false.sh deleted file mode 100755 index ecdbef9..0000000 --- a/test/TEST-35-ISCSI-MULTI/finished-false.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exit 1 diff --git a/test/TEST-35-ISCSI-MULTI/hard-off.sh b/test/TEST-35-ISCSI-MULTI/hard-off.sh deleted file mode 100755 index 01acb19..0000000 --- a/test/TEST-35-ISCSI-MULTI/hard-off.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -getargbool 0 rd.shell || poweroff -f -getargbool 0 failme && poweroff -f diff --git a/test/TEST-35-ISCSI-MULTI/server-init.sh b/test/TEST-35-ISCSI-MULTI/server-init.sh index a1c3b7e..f89464e 100755 --- a/test/TEST-35-ISCSI-MULTI/server-init.sh +++ b/test/TEST-35-ISCSI-MULTI/server-init.sh @@ -69,9 +69,9 @@ 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/disk/by-id/ata-disk_singleroot -tgtadm --lld iscsi --mode logicalunit --op new --tid 2 --lun 2 -b /dev/disk/by-id/ata-disk_raid0-1 -tgtadm --lld iscsi --mode logicalunit --op new --tid 3 --lun 3 -b /dev/disk/by-id/ata-disk_raid0-2 +tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_singleroot +tgtadm --lld iscsi --mode logicalunit --op new --tid 2 --lun 2 -b /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-1 +tgtadm --lld iscsi --mode logicalunit --op new --tid 3 --lun 3 -b /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-2 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 diff --git a/test/TEST-35-ISCSI-MULTI/test.sh b/test/TEST-35-ISCSI-MULTI/test.sh index 3e649a8..f807798 100755 --- a/test/TEST-35-ISCSI-MULTI/test.sh +++ b/test/TEST-35-ISCSI-MULTI/test.sh @@ -13,10 +13,10 @@ run_server() { declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img serverroot 0 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/singleroot.img singleroot - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2 + qemu_add_drive disk_index disk_args "$TESTDIR"/server.img serverroot 0 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/singleroot.img singleroot + qemu_add_drive disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2 "$testdir"/run-qemu \ "${disk_args[@]}" \ @@ -24,7 +24,7 @@ run_server() { -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:12331 \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=/dev/disk/by-id/ata-disk_serverroot rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \ + -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot root=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_serverroot rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \ -initrd "$TESTDIR"/initramfs.server \ -pidfile "$TESTDIR"/server.pid -daemonize || return 1 chmod 644 "$TESTDIR"/server.pid || return 1 @@ -52,7 +52,7 @@ run_client() { declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker test_marker_reset "$testdir"/run-qemu \ @@ -60,7 +60,7 @@ run_client() { -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:12331 \ - -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot rw rd.auto rd.retry=50 console=ttyS0,115200n81 selinux=0 rd.debug=0 rd.shell=0 $DEBUGFAIL $*" \ + -append "rw rd.auto rd.retry=50 $*" \ -initrd "$TESTDIR"/initramfs.testing if ! test_marker_check iscsi-OK; then echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]" @@ -138,70 +138,44 @@ test_check() { echo "Need tgtd and tgtadm from scsi-target-utils" return 1 fi + if ! [ -f /lib/systemd/system/iscsiuio.socket ]; then + echo "Need iscsiuio.socket to run this test" + return 1 + fi } test_setup() { - kernel=$KVERSION # Create what will eventually be our root filesystem onto an overlay rm -rf -- "$TESTDIR"/overlay - ( - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - ( - cd "$initdir" || exit - mkdir -p -- dev sys proc etc var/run tmp - mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin - mkdir -p -- var/lib/nfs/rpc_pipefs - ) - inst_multiple sh shutdown poweroff stty cat ps ln ip \ - mount dmesg mkdir cp ping grep setsid dd sync - 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_simple "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" - inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" - inst_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util" - ln -s dracut-util "${initdir}/usr/bin/dracut-getarg" - ln -s dracut-util "${initdir}/usr/bin/dracut-getargs" - - inst ./client-init.sh /sbin/init - cp -a /etc/ld.so.conf* "$initdir"/etc - ldconfig -r "$initdir" - ) + "$DRACUT" -l --keep --tmpdir "$TESTDIR" \ + -m "test-root" \ + -I "ip grep setsid" \ + -i "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ + -i "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ + --no-hostonly --no-hostonly-cmdline --nohardlink \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* + mkdir -p -- "$TESTDIR"/overlay/source/var/lib/nfs/rpc_pipefs + cp ./client-init.sh "$TESTDIR"/overlay/source/sbin/init # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2031 - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount setsid dd sync blockdev - inst_hook initqueue 01 ./create-client-root.sh - inst_hook initqueue/finished 01 ./finished-false.sh - ) - # 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. "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "dash crypt lvm mdraid kernel-modules qemu" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ + -m "test-makeroot crypt lvm mdraid" \ + -I "setsid blockdev" \ + -i ./create-client-root.sh /lib/dracut/hooks/initqueue/01-create-client-root.sh \ --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay declare -a disk_args=() declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/singleroot.img singleroot 200 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1 100 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2 100 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/singleroot.img singleroot 400 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1 200 + qemu_add_drive disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2 200 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -211,82 +185,37 @@ test_setup() { test_marker_check dracut-root-block-created || return 1 rm -- "$TESTDIR"/marker.img - # shellcheck disable=SC2031 - export kernel=$KVERSION rm -rf -- "$TESTDIR"/overlay - ( - mkdir -p "$TESTDIR"/overlay/source - # shellcheck disable=SC2031 - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay/source - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - ( - cd "$initdir" || exit - 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 \ - sleep mount chmod pidof - 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 af_packet - [ -f /etc/netconfig ] && inst_multiple /etc/netconfig - type -P dhcpd > /dev/null && inst_multiple dhcpd - inst ./server-init.sh /sbin/init - inst ./hosts /etc/hosts - inst ./dhcpd.conf /etc/dhcpd.conf - inst_multiple -o {,/usr}/etc/nsswitch.conf {,/usr}/etc/rpc \ - {,/usr}/etc/protocols {,/usr}/etc/services \ - /etc/group /etc/os-release - - _nsslibs=$( - cat "$dracutsysrootdir"/{,usr/}etc/nsswitch.conf 2> /dev/null \ - | sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' \ - | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|' - ) - _nsslibs=${_nsslibs#|} - _nsslibs=${_nsslibs%|} - - inst_libdir_file -n "$_nsslibs" 'libnss_*.so*' - - cp -a /etc/ld.so.conf* "$initdir"/etc - ldconfig -r "$initdir" - dracut_kernel_post - ) + "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \ + -m "test-root network-legacy iscsi" \ + -d "iscsi_tcp crc32c ipv6 af_packet" \ + -I "ip grep sleep setsid chmod modprobe pidof tgtd tgtadm" \ + -i "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \ + -i "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \ + --install-optional "/etc/netconfig dhcpd /etc/group /etc/nsswitch.conf /etc/rpc /etc/protocols /etc/services /usr/etc/nsswitch.conf /usr/etc/rpc /usr/etc/protocols /usr/etc/services" \ + -i /tmp/config /etc/nbd-server/config \ + -i "./hosts" "/etc/hosts" \ + -i "./dhcpd.conf" "/etc/dhcpd.conf" \ + -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1 + mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* + + mkdir -p -- "$TESTDIR"/overlay/source/var/lib/dhcpd "$TESTDIR"/overlay/source/etc/iscsi + cp ./server-init.sh "$TESTDIR"/overlay/source/sbin/init # second, install the files needed to make the root filesystem - ( - # shellcheck disable=SC2031 - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple sfdisk mkfs.ext4 poweroff cp umount sync dd - inst_hook initqueue 01 ./create-server-root.sh - inst_hook initqueue/finished 01 ./finished-false.sh - ) - # 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. - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -m "dash rootfs-block kernel-modules qemu" \ - -d "piix ide-gd_mod ata_piix ext4 sd_mod" \ - --nomdadmconf \ - --no-hostonly-cmdline -N \ + "$DRACUT" -N -l -i "$TESTDIR"/overlay / \ + -m "test-makeroot" \ + -i ./create-server-root.sh /lib/dracut/hooks/initqueue/01-create-server-root.sh \ -f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1 rm -rf -- "$TESTDIR"/overlay declare -a disk_args=() - # shellcheck disable=SC2034 declare -i disk_index=0 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1 - qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img root 60 + qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1 + qemu_add_drive disk_index disk_args "$TESTDIR"/server.img root 120 # Invoke KVM and/or QEMU to actually create the target filesystem. "$testdir"/run-qemu \ @@ -296,38 +225,18 @@ test_setup() { test_marker_check dracut-root-block-created || return 1 rm -- "$TESTDIR"/marker.img - # Make an overlay with needed tools for the test harness - ( - # shellcheck disable=SC2031 - # shellcheck disable=SC2030 - export initdir=$TESTDIR/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - inst_multiple poweroff shutdown - inst_hook shutdown-emergency 000 ./hard-off.sh - inst_hook emergency 000 ./hard-off.sh - inst_simple ./client.link /etc/systemd/network/01-client.link - ) # Make client's dracut image - "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -o "plymouth dmraid nfs" \ - -a "debug ${USE_NETWORK}" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 - - ( - # shellcheck disable=SC2031 - export initdir="$TESTDIR"/overlay - # shellcheck disable=SC1090 - . "$PKGLIBDIR"/dracut-init.sh - rm "$initdir"/etc/systemd/network/01-client.link - inst_simple ./server.link /etc/systemd/network/01-server.link - inst_hook pre-mount 99 ./wait-if-server.sh - ) + test_dracut \ + --add "$USE_NETWORK" \ + -i "./client.link" "/etc/systemd/network/01-client.link" \ + "$TESTDIR"/initramfs.testing + # Make server's dracut image "$DRACUT" -l -i "$TESTDIR"/overlay / \ - -a "dash rootfs-block debug kernel-modules network network-legacy" \ + -a "test dash rootfs-block debug kernel-modules network-legacy" \ -d "af_packet piix ide-gd_mod ata_piix ext4 sd_mod e1000 drbg" \ + -i "./server.link" "/etc/systemd/network/01-server.link" \ + -i "./wait-if-server.sh" "/lib/dracut/hooks/pre-mount/99-wait-if-server.sh" \ --no-hostonly-cmdline -N \ -f "$TESTDIR"/initramfs.server "$KVERSION" || return 1 |