From 79a976b9562ea33beb00c3501b0a97cdda7683ff Mon Sep 17 00:00:00 2001 From: Poorna Gottimukkula Date: Tue, 27 Aug 2024 09:58:50 -0400 Subject: [PATCH] Adding the external kola test for luks + multipath case Signed-off-by: Poorna Gottimukkula --- .../root-reprovision/luks/data/luks-test.sh | 13 +++++--- .../luks/multipath/config.ign | 1 + .../kola/root-reprovision/luks/multipath/data | 1 + .../root-reprovision/luks/multipath/test.sh | 33 +++++++++++++++++++ 4 files changed, 44 insertions(+), 4 deletions(-) create mode 120000 tests/kola/root-reprovision/luks/multipath/config.ign create mode 120000 tests/kola/root-reprovision/luks/multipath/data create mode 100755 tests/kola/root-reprovision/luks/multipath/test.sh diff --git a/tests/kola/root-reprovision/luks/data/luks-test.sh b/tests/kola/root-reprovision/luks/data/luks-test.sh index 615b4fd175..05258113e5 100755 --- a/tests/kola/root-reprovision/luks/data/luks-test.sh +++ b/tests/kola/root-reprovision/luks/data/luks-test.sh @@ -29,12 +29,17 @@ if ! grep -q no_read_workqueue <<< "${table}"; then fi ok "discard and custom option enabled for root LUKS" -# while we're here, sanity-check that boot is mounted by UUID -if ! systemctl cat boot.mount | grep -q What=/dev/disk/by-uuid; then +# while we're here, sanity-check that boot is mounted by UUID or by multipath label +if grep -q "rd.multipath=default" /proc/cmdline; then + expected_what=/dev/disk/by-label/dm-mpath-boot +else + expected_what=/dev/disk/by-uuid +fi +if ! systemctl cat boot.mount | grep -q What="${expected_what}"; then systemctl cat boot.mount - fatal "boot mounted not by UUID" + fatal "boot mounted not by ${expected_what}" fi -ok "boot mounted by UUID" +ok "boot mounted by ${expected_what}" case "${AUTOPKGTEST_REBOOT_MARK:-}" in "") diff --git a/tests/kola/root-reprovision/luks/multipath/config.ign b/tests/kola/root-reprovision/luks/multipath/config.ign new file mode 120000 index 0000000000..f72ce41f73 --- /dev/null +++ b/tests/kola/root-reprovision/luks/multipath/config.ign @@ -0,0 +1 @@ +../config.ign \ No newline at end of file diff --git a/tests/kola/root-reprovision/luks/multipath/data b/tests/kola/root-reprovision/luks/multipath/data new file mode 120000 index 0000000000..4909e06efb --- /dev/null +++ b/tests/kola/root-reprovision/luks/multipath/data @@ -0,0 +1 @@ +../data \ No newline at end of file diff --git a/tests/kola/root-reprovision/luks/multipath/test.sh b/tests/kola/root-reprovision/luks/multipath/test.sh new file mode 100755 index 0000000000..5811f56865 --- /dev/null +++ b/tests/kola/root-reprovision/luks/multipath/test.sh @@ -0,0 +1,33 @@ +#!/bin/bash +## kola: +## # This test reprovisions the rootfs. +## tags: "reprovision" +## # This uses appendKernelArgs and multipath, which is QEMU only +## platforms: qemu +## # Root reprovisioning requires at least 4GiB of memory. +## minMemory: 4096 +## # A TPM backend device is not available on s390x to suport TPM. +## architectures: "! s390x" +## # This test includes a lot of disk I/O and needs a higher +## # timeout value than the default. +## timeoutMin: 15 +## description: Verify that LUKS on a mpath disks works. +## primaryDisk: ":mpath" +## appendKernelArgs: "rd.multipath=default" + +set -xeuo pipefail + +# shellcheck disable=SC1091 +. "$KOLA_EXT_DATA/commonlib.sh" + +# Check if the child device is part of the parent device +srcdev=$(findmnt -nvr /sysroot -o SOURCE) +parent_device="/dev/mapper/mpatha" + +if ! lsblk -pno NAME "$parent_device" | grep -qw "$srcdev"; then + fatal "$srcdev is NOT a child of $parent_device." +fi +ok "$srcdev device is part of the parent $parent_device device" + +# run the rest of the tests +. $KOLA_EXT_DATA/luks-test.sh