From ac09c21d4576f0b72165d9c13a701924b0916406 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Tue, 28 May 2024 14:08:18 +0200 Subject: [PATCH 1/3] TEST-64-UDEV-STORAGE: Replace megasas2 controller with virtio scsi controller The virtio-scsi driver is available in the KVM/cloud kernel packages provided by distributions whereas the megasas2 driver is not. Let's switch to virtio-scsi so we can switch back to the KVM/cloud kernel packages. --- test/TEST-64-UDEV-STORAGE/meson.build | 2 +- test/TEST-64-UDEV-STORAGE/nvme_basic.configure | 3 --- test/TEST-64-UDEV-STORAGE/test.sh | 14 +++++++------- ...basic.configure => virtio_scsi_basic.configure} | 10 +--------- test/units/TEST-64-UDEV-STORAGE.sh | 2 +- 5 files changed, 10 insertions(+), 21 deletions(-) rename test/TEST-64-UDEV-STORAGE/{megasas2_basic.configure => virtio_scsi_basic.configure} (55%) diff --git a/test/TEST-64-UDEV-STORAGE/meson.build b/test/TEST-64-UDEV-STORAGE/meson.build index 363104d861..d54c262386 100644 --- a/test/TEST-64-UDEV-STORAGE/meson.build +++ b/test/TEST-64-UDEV-STORAGE/meson.build @@ -14,11 +14,11 @@ foreach testcase : [ 'lvm_basic', 'mdadm_basic', 'mdadm_lvm', - 'megasas2_basic', 'multipath_basic_failover', 'nvme_basic', 'nvme_subsystem', 'simultaneous_events', + 'virtio_scsi_basic', 'virtio_scsi_identically_named_partitions', ] integration_tests += [ diff --git a/test/TEST-64-UDEV-STORAGE/nvme_basic.configure b/test/TEST-64-UDEV-STORAGE/nvme_basic.configure index 68cbd728c3..37d0d356fd 100755 --- a/test/TEST-64-UDEV-STORAGE/nvme_basic.configure +++ b/test/TEST-64-UDEV-STORAGE/nvme_basic.configure @@ -15,9 +15,6 @@ if 'name "nvme"' not in result.stdout: print("nvme device driver is not available, skipping test...", file=sys.stderr) exit(77) -for i in range(4): - config["QemuArgs"] += ["-device", f"megasas-gen2,id=scsi{i}"] - def add_drive(i: int, serial: str) -> None: global config id = f"nvme{i}" diff --git a/test/TEST-64-UDEV-STORAGE/test.sh b/test/TEST-64-UDEV-STORAGE/test.sh index ddcb938588..b5a70cafaf 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 diff --git a/test/TEST-64-UDEV-STORAGE/megasas2_basic.configure b/test/TEST-64-UDEV-STORAGE/virtio_scsi_basic.configure similarity index 55% rename from test/TEST-64-UDEV-STORAGE/megasas2_basic.configure rename to test/TEST-64-UDEV-STORAGE/virtio_scsi_basic.configure index 632e2de5b0..ab8d530a3e 100755 --- a/test/TEST-64-UDEV-STORAGE/megasas2_basic.configure +++ b/test/TEST-64-UDEV-STORAGE/virtio_scsi_basic.configure @@ -2,21 +2,13 @@ # 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 "megasas-gen2"' not in result.stdout: - print("megasas-gen2 device driver is not available, skipping test...", file=sys.stderr) - exit(77) - for i in range(4): - config["QemuArgs"] += ['-device', f"megasas-gen2,id=scsi{i}"] + config["QemuArgs"] += ['-device', f"virtio-scsi-pci,id=scsi{i}"] for i in range(128): id = f"drive{i}" diff --git a/test/units/TEST-64-UDEV-STORAGE.sh b/test/units/TEST-64-UDEV-STORAGE.sh index f8d49ea29d..5ddddf549b 100755 --- a/test/units/TEST-64-UDEV-STORAGE.sh +++ b/test/units/TEST-64-UDEV-STORAGE.sh @@ -168,7 +168,7 @@ helper_check_device_units() {( check_device_units 1 "$@" )} -testcase_megasas2_basic() { +testcase_virtio_scsi_basic() { lsblk -S [[ "$(lsblk --scsi --noheadings | wc -l)" -ge 128 ]] } From eb47645e21e88c5df81ddbc9ac6e4bd85a0c7b35 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 29 May 2024 14:19:17 +0200 Subject: [PATCH 2/3] test: Use virtio-scsi for keydev drive Otherwise qemu defaults to ide for which the module isn't always available (e.g. it's missing in the debian linux cloud images). --- test/TEST-24-CRYPTSETUP/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/TEST-24-CRYPTSETUP/meson.build b/test/TEST-24-CRYPTSETUP/meson.build index cef370bd65..af41f161bf 100644 --- a/test/TEST-24-CRYPTSETUP/meson.build +++ b/test/TEST-24-CRYPTSETUP/meson.build @@ -15,7 +15,8 @@ integration_tests += [ 'luks.options=0d318174-56b0-4d6e-a324-ac1e7e7d235d=x-initrd.attach', ], 'qemu-args' : [ - '-drive', 'format=raw,cache=unsafe,file=@0@'.format(project_build_root / 'mkosi.output/keydev.raw'), + '-drive', 'id=keydev,if=none,format=raw,cache=unsafe,file=@0@'.format(project_build_root / 'mkosi.output/keydev.raw'), + '-device', 'scsi-hd,drive=keydev', ], 'mkosi-args' : integration_test_template['mkosi-args'] + [ '--runtime-size=11G', From 556659adfeffcec7a74192096fd65a44866fd8ea Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Tue, 28 May 2024 14:09:57 +0200 Subject: [PATCH 3/3] mkosi: Switch back to cloud/KVM kernel packages Now that we don't need megasas2 anymore, let's switch back to the KVM/cloud kernel images to save on image size, build times and boot times. --- .../system/mkosi.conf.d/10-centos-fedora/mkosi.conf | 1 - mkosi.images/system/mkosi.conf.d/10-centos/mkosi.conf | 1 + mkosi.images/system/mkosi.conf.d/10-debian/mkosi.conf | 4 ---- .../system/mkosi.conf.d/10-debian/mkosi.conf.d/arm64.conf | 8 ++++++++ .../mkosi.conf.d/10-debian/mkosi.conf.d/x86-64.conf | 8 ++++++++ mkosi.images/system/mkosi.conf.d/10-fedora/mkosi.conf | 1 + 6 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 mkosi.images/system/mkosi.conf.d/10-debian/mkosi.conf.d/arm64.conf create mode 100644 mkosi.images/system/mkosi.conf.d/10-debian/mkosi.conf.d/x86-64.conf diff --git a/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf b/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf index 26b45e8e9c..799de75e53 100644 --- a/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf +++ b/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf @@ -40,7 +40,6 @@ Packages= iputils iscsi-initiator-utils kernel-core - kernel-modules # For squashfs and megasas2 libasan libcap-ng-utils libubsan diff --git a/mkosi.images/system/mkosi.conf.d/10-centos/mkosi.conf b/mkosi.images/system/mkosi.conf.d/10-centos/mkosi.conf index 843b96d9a6..15f888168d 100644 --- a/mkosi.images/system/mkosi.conf.d/10-centos/mkosi.conf +++ b/mkosi.images/system/mkosi.conf.d/10-centos/mkosi.conf @@ -5,4 +5,5 @@ Distribution=centos [Content] Packages= + kernel-modules # For squashfs rpmautospec-rpm-macros diff --git a/mkosi.images/system/mkosi.conf.d/10-debian/mkosi.conf b/mkosi.images/system/mkosi.conf.d/10-debian/mkosi.conf index 6441096322..c6b6155dda 100644 --- a/mkosi.images/system/mkosi.conf.d/10-debian/mkosi.conf +++ b/mkosi.images/system/mkosi.conf.d/10-debian/mkosi.conf @@ -2,7 +2,3 @@ [Match] Distribution=debian - -[Content] -Packages= - linux-image-generic diff --git a/mkosi.images/system/mkosi.conf.d/10-debian/mkosi.conf.d/arm64.conf b/mkosi.images/system/mkosi.conf.d/10-debian/mkosi.conf.d/arm64.conf new file mode 100644 index 0000000000..af923fa442 --- /dev/null +++ b/mkosi.images/system/mkosi.conf.d/10-debian/mkosi.conf.d/arm64.conf @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +[Match] +Architecture=arm64 + +[Content] +Packages= + linux-image-cloud-arm64 diff --git a/mkosi.images/system/mkosi.conf.d/10-debian/mkosi.conf.d/x86-64.conf b/mkosi.images/system/mkosi.conf.d/10-debian/mkosi.conf.d/x86-64.conf new file mode 100644 index 0000000000..615de52499 --- /dev/null +++ b/mkosi.images/system/mkosi.conf.d/10-debian/mkosi.conf.d/x86-64.conf @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +[Match] +Architecture=x86-64 + +[Content] +Packages= + linux-image-cloud-amd64 diff --git a/mkosi.images/system/mkosi.conf.d/10-fedora/mkosi.conf b/mkosi.images/system/mkosi.conf.d/10-fedora/mkosi.conf index 8c1b04dbd2..3acec1092c 100644 --- a/mkosi.images/system/mkosi.conf.d/10-fedora/mkosi.conf +++ b/mkosi.images/system/mkosi.conf.d/10-fedora/mkosi.conf @@ -10,6 +10,7 @@ Packages= dnf5 f2fs-tools scsi-target-utils + # Required for systemd-networkd-tests.py (netdevsim and sch_xxx modules) kernel-modules-extra kernel-modules-internal