diff --git a/.github/workflows/canary-integration-test.yml b/.github/workflows/canary-integration-test.yml index e5c9e6b61..832e4c6e6 100644 --- a/.github/workflows/canary-integration-test.yml +++ b/.github/workflows/canary-integration-test.yml @@ -283,7 +283,7 @@ jobs: - name: use local disk as OSD run: | tests/scripts/github-action-helper.sh use_local_disk - BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1) + export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)" tests/scripts/create-bluestore-partitions.sh --disk "$BLOCK" --wipe-only - name: prepare loop devices for osds @@ -349,7 +349,7 @@ jobs: - name: use local disk as OSD run: | tests/scripts/github-action-helper.sh use_local_disk - BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1) + export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)" tests/scripts/create-bluestore-partitions.sh --disk "$BLOCK" --wipe-only - name: deploy cluster @@ -394,7 +394,7 @@ jobs: - name: use local disk as OSD run: | - BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1) + export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)" tests/scripts/github-action-helper.sh use_local_disk tests/scripts/create-bluestore-partitions.sh --disk "$BLOCK" --wipe-only @@ -446,7 +446,7 @@ jobs: - name: use local disk as OSD run: | - BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1) + export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)" tests/scripts/github-action-helper.sh use_local_disk tests/scripts/create-bluestore-partitions.sh --disk "$BLOCK" --wipe-only @@ -492,13 +492,13 @@ jobs: - name: use local disk as OSD run: | - BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1) + export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)" tests/scripts/github-action-helper.sh use_local_disk tests/scripts/create-bluestore-partitions.sh --disk "$BLOCK" --wipe-only - name: create LV on disk run: | - BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1) + export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)" tests/scripts/github-action-helper.sh create_LV_on_disk $BLOCK - name: deploy cluster @@ -549,7 +549,7 @@ jobs: - name: create cluster prerequisites run: | - BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1) + export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)" tests/scripts/localPathPV.sh "$BLOCK" tests/scripts/loopDevicePV.sh 1 tests/scripts/github-action-helper.sh create_cluster_prerequisites @@ -580,7 +580,7 @@ jobs: kubectl -n rook-ceph logs deploy/rook-ceph-operator tests/scripts/github-action-helper.sh wait_for_cleanup_pod lsblk - BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1) + export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)" sudo head --bytes=60 ${BLOCK}1 sudo head --bytes=60 ${BLOCK}2 sudo head --bytes=60 /dev/loop1 @@ -716,7 +716,8 @@ jobs: - name: create cluster prerequisites run: | - tests/scripts/localPathPV.sh $(lsblk --paths|awk '/14G/ || /64G/ {print $1}'| head -1) + export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)" + tests/scripts/localPathPV.sh "$BLOCK" tests/scripts/github-action-helper.sh create_cluster_prerequisites - name: deploy cluster @@ -742,7 +743,7 @@ jobs: kubectl -n rook-ceph delete cephcluster rook-ceph kubectl -n rook-ceph logs deploy/rook-ceph-operator tests/scripts/github-action-helper.sh wait_for_cleanup_pod - BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1) + export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)" sudo head --bytes=60 ${BLOCK}1 sudo head --bytes=60 ${BLOCK}2 sudo lsblk @@ -889,7 +890,8 @@ jobs: - name: create cluster prerequisites run: | - tests/scripts/localPathPV.sh $(lsblk --paths|awk '/14G/ || /64G/ {print $1}'| head -1) + export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)" + tests/scripts/localPathPV.sh "$BLOCK" tests/scripts/github-action-helper.sh create_cluster_prerequisites - name: deploy vault @@ -970,7 +972,8 @@ jobs: - name: create cluster prerequisites run: | - tests/scripts/localPathPV.sh $(lsblk --paths|awk '/14G/ || /64G/ {print $1}'| head -1) + export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)" + tests/scripts/localPathPV.sh "$BLOCK" tests/scripts/github-action-helper.sh create_cluster_prerequisites - name: deploy vault @@ -1032,7 +1035,7 @@ jobs: - name: create LV on disk run: | - BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1) + export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)" tests/scripts/github-action-helper.sh create_LV_on_disk $BLOCK tests/scripts/localPathPV.sh /dev/test-rook-vg/test-rook-lv @@ -1080,7 +1083,7 @@ jobs: - name: use local disk into two partitions run: | tests/scripts/github-action-helper.sh use_local_disk - BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1) + export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)" tests/scripts/create-bluestore-partitions.sh --disk "$BLOCK" --osd-count 2 sudo lsblk diff --git a/.github/workflows/daily-nightly-jobs.yml b/.github/workflows/daily-nightly-jobs.yml index a10e2abef..eb0011292 100644 --- a/.github/workflows/daily-nightly-jobs.yml +++ b/.github/workflows/daily-nightly-jobs.yml @@ -57,6 +57,7 @@ jobs: - name: use local disk and create partitions for osds run: | + export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)" tests/scripts/github-action-helper.sh use_local_disk tests/scripts/create-bluestore-partitions.sh --disk "$BLOCK" --osd-count 1 @@ -160,7 +161,7 @@ jobs: - name: TestCephSmokeSuite run: | - export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1) + export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev) SKIP_CLEANUP_POLICY=false CEPH_SUITE_VERSION="quincy-devel" go test -v -timeout 1800s -run TestCephSmokeSuite github.com/rook/rook/tests/integration - name: collect common logs @@ -195,7 +196,7 @@ jobs: - name: TestCephSmokeSuite run: | - export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1) + export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev) SKIP_CLEANUP_POLICY=false CEPH_SUITE_VERSION="reef-devel" go test -v -timeout 1800s -run TestCephSmokeSuite github.com/rook/rook/tests/integration - name: collect common logs @@ -231,7 +232,7 @@ jobs: - name: TestCephSmokeSuite run: | - export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1) + export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev) SKIP_CLEANUP_POLICY=false CEPH_SUITE_VERSION=main go test -v -timeout 1800s -run TestCephSmokeSuite github.com/rook/rook/tests/integration - name: collect common logs @@ -266,7 +267,7 @@ jobs: - name: TestCephObjectSuite run: | - export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1) + export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev) SKIP_CLEANUP_POLICY=false CEPH_SUITE_VERSION="pacific-devel" go test -v -timeout 1800s -failfast -run TestCephObjectSuite github.com/rook/rook/tests/integration - name: collect common logs @@ -301,7 +302,7 @@ jobs: - name: TestCephObjectSuite run: | - export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1) + export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev) SKIP_CLEANUP_POLICY=false CEPH_SUITE_VERSION=main go test -v -timeout 1800s -failfast -run TestCephObjectSuite github.com/rook/rook/tests/integration - name: collect common logs @@ -336,7 +337,7 @@ jobs: - name: TestCephUpgradeSuite run: | - export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1) + export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev) go test -v -timeout 1800s -failfast -run TestCephUpgradeSuite/TestUpgradeCephToPacificDevel github.com/rook/rook/tests/integration - name: collect common logs @@ -371,7 +372,7 @@ jobs: - name: TestCephUpgradeSuite run: | - export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1) + export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev) go test -v -timeout 1800s -failfast -run TestCephUpgradeSuite/TestUpgradeCephToQuincyDevel github.com/rook/rook/tests/integration - name: collect common logs diff --git a/.github/workflows/encryption-pvc-kms-ibm-kp/action.yml b/.github/workflows/encryption-pvc-kms-ibm-kp/action.yml index 85e47c5b3..a0fc5f20f 100644 --- a/.github/workflows/encryption-pvc-kms-ibm-kp/action.yml +++ b/.github/workflows/encryption-pvc-kms-ibm-kp/action.yml @@ -36,7 +36,8 @@ runs: - name: create cluster prerequisites shell: bash --noprofile --norc -eo pipefail -x {0} run: | - tests/scripts/localPathPV.sh $(lsblk --paths|awk '/14G/ || /64G/ {print $1}'| head -1) + export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)" + tests/scripts/localPathPV.sh "$BLOCK" tests/scripts/github-action-helper.sh create_cluster_prerequisites - name: deploy cluster diff --git a/.github/workflows/integration-test-helm-suite.yaml b/.github/workflows/integration-test-helm-suite.yaml index 18d84fd19..0e3f1c86d 100644 --- a/.github/workflows/integration-test-helm-suite.yaml +++ b/.github/workflows/integration-test-helm-suite.yaml @@ -51,7 +51,7 @@ jobs: tests/scripts/github-action-helper.sh collect_udev_logs_in_background tests/scripts/github-action-helper.sh create_helm_tag tests/scripts/helm.sh up - export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1) + export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev) SKIP_TEST_CLEANUP=false SKIP_CLEANUP_POLICY=false go test -v -timeout 1800s -failfast -run CephHelmSuite github.com/rook/rook/tests/integration - name: collect common logs diff --git a/.github/workflows/integration-test-mgr-suite.yaml b/.github/workflows/integration-test-mgr-suite.yaml index 4b9d60b4f..a54f4d459 100644 --- a/.github/workflows/integration-test-mgr-suite.yaml +++ b/.github/workflows/integration-test-mgr-suite.yaml @@ -46,7 +46,7 @@ jobs: - name: TestCephMgrSuite run: | tests/scripts/github-action-helper.sh collect_udev_logs_in_background - export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1) + export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev) go test -v -timeout 1800s -failfast -run CephMgrSuite github.com/rook/rook/tests/integration - name: collect common logs diff --git a/.github/workflows/integration-test-multi-cluster-suite.yaml b/.github/workflows/integration-test-multi-cluster-suite.yaml index 5f705b222..fc920a98b 100644 --- a/.github/workflows/integration-test-multi-cluster-suite.yaml +++ b/.github/workflows/integration-test-multi-cluster-suite.yaml @@ -46,8 +46,9 @@ jobs: - name: TestCephMultiClusterDeploySuite run: | tests/scripts/github-action-helper.sh collect_udev_logs_in_background - export TEST_SCRATCH_DEVICE=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1)1 - export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1) + export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)" + export TEST_SCRATCH_DEVICE="${BLOCK}1" + export DEVICE_FILTER="$BLOCK" go test -v -timeout 1800s -failfast -run CephMultiClusterDeploySuite github.com/rook/rook/tests/integration - name: collect common logs diff --git a/.github/workflows/integration-test-object-suite.yaml b/.github/workflows/integration-test-object-suite.yaml index 4951ca513..b89b890f5 100644 --- a/.github/workflows/integration-test-object-suite.yaml +++ b/.github/workflows/integration-test-object-suite.yaml @@ -46,7 +46,7 @@ jobs: - name: TestCephObjectSuite run: | tests/scripts/github-action-helper.sh collect_udev_logs_in_background - export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1) + export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev) SKIP_CLEANUP_POLICY=false go test -v -timeout 2400s -failfast -run CephObjectSuite github.com/rook/rook/tests/integration - name: collect common logs diff --git a/.github/workflows/integration-test-smoke-suite.yaml b/.github/workflows/integration-test-smoke-suite.yaml index e15f686c4..d2c626185 100644 --- a/.github/workflows/integration-test-smoke-suite.yaml +++ b/.github/workflows/integration-test-smoke-suite.yaml @@ -46,7 +46,7 @@ jobs: - name: TestCephSmokeSuite run: | tests/scripts/github-action-helper.sh collect_udev_logs_in_background - export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1) + export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev) SKIP_CLEANUP_POLICY=false go test -v -timeout 1800s -failfast -run CephSmokeSuite github.com/rook/rook/tests/integration - name: collect common logs diff --git a/.github/workflows/integration-test-upgrade-suite.yaml b/.github/workflows/integration-test-upgrade-suite.yaml index 660ac2986..4a9217bf3 100644 --- a/.github/workflows/integration-test-upgrade-suite.yaml +++ b/.github/workflows/integration-test-upgrade-suite.yaml @@ -46,7 +46,7 @@ jobs: - name: TestCephUpgradeSuite run: | tests/scripts/github-action-helper.sh collect_udev_logs_in_background - export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1) + export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev) go test -v -timeout 2400s -failfast -run CephUpgradeSuite/TestUpgradeRook github.com/rook/rook/tests/integration - name: collect common logs @@ -94,7 +94,7 @@ jobs: tests/scripts/helm.sh up tests/scripts/github-action-helper.sh collect_udev_logs_in_background - export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1) + export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev) go test -v -timeout 1800s -failfast -run CephUpgradeSuite/TestUpgradeHelm github.com/rook/rook/tests/integration - name: collect common logs diff --git a/.github/workflows/integration-tests-on-release.yaml b/.github/workflows/integration-tests-on-release.yaml index 09d5623c5..48543f0d8 100644 --- a/.github/workflows/integration-tests-on-release.yaml +++ b/.github/workflows/integration-tests-on-release.yaml @@ -36,7 +36,7 @@ jobs: tests/scripts/github-action-helper.sh collect_udev_logs_in_background tests/scripts/github-action-helper.sh create_helm_tag tests/scripts/helm.sh up - export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1) + export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev) SKIP_TEST_CLEANUP=false SKIP_CLEANUP_POLICY=false go test -v -timeout 1800s -run CephHelmSuite github.com/rook/rook/tests/integration - name: collect common logs @@ -75,8 +75,9 @@ jobs: - name: TestCephMultiClusterDeploySuite run: | tests/scripts/github-action-helper.sh collect_udev_logs_in_background - export TEST_SCRATCH_DEVICE=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1)1 - export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1) + export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)" + export TEST_SCRATCH_DEVICE="/dev/${BLOCK}1" + export DEVICE_FILTER="$BLOCK" go test -v -timeout 1800s -run CephMultiClusterDeploySuite github.com/rook/rook/tests/integration - name: collect common logs @@ -115,7 +116,7 @@ jobs: - name: TestCephSmokeSuite run: | tests/scripts/github-action-helper.sh collect_udev_logs_in_background - export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1) + export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev) SKIP_CLEANUP_POLICY=false go test -v -timeout 1800s -run CephSmokeSuite github.com/rook/rook/tests/integration - name: collect common logs @@ -154,7 +155,7 @@ jobs: - name: TestCephUpgradeSuite run: | tests/scripts/github-action-helper.sh collect_udev_logs_in_background - export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1) + export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev) go test -v -timeout 2400s -run CephUpgradeSuite/TestUpgradeRook github.com/rook/rook/tests/integration - name: collect common logs @@ -196,7 +197,7 @@ jobs: tests/scripts/helm.sh up tests/scripts/github-action-helper.sh collect_udev_logs_in_background - export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1) + export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev) go test -v -timeout 1800s -run CephUpgradeSuite/TestUpgradeHelm github.com/rook/rook/tests/integration - name: collect common logs @@ -235,7 +236,7 @@ jobs: - name: TestCephObjectSuite run: | tests/scripts/github-action-helper.sh collect_udev_logs_in_background - export DEVICE_FILTER=$(lsblk|awk '/14G/ || /64G/ {print $1}'| head -1) + export DEVICE_FILTER=$(tests/scripts/github-action-helper.sh find_extra_block_dev) SKIP_CLEANUP_POLICY=false go test -v -timeout 2400s -failfast -run CephObjectSuite github.com/rook/rook/tests/integration - name: collect common logs diff --git a/.github/workflows/rgw-multisite-test/action.yml b/.github/workflows/rgw-multisite-test/action.yml index db62d5baf..5b96a18ac 100644 --- a/.github/workflows/rgw-multisite-test/action.yml +++ b/.github/workflows/rgw-multisite-test/action.yml @@ -24,7 +24,7 @@ runs: - name: use local disk into two partitions shell: bash --noprofile --norc -eo pipefail -x {0} run: | - BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}'| head -1) + export BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)" tests/scripts/github-action-helper.sh use_local_disk tests/scripts/create-bluestore-partitions.sh --disk "$BLOCK" --osd-count 2 sudo lsblk diff --git a/tests/scripts/github-action-helper.sh b/tests/scripts/github-action-helper.sh index 0db8e6280..2d29a3ded 100755 --- a/tests/scripts/github-action-helper.sh +++ b/tests/scripts/github-action-helper.sh @@ -19,7 +19,27 @@ set -xeEo pipefail ############# # VARIABLES # ############# -: "${BLOCK:=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}' | head -1)}" + +function find_extra_block_dev() { + # shellcheck disable=SC2005 # redirect doesn't work with sudo, so use echo + echo "$(sudo lsblk)" >/dev/stderr # print lsblk output to stderr for debugging in case of future errors + # relevant lsblk --pairs example: (MOUNTPOINT identifies boot partition)(PKNAME is Parent dev ID) + # NAME="sda15" SIZE="106M" TYPE="part" MOUNTPOINT="/boot/efi" PKNAME="sda" + # NAME="sdb" SIZE="75G" TYPE="disk" MOUNTPOINT="" PKNAME="" + # NAME="sdb1" SIZE="75G" TYPE="part" MOUNTPOINT="/mnt" PKNAME="sdb" + boot_dev="$(sudo lsblk --noheading --list --output MOUNTPOINT,PKNAME | grep boot | awk '{print $2}')" + echo " == find_extra_block_dev(): boot_dev='$boot_dev'" >/dev/stderr # debug in case of future errors + # --nodeps ignores partitions + extra_dev="$(sudo lsblk --noheading --list --nodeps --output KNAME | grep -v loop | grep -v "$boot_dev" | head -1)" + echo " == find_extra_block_dev(): extra_dev='$extra_dev'" >/dev/stderr # debug in case of future errors + echo "$extra_dev" # output of function +} + +: "${BLOCK:=$(find_extra_block_dev)}" +# by definition, in this file, BLOCK should only contain the "sdX" portion of the block device name +# some external scripts export BLOCK as the full "/dev/sdX" path, which this script must handle +BLOCK="$(basename $BLOCK)" + NETWORK_ERROR="connection reset by peer" SERVICE_UNAVAILABLE_ERROR="Service Unavailable" INTERNAL_ERROR="INTERNAL_ERROR" @@ -57,7 +77,7 @@ function prepare_loop_devices() { } function use_local_disk() { - BLOCK_DATA_PART=${BLOCK}1 + BLOCK_DATA_PART="/dev/${BLOCK}1" sudo apt purge snapd -y sudo dmsetup version || true sudo swapoff --all --verbose @@ -67,9 +87,9 @@ function use_local_disk() { sudo wipefs --all --force "$BLOCK_DATA_PART" else # it's the hosted runner! - sudo sgdisk --zap-all -- "${BLOCK}" - sudo dd if=/dev/zero of="${BLOCK}" bs=1M count=10 oflag=direct,dsync - sudo parted -s "${BLOCK}" mklabel gpt + sudo sgdisk --zap-all -- "/dev/${BLOCK}" + sudo dd if=/dev/zero of="/dev/${BLOCK}" bs=1M count=10 oflag=direct,dsync + sudo parted -s "/dev/${BLOCK}" mklabel gpt fi sudo lsblk } @@ -81,7 +101,7 @@ function use_local_disk_for_integration_test() { sudo umount /mnt sudo sed -i.bak '/\/mnt/d' /etc/fstab # search for the device since it keeps changing between sda and sdb - PARTITION="${BLOCK}1" + PARTITION="/dev/${BLOCK}1" sudo wipefs --all --force "$PARTITION" sudo dd if=/dev/zero of="${PARTITION}" bs=1M count=1 sudo lsblk --bytes @@ -90,8 +110,7 @@ function use_local_disk_for_integration_test() { # for more details see: https://github.com/rook/rook/issues/7405 echo "SUBSYSTEM==\"block\", ATTR{size}==\"29356032\", ACTION==\"add\", RUN+=\"/bin/chown 167:167 $PARTITION\"" | sudo tee -a /etc/udev/rules.d/01-rook.rules # for below, see: https://access.redhat.com/solutions/1465913 - block_base="$(basename "${BLOCK}")" - echo "ACTION==\"add|change\", KERNEL==\"${block_base}\", OPTIONS:=\"nowatch\"" | sudo tee -a /etc/udev/rules.d/99-z-rook-nowatch.rules + echo "ACTION==\"add|change\", KERNEL==\"${BLOCK}\", OPTIONS:=\"nowatch\"" | sudo tee -a /etc/udev/rules.d/99-z-rook-nowatch.rules # The partition is still getting reloaded occasionally during operation. See https://github.com/rook/rook/issues/8975 # Try issuing some disk-inspection commands to jog the system so it won't reload the partitions # during OSD provisioning. @@ -99,31 +118,31 @@ function use_local_disk_for_integration_test() { sudo udevadm trigger || true time sudo udevadm settle || true sudo partprobe || true - sudo lsblk --noheadings --pairs "${BLOCK}" || true - sudo sgdisk --print "${BLOCK}" || true - sudo udevadm info --query=property "${BLOCK}" || true + sudo lsblk --noheadings --pairs "/dev/${BLOCK}" || true + sudo sgdisk --print "/dev/${BLOCK}" || true + sudo udevadm info --query=property "/dev/${BLOCK}" || true sudo lsblk --noheadings --pairs "${PARTITION}" || true journalctl -o short-precise --dmesg | tail -40 || true cat /etc/fstab || true } function create_partitions_for_osds() { - tests/scripts/create-bluestore-partitions.sh --disk "$BLOCK" --osd-count 2 + tests/scripts/create-bluestore-partitions.sh --disk "/dev/$BLOCK" --osd-count 2 sudo lsblk } function create_bluestore_partitions_and_pvcs() { - BLOCK_PART="$BLOCK"2 - DB_PART="$BLOCK"1 - tests/scripts/create-bluestore-partitions.sh --disk "$BLOCK" --bluestore-type block.db --osd-count 1 + BLOCK_PART="/dev/$BLOCK"2 + DB_PART="/dev/$BLOCK"1 + tests/scripts/create-bluestore-partitions.sh --disk "/dev/$BLOCK" --bluestore-type block.db --osd-count 1 tests/scripts/localPathPV.sh "$BLOCK_PART" "$DB_PART" } function create_bluestore_partitions_and_pvcs_for_wal() { - BLOCK_PART="$BLOCK"3 - DB_PART="$BLOCK"1 - WAL_PART="$BLOCK"2 - tests/scripts/create-bluestore-partitions.sh --disk "$BLOCK" --bluestore-type block.wal --osd-count 1 + BLOCK_PART="/dev/$BLOCK"3 + DB_PART="/dev/$BLOCK"1 + WAL_PART="/dev/$BLOCK"2 + tests/scripts/create-bluestore-partitions.sh --disk "/dev/$BLOCK" --bluestore-type block.wal --osd-count 1 tests/scripts/localPathPV.sh "$BLOCK_PART" "$DB_PART" "$WAL_PART" } @@ -396,7 +415,8 @@ function create_LV_on_disk() { } function deploy_first_rook_cluster() { - BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}' | head -1) + BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)" + export BLOCK create_cluster_prerequisites cd deploy/examples/ @@ -409,7 +429,8 @@ function deploy_first_rook_cluster() { } function deploy_second_rook_cluster() { - BLOCK=$(sudo lsblk --paths | awk '/14G/ || /64G/ || /75G/ {print $1}' | head -1) + BLOCK="/dev/$(tests/scripts/github-action-helper.sh find_extra_block_dev)" + export BLOCK cd deploy/examples/ NAMESPACE=rook-ceph-secondary envsubst