summaryrefslogtreecommitdiffstats
path: root/test/TEST-30-ISCSI
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 14:01:36 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 14:01:36 +0000
commit70de5d4041249c1a0f597714398cc245f59495c6 (patch)
treeff491e31b95b662ca6c481ac49d1ca8a94c0226b /test/TEST-30-ISCSI
parentAdding debian version 060+5-8. (diff)
downloaddracut-70de5d4041249c1a0f597714398cc245f59495c6.tar.xz
dracut-70de5d4041249c1a0f597714398cc245f59495c6.zip
Merging upstream version 102.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/TEST-30-ISCSI')
-rwxr-xr-xtest/TEST-30-ISCSI/client-init.sh2
-rwxr-xr-xtest/TEST-30-ISCSI/create-client-root.sh10
-rwxr-xr-xtest/TEST-30-ISCSI/create-server-root.sh6
-rwxr-xr-xtest/TEST-30-ISCSI/server-init.sh6
-rwxr-xr-xtest/TEST-30-ISCSI/test.sh55
5 files changed, 39 insertions, 40 deletions
diff --git a/test/TEST-30-ISCSI/client-init.sh b/test/TEST-30-ISCSI/client-init.sh
index 46a5e3f..d7f1370 100755
--- a/test/TEST-30-ISCSI/client-init.sh
+++ b/test/TEST-30-ISCSI/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-30-ISCSI/create-client-root.sh b/test/TEST-30-ISCSI/create-client-root.sh
index 267c93a..6c6bc9a 100755
--- a/test/TEST-30-ISCSI/create-client-root.sh
+++ b/test/TEST-30-ISCSI/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-30-ISCSI/create-server-root.sh b/test/TEST-30-ISCSI/create-server-root.sh
index 2dbc2da..004e79b 100755
--- a/test/TEST-30-ISCSI/create-server-root.sh
+++ b/test/TEST-30-ISCSI/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-30-ISCSI/server-init.sh b/test/TEST-30-ISCSI/server-init.sh
index a1c3b7e..f89464e 100755
--- a/test/TEST-30-ISCSI/server-init.sh
+++ b/test/TEST-30-ISCSI/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-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh
index ac9f096..f4bf33e 100755
--- a/test/TEST-30-ISCSI/test.sh
+++ b/test/TEST-30-ISCSI/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:12330 \
- -append "panic=1 oops=panic softlockup_panic=1 quiet 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 quiet 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
@@ -53,7 +53,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 \
@@ -126,28 +126,31 @@ 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() {
# Create what will eventually be the client root filesystem onto an overlay
- "$DRACUT" -l --keep --tmpdir "$TESTDIR" \
+ "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \
-m "test-root" \
- -i ./client-init.sh /sbin/init \
- -I "ip ping grep setsid" \
+ -I "ip grep setsid" \
-i "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \
-i "${PKGLIBDIR}/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
# 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 "test-makeroot crypt lvm mdraid" \
- -I "mkfs.ext4 setsid blockdev" \
+ -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
@@ -155,10 +158,10 @@ test_setup() {
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 200
+ qemu_add_drive disk_index disk_args "$TESTDIR"/raid0-1.img raid0-1 100
+ qemu_add_drive disk_index disk_args "$TESTDIR"/raid0-2.img raid0-2 100
# Invoke KVM and/or QEMU to actually create the target filesystem.
"$testdir"/run-qemu \
@@ -169,40 +172,36 @@ test_setup() {
rm -- "$TESTDIR"/marker.img
# Create what will eventually be the server root filesystem onto an overlay
- "$DRACUT" -l --keep --tmpdir "$TESTDIR" \
- -m "test-root network network-legacy" \
+ "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \
+ -m "test-root network-legacy" \
-d "iscsi_tcp crc32c ipv6" \
- -i ./server-init.sh /sbin/init \
-i "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \
-i "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \
- -I "modprobe chmod ip ping tcpdump setsid pidof tgtd tgtadm /etc/passwd" \
+ -I "modprobe chmod ip tcpdump setsid pidof tgtd tgtadm /etc/passwd" \
--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 "./hosts" "/etc/hosts" \
-i "./dhcpd.conf" "/etc/dhcpd.conf" \
- --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/dhcpd
+ cp ./server-init.sh "$TESTDIR"/overlay/source/sbin/init
# second, install the files needed to make the root filesystem
# 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 / \
+ "$DRACUT" -N -l -i "$TESTDIR"/overlay / \
-m "test-makeroot" \
- -I "mkfs.ext4" \
-i ./create-server-root.sh /lib/dracut/hooks/initqueue/01-create-server-root.sh \
- --nomdadmconf \
- --no-hostonly-cmdline -N \
-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 240
+ qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1
+ qemu_add_drive disk_index disk_args "$TESTDIR"/server.img root 240
# Invoke KVM and/or QEMU to actually create the target filesystem.
"$testdir"/run-qemu \
@@ -214,8 +213,8 @@ test_setup() {
# Make server's dracut image
"$DRACUT" -l \
- -a "dash rootfs-block test kernel-modules network network-legacy" \
- -d "piix ide-gd_mod ata_piix ext4 sd_mod e1000 drbg" \
+ -a "dash rootfs-block test kernel-modules network-legacy" \
+ -d "piix ide-gd_mod ata_piix ext4 sd_mod e1000 drbg virtio_pci virtio_scsi" \
-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 \