summaryrefslogtreecommitdiffstats
path: root/test/TEST-64-UDEV-STORAGE
diff options
context:
space:
mode:
Diffstat (limited to 'test/TEST-64-UDEV-STORAGE')
-rwxr-xr-xtest/TEST-64-UDEV-STORAGE/btrfs_basic.configure26
-rwxr-xr-xtest/TEST-64-UDEV-STORAGE/iscsi_lvm.configure26
-rwxr-xr-xtest/TEST-64-UDEV-STORAGE/long_sysfs_path.configure32
-rwxr-xr-xtest/TEST-64-UDEV-STORAGE/lvm_basic.configure25
-rwxr-xr-xtest/TEST-64-UDEV-STORAGE/mdadm_basic.configure25
-rwxr-xr-xtest/TEST-64-UDEV-STORAGE/mdadm_lvm.configure25
-rw-r--r--test/TEST-64-UDEV-STORAGE/meson.build43
-rwxr-xr-xtest/TEST-64-UDEV-STORAGE/multipath_basic_failover.configure31
-rwxr-xr-xtest/TEST-64-UDEV-STORAGE/nvme_basic.configure39
-rwxr-xr-xtest/TEST-64-UDEV-STORAGE/nvme_subsystem.configure39
-rwxr-xr-xtest/TEST-64-UDEV-STORAGE/simultaneous_events.configure21
-rwxr-xr-xtest/TEST-64-UDEV-STORAGE/test.sh69
-rwxr-xr-xtest/TEST-64-UDEV-STORAGE/virtio_scsi_basic.configure28
-rwxr-xr-xtest/TEST-64-UDEV-STORAGE/virtio_scsi_identically_named_partitions.configure33
14 files changed, 412 insertions, 50 deletions
diff --git a/test/TEST-64-UDEV-STORAGE/btrfs_basic.configure b/test/TEST-64-UDEV-STORAGE/btrfs_basic.configure
new file mode 100755
index 0000000..8ef58a9
--- /dev/null
+++ b/test/TEST-64-UDEV-STORAGE/btrfs_basic.configure
@@ -0,0 +1,26 @@
+#!/usr/bin/python3
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+import json
+import sys
+
+
+config = json.load(sys.stdin)
+
+config["QemuArgs"] += ["-device", "virtio-scsi-pci,id=scsi0"]
+
+for i in range(4):
+ id = f"drivebtrfsbasic{i}"
+ config["QemuDrives"] += [
+ {
+ "Id": id,
+ "Size": "350M" if i == 0 else "128M",
+ "Options": "cache=unsafe",
+ }
+ ]
+ config["QemuArgs"] += [
+ "-device",
+ f"scsi-hd,drive={id},vendor=systemd,product=foobar,serial=deadbeefbtrfs{i}",
+ ]
+
+json.dump(config, sys.stdout)
diff --git a/test/TEST-64-UDEV-STORAGE/iscsi_lvm.configure b/test/TEST-64-UDEV-STORAGE/iscsi_lvm.configure
new file mode 100755
index 0000000..ca23e33
--- /dev/null
+++ b/test/TEST-64-UDEV-STORAGE/iscsi_lvm.configure
@@ -0,0 +1,26 @@
+#!/usr/bin/python3
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+import json
+import sys
+
+
+config = json.load(sys.stdin)
+
+config["QemuArgs"] += ["-device", "virtio-scsi-pci,id=scsi0"]
+
+for i in range(4):
+ id = f"driveiscsibasic{i}"
+ config["QemuDrives"] += [
+ {
+ "Id": id,
+ "Size": "150M" if i == 0 else "70M",
+ "Options": "cache=unsafe",
+ }
+ ]
+ config["QemuArgs"] += [
+ "-device",
+ f"scsi-hd,drive={id},vendor=systemd,product=foobar,serial=deadbeefiscsi{i}",
+ ]
+
+json.dump(config, sys.stdout)
diff --git a/test/TEST-64-UDEV-STORAGE/long_sysfs_path.configure b/test/TEST-64-UDEV-STORAGE/long_sysfs_path.configure
new file mode 100755
index 0000000..6108bdb
--- /dev/null
+++ b/test/TEST-64-UDEV-STORAGE/long_sysfs_path.configure
@@ -0,0 +1,32 @@
+#!/usr/bin/python3
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+import json
+import sys
+
+
+config = json.load(sys.stdin)
+
+config["QemuDrives"] += [
+ {
+ "Id": "drive0",
+ "Size": "64M",
+ "Options": "cache=unsafe",
+ }
+]
+config["QemuArgs"] += ["-device", "pci-bridge,id=pci_bridge0,chassis_nr=64"]
+
+# Create 25 additional PCI bridges, each one connected to the previous one
+# (basically a really long extension cable), and attach a virtio drive to
+# the last one. This should force udev into attempting to create a device
+# unit with a _really_ long name.
+for bridge in range(1, 26):
+ config["QemuArgs"] += [
+ "-device",
+ f"pci-bridge,id=pci_bridge{bridge},bus=pci_bridge{bridge - 1},"
+ f"chassis_nr={64 + bridge}"
+ ]
+
+config["QemuArgs"] += ["-device", f"virtio-blk-pci,drive=drive0,scsi=off,bus=pci_bridge25"]
+
+json.dump(config, sys.stdout)
diff --git a/test/TEST-64-UDEV-STORAGE/lvm_basic.configure b/test/TEST-64-UDEV-STORAGE/lvm_basic.configure
new file mode 100755
index 0000000..9387b83
--- /dev/null
+++ b/test/TEST-64-UDEV-STORAGE/lvm_basic.configure
@@ -0,0 +1,25 @@
+#!/usr/bin/python3
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+import json
+import sys
+
+
+config = json.load(sys.stdin)
+
+config["QemuArgs"] += ["-device", "virtio-scsi-pci,id=scsi0"]
+
+for i in range(4):
+ id = f"drivelvmbasic{i}"
+ config["QemuDrives"] += [
+ {
+ "Id": id,
+ "Size": "32M",
+ "Options": "cache=unsafe",
+ }
+ ]
+ config["QemuArgs"] += [
+ "-device", f"scsi-hd,drive={id},vendor=systemd,product=foobar,serial=deadbeeflvm{i}",
+ ]
+
+json.dump(config, sys.stdout)
diff --git a/test/TEST-64-UDEV-STORAGE/mdadm_basic.configure b/test/TEST-64-UDEV-STORAGE/mdadm_basic.configure
new file mode 100755
index 0000000..3f00afa
--- /dev/null
+++ b/test/TEST-64-UDEV-STORAGE/mdadm_basic.configure
@@ -0,0 +1,25 @@
+#!/usr/bin/python3
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+import json
+import sys
+
+
+config = json.load(sys.stdin)
+
+config["QemuArgs"] += ["-device", "virtio-scsi-pci,id=scsi0"]
+
+for i in range(5):
+ id = f"drivemdadmbasic{i}"
+ config["QemuDrives"] += [
+ {
+ "Id": id,
+ "Size": "64M",
+ "Options": "cache=unsafe",
+ }
+ ]
+ config["QemuArgs"] += [
+ "-device", f"scsi-hd,drive={id},vendor=systemd,product=foobar,serial=deadbeefmdadm{i}",
+ ]
+
+json.dump(config, sys.stdout)
diff --git a/test/TEST-64-UDEV-STORAGE/mdadm_lvm.configure b/test/TEST-64-UDEV-STORAGE/mdadm_lvm.configure
new file mode 100755
index 0000000..b7661d9
--- /dev/null
+++ b/test/TEST-64-UDEV-STORAGE/mdadm_lvm.configure
@@ -0,0 +1,25 @@
+#!/usr/bin/python3
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+import json
+import sys
+
+
+config = json.load(sys.stdin)
+
+config["QemuArgs"] += ["-device", "virtio-scsi-pci,id=scsi0"]
+
+for i in range(5):
+ id = f"drivemdadmlvm{i}"
+ config["QemuDrives"] += [
+ {
+ "Id": id,
+ "Size": "64M",
+ "Options": "cache=unsafe",
+ }
+ ]
+ config["QemuArgs"] += [
+ "-device", f"scsi-hd,drive={id},vendor=systemd,product=foobar,serial=deadbeefmdadmlvm{i}",
+ ]
+
+json.dump(config, sys.stdout)
diff --git a/test/TEST-64-UDEV-STORAGE/meson.build b/test/TEST-64-UDEV-STORAGE/meson.build
new file mode 100644
index 0000000..15981ce
--- /dev/null
+++ b/test/TEST-64-UDEV-STORAGE/meson.build
@@ -0,0 +1,43 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+name = fs.name(meson.current_source_dir())
+unit = configure_file(
+ input : files('../test.service.in'),
+ output : '@0@.service'.format(name),
+ # Disable user service manager by default for performance.
+ configuration : integration_test_template['configuration'] + {
+ 'wants' : '',
+ 'after' : '',
+ },
+)
+
+foreach testcase : [
+ 'btrfs_basic',
+ 'iscsi_lvm',
+ 'long_sysfs_path',
+ 'lvm_basic',
+ 'mdadm_basic',
+ 'mdadm_lvm',
+ 'multipath_basic_failover',
+ 'nvme_basic',
+ 'nvme_subsystem',
+ 'simultaneous_events',
+ 'virtio_scsi_basic',
+ 'virtio_scsi_identically_named_partitions',
+]
+ integration_tests += [
+ integration_test_template + {
+ 'name' : '@0@-@1@'.format(name, testcase),
+ # Make sure the service is still named TEST-64-UDEV-STORAGE.service.
+ 'unit' : unit,
+ 'cmdline' : integration_test_template['cmdline'] + [
+ 'systemd.setenv=TEST_FUNCTION_NAME=testcase_@0@'.format(testcase)
+ ],
+ 'mkosi-args' : integration_test_template['mkosi-args'] + [
+ '--configure-script', files('@0@.configure'.format(testcase)),
+ ],
+ 'priority' : 10,
+ 'vm' : true,
+ },
+ ]
+endforeach
diff --git a/test/TEST-64-UDEV-STORAGE/multipath_basic_failover.configure b/test/TEST-64-UDEV-STORAGE/multipath_basic_failover.configure
new file mode 100755
index 0000000..5f323b8
--- /dev/null
+++ b/test/TEST-64-UDEV-STORAGE/multipath_basic_failover.configure
@@ -0,0 +1,31 @@
+#!/usr/bin/python3
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+import json
+import sys
+
+
+config = json.load(sys.stdin)
+
+# Add 16 multipath devices, each backed by 4 paths
+# We don't use --qemu-drive for this since they have to share the file.
+for ndisk in range(16):
+ wwn = f"0xDEADDEADBEEF{ndisk:04d}"
+ if ndisk == 0:
+ size = "16M"
+ else:
+ size = "1M"
+
+ for nback in range(4):
+ id = f"drive{ndisk}x{nback}"
+ config["QemuDrives"] += [
+ {
+ "Id": id,
+ "Size": size,
+ "Options": "cache=unsafe",
+ "FileId": str(ndisk),
+ }
+ ]
+ config["QemuArgs"] += ["-device", f"scsi-hd,drive={id},serial=MPIO{ndisk},wwn={wwn}"]
+
+json.dump(config, sys.stdout)
diff --git a/test/TEST-64-UDEV-STORAGE/nvme_basic.configure b/test/TEST-64-UDEV-STORAGE/nvme_basic.configure
new file mode 100755
index 0000000..37d0d35
--- /dev/null
+++ b/test/TEST-64-UDEV-STORAGE/nvme_basic.configure
@@ -0,0 +1,39 @@
+#!/usr/bin/python3
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+import json
+import os
+import subprocess
+import sys
+
+
+config = json.load(sys.stdin)
+
+qemu = f"qemu-system-{os.environ["QEMU_ARCHITECTURE"]}"
+result = subprocess.run([qemu, '-device', 'help'], check=True, text=True, stdout=subprocess.PIPE)
+if 'name "nvme"' not in result.stdout:
+ print("nvme device driver is not available, skipping test...", file=sys.stderr)
+ exit(77)
+
+def add_drive(i: int, serial: str) -> None:
+ global config
+ id = f"nvme{i}"
+ config["QemuDrives"] += [
+ {
+ "Id": id,
+ "Size": "1M",
+ "Options": "cache=unsafe",
+ }
+ ]
+ config["QemuArgs"] += ["-device", f"nvme,drive={id},serial={serial},num_queues=8"]
+
+for i in range(5):
+ add_drive(i, serial=f"deadbeef{i}")
+for i in range(5, 10):
+ add_drive(i, serial=f" deadbeef {i} ")
+for i in range(10, 15):
+ add_drive(i, serial=f" dead/beef/{i} ")
+for i in range(15, 20):
+ add_drive(i, serial=f"dead/../../beef/{i}")
+
+json.dump(config, sys.stdout)
diff --git a/test/TEST-64-UDEV-STORAGE/nvme_subsystem.configure b/test/TEST-64-UDEV-STORAGE/nvme_subsystem.configure
new file mode 100755
index 0000000..eb601a6
--- /dev/null
+++ b/test/TEST-64-UDEV-STORAGE/nvme_subsystem.configure
@@ -0,0 +1,39 @@
+#!/usr/bin/python3
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+import json
+import os
+import subprocess
+import sys
+
+
+config = json.load(sys.stdin)
+
+qemu = f"qemu-system-{os.environ["QEMU_ARCHITECTURE"]}"
+result = subprocess.run([qemu, '-device', 'help'], check=True, text=True, stdout=subprocess.PIPE)
+if 'name "nvme"' not in result.stdout:
+ print("nvme device driver is not available, skipping test...", file=sys.stderr)
+ exit(77)
+
+for id in ("nvme0", "nvme1"):
+ config["QemuDrives"] += [
+ {
+ "Id": id,
+ "Size": "1M",
+ "Options": "cache=unsafe",
+ }
+
+ ]
+
+config["QemuArgs"] += [
+ # Create an NVM Subsystem Device
+ "-device", "nvme-subsys,id=nvme-subsys-64,nqn=subsys64",
+ # Attach two NVM controllers to it
+ "-device", "nvme,subsys=nvme-subsys-64,serial=deadbeef",
+ "-device", "nvme,subsys=nvme-subsys-64,serial=deadbeef",
+ # And create two shared namespaces attached to both controllers
+ "-device", "nvme-ns,drive=nvme0,nsid=16,shared=on",
+ "-device", "nvme-ns,drive=nvme1,nsid=17,shared=on",
+]
+
+json.dump(config, sys.stdout)
diff --git a/test/TEST-64-UDEV-STORAGE/simultaneous_events.configure b/test/TEST-64-UDEV-STORAGE/simultaneous_events.configure
new file mode 100755
index 0000000..a0edb01
--- /dev/null
+++ b/test/TEST-64-UDEV-STORAGE/simultaneous_events.configure
@@ -0,0 +1,21 @@
+#!/usr/bin/python3
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+import json
+import sys
+
+
+config = json.load(sys.stdin)
+
+for i in range(10):
+ id = f"drivesimultaneousevents{i}"
+ config["QemuDrives"] += [
+ {
+ "Id": id,
+ "Size": "128M",
+ "Options": "cache=unsafe",
+ }
+ ]
+ config["QemuArgs"] += ["-device", f"scsi-hd,drive={id},serial=deadbeeftest{i}"]
+
+json.dump(config, sys.stdout)
diff --git a/test/TEST-64-UDEV-STORAGE/test.sh b/test/TEST-64-UDEV-STORAGE/test.sh
index b9e7bdf..b5a70ca 100755
--- a/test/TEST-64-UDEV-STORAGE/test.sh
+++ b/test/TEST-64-UDEV-STORAGE/test.sh
@@ -159,18 +159,18 @@ test_run() {
return 0
}
-testcase_megasas2_basic() {
- if ! "${QEMU_BIN:?}" -device help | grep 'name "megasas-gen2"'; then
- echo "megasas-gen2 device driver is not available, skipping test..."
+testcase_virtio_scsi_basic() {
+ if ! "${QEMU_BIN:?}" -device help | grep 'name "virtio-scsi-pci"'; then
+ echo "virtio-scsi-pci device driver is not available, skipping test..."
return 77
fi
local i
local qemu_opts=(
- "-device megasas-gen2,id=scsi0"
- "-device megasas-gen2,id=scsi1"
- "-device megasas-gen2,id=scsi2"
- "-device megasas-gen2,id=scsi3"
+ "-device virtio-scsi-pci,id=scsi0"
+ "-device virtio-scsi-pci,id=scsi1"
+ "-device virtio-scsi-pci,id=scsi2"
+ "-device virtio-scsi-pci,id=scsi3"
)
for i in {0..127}; do
@@ -268,24 +268,15 @@ testcase_virtio_scsi_identically_named_partitions() {
# and attach them to a virtio-scsi controller
local qemu_opts=("-device virtio-scsi-pci,id=scsi0,num_queues=4")
local diskpath="${TESTDIR:?}/namedpart0.img"
- local i lodev num_disk num_part qemu_timeout
+ local i num_disk qemu_timeout
if get_bool "${IS_BUILT_WITH_ASAN:=}" || ! get_bool "$QEMU_KVM"; then
num_disk=4
- num_part=4
else
num_disk=16
- num_part=8
fi
dd if=/dev/zero of="$diskpath" bs=1M count=18
- lodev="$(losetup --show -f -P "$diskpath")"
- sfdisk "${lodev:?}" <<EOF
-label: gpt
-
-$(for ((i = 1; i <= num_part; i++)); do echo 'name="Hello world", size=2M'; done)
-EOF
- losetup -d "$lodev"
for ((i = 0; i < num_disk; i++)); do
diskpath="${TESTDIR:?}/namedpart$i.img"
@@ -325,19 +316,9 @@ testcase_multipath_basic_failover() {
local qemu_opts=("-device virtio-scsi-pci,id=scsi")
local partdisk="${TESTDIR:?}/multipathpartitioned.img"
- local image lodev nback ndisk wwn
+ local image nback ndisk wwn
dd if=/dev/zero of="$partdisk" bs=1M count=16
- lodev="$(losetup --show -f -P "$partdisk")"
- sfdisk "${lodev:?}" <<EOF
-label: gpt
-
-name="first_partition", size=5M
-uuid="deadbeef-dead-dead-beef-000000000000", name="failover_part", size=5M
-EOF
- udevadm settle
- mkfs.ext4 -U "deadbeef-dead-dead-beef-111111111111" -L "failover_vol" "${lodev}p2"
- losetup -d "$lodev"
# Add 16 multipath devices, each backed by 4 paths
for ndisk in {0..15}; do
@@ -388,7 +369,7 @@ testcase_lvm_basic() {
return 77
fi
- local qemu_opts=("-device ahci,id=ahci0")
+ local qemu_opts=("-device virtio-scsi-pci,id=scsi0")
local diskpath i
# Attach 4 SATA disks to the VM (and set their model and serial fields
@@ -397,7 +378,7 @@ testcase_lvm_basic() {
diskpath="${TESTDIR:?}/lvmbasic${i}.img"
dd if=/dev/zero of="$diskpath" bs=1M count=32
qemu_opts+=(
- "-device ide-hd,bus=ahci0.$i,drive=drive$i,model=foobar,serial=deadbeeflvm$i"
+ "-device scsi-hd,drive=drive$i,vendor=systemd,product=foobar,serial=deadbeeflvm$i"
"-drive format=raw,cache=unsafe,file=$diskpath,if=none,id=drive$i"
)
done
@@ -415,7 +396,7 @@ testcase_btrfs_basic() {
return 77
fi
- local qemu_opts=("-device ahci,id=ahci0")
+ local qemu_opts=("-device virtio-scsi-pci,id=scsi0")
local diskpath i size
for i in {0..3}; do
@@ -425,7 +406,7 @@ testcase_btrfs_basic() {
dd if=/dev/zero of="$diskpath" bs=1M count="$size"
qemu_opts+=(
- "-device ide-hd,bus=ahci0.$i,drive=drive$i,model=foobar,serial=deadbeefbtrfs$i"
+ "-device scsi-hd,drive=drive$i,vendor=systemd,product=foobar,serial=deadbeefbtrfs$i"
"-drive format=raw,cache=unsafe,file=$diskpath,if=none,id=drive$i"
)
done
@@ -443,7 +424,7 @@ testcase_iscsi_lvm() {
return 77
fi
- local qemu_opts=("-device ahci,id=ahci0")
+ local qemu_opts=("-device virtio-scsi-pci,id=scsi0")
local diskpath i size
for i in {0..3}; do
@@ -454,7 +435,7 @@ testcase_iscsi_lvm() {
dd if=/dev/zero of="$diskpath" bs=1M count="$size"
qemu_opts+=(
- "-device ide-hd,bus=ahci0.$i,drive=drive$i,model=foobar,serial=deadbeefiscsi$i"
+ "-device scsi-hd,drive=drive$i,vendor=systemd,product=foobar,serial=deadbeefiscsi$i"
"-drive format=raw,cache=unsafe,file=$diskpath,if=none,id=drive$i"
)
done
@@ -475,18 +456,6 @@ testcase_long_sysfs_path() {
)
dd if=/dev/zero of="$testdisk" bs=1M count=64
- lodev="$(losetup --show -f -P "$testdisk")"
- sfdisk "${lodev:?}" <<EOF
-label: gpt
-
-name="test_swap", size=32M
-uuid="deadbeef-dead-dead-beef-000000000000", name="test_part", size=5M
-EOF
- udevadm settle
- mkswap -U "deadbeef-dead-dead-beef-111111111111" -L "swap_vol" "${lodev}p1"
- mkfs.ext4 -U "deadbeef-dead-dead-beef-222222222222" -L "data_vol" "${lodev}p2"
- losetup -d "$lodev"
-
# Create 25 additional PCI bridges, each one connected to the previous one
# (basically a really long extension cable), and attach a virtio drive to
# the last one. This should force udev into attempting to create a device
@@ -510,7 +479,7 @@ testcase_mdadm_basic() {
return 77
fi
- local qemu_opts=("-device ahci,id=ahci0")
+ local qemu_opts=("-device virtio-scsi-pci,id=scsi0")
local diskpath i size
for i in {0..4}; do
@@ -518,7 +487,7 @@ testcase_mdadm_basic() {
dd if=/dev/zero of="$diskpath" bs=1M count=64
qemu_opts+=(
- "-device ide-hd,bus=ahci0.$i,drive=drive$i,model=foobar,serial=deadbeefmdadm$i"
+ "-device scsi-hd,drive=drive$i,vendor=systemd,product=foobar,serial=deadbeefmdadm$i"
"-drive format=raw,cache=unsafe,file=$diskpath,if=none,id=drive$i"
)
done
@@ -536,7 +505,7 @@ testcase_mdadm_lvm() {
return 77
fi
- local qemu_opts=("-device ahci,id=ahci0")
+ local qemu_opts=("-device virtio-scsi-pci,id=scsi0")
local diskpath i size
for i in {0..4}; do
@@ -544,7 +513,7 @@ testcase_mdadm_lvm() {
dd if=/dev/zero of="$diskpath" bs=1M count=64
qemu_opts+=(
- "-device ide-hd,bus=ahci0.$i,drive=drive$i,model=foobar,serial=deadbeefmdadmlvm$i"
+ "-device scsi-hd,drive=drive$i,vendor=systemd,product=foobar,serial=deadbeefmdadmlvm$i"
"-drive format=raw,cache=unsafe,file=$diskpath,if=none,id=drive$i"
)
done
diff --git a/test/TEST-64-UDEV-STORAGE/virtio_scsi_basic.configure b/test/TEST-64-UDEV-STORAGE/virtio_scsi_basic.configure
new file mode 100755
index 0000000..ab8d530
--- /dev/null
+++ b/test/TEST-64-UDEV-STORAGE/virtio_scsi_basic.configure
@@ -0,0 +1,28 @@
+#!/usr/bin/python3
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+import json
+import sys
+
+
+config = json.load(sys.stdin)
+
+for i in range(4):
+ config["QemuArgs"] += ['-device', f"virtio-scsi-pci,id=scsi{i}"]
+
+for i in range(128):
+ id = f"drive{i}"
+ config["QemuDrives"] += [
+ {
+ "Id": id,
+ "Size": "1M",
+ "Options": "cache=unsafe",
+ }
+ ]
+ config["QemuArgs"] += [
+ '-device',
+ f"scsi-hd,drive={id},bus=scsi{i // 32}.0,channel=0,"
+ f"scsi-id={i % 32},lun=0",
+ ]
+
+json.dump(config, sys.stdout)
diff --git a/test/TEST-64-UDEV-STORAGE/virtio_scsi_identically_named_partitions.configure b/test/TEST-64-UDEV-STORAGE/virtio_scsi_identically_named_partitions.configure
new file mode 100755
index 0000000..e850247
--- /dev/null
+++ b/test/TEST-64-UDEV-STORAGE/virtio_scsi_identically_named_partitions.configure
@@ -0,0 +1,33 @@
+#!/usr/bin/python3
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+import json
+import os
+import subprocess
+import sys
+
+
+config = json.load(sys.stdin)
+
+qemu = f"qemu-system-{os.environ["QEMU_ARCHITECTURE"]}"
+result = subprocess.run([qemu, '-device', 'help'], check=True, text=True, stdout=subprocess.PIPE)
+if 'name "virtio-scsi-pci"' not in result.stdout:
+ print("virtio-scsi-pci device driver is not available, skipping test...", file=sys.stderr)
+ exit(77)
+
+num_disk = 16
+
+config["QemuArgs"] += ["-device", "virtio-scsi-pci,id=scsi0,num_queues=4"]
+
+for i in range(0, num_disk):
+ id = f"drive{i}"
+ config["QemuDrives"] += [
+ {
+ "Id": id,
+ "Size": "40M",
+ "Options": "cache=unsafe"
+ }
+ ]
+ config["QemuArgs"] += ["-device", f"scsi-hd,drive={id},bus=scsi0.0,channel=0,scsi-id=0,lun={i}"]
+
+json.dump(config, sys.stdout)