scripts/common: set special name to test partitions
SPDK test script can fail during any point of the execution. To keep using the same devices between test runs in CI, those devices have to be cleaned between runs. To select device for tests or to clean before tests, the partition table and lack of mount points is used. SPDK GPT partitions were always considered not in use. Meanwhile Linux GPT were not, even if lacking a mount point. Some of the SPDK tests create Linux GPT partitions, which might remain after a test run. Linux GPT partitions created during tests now contain "SPDK_TEST" as part of their partition name. This allows marking such block devices as 'not in use', to be cleaned and used in further SPDK test. fixes #2345 Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Change-Id: I0098776239da9b0c5dcc748625485284e4863525 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11220 Reviewed-by: Michal Berger <michallinuxstuff@gmail.com> Reviewed-by: Dong Yi <dongx.yi@intel.com> Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
25abd532e2
commit
c733cd682f
@ -342,6 +342,13 @@ block_in_use() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Devices used in SPDK tests always create GPT partitions
|
||||
# with label containing SPDK_TEST string. Such devices were
|
||||
# part of the tests before, so are not considered in use.
|
||||
if [[ $pt == gpt ]] && parted "/dev/${block##*/}" -ms print | grep -q "SPDK_TEST"; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ function setup_gpt_conf() {
|
||||
done
|
||||
if [[ -n $gpt_nvme ]]; then
|
||||
# Create gpt partition table
|
||||
parted -s "$gpt_nvme" mklabel gpt mkpart first '0%' '50%' mkpart second '50%' '100%'
|
||||
parted -s "$gpt_nvme" mklabel gpt mkpart SPDK_TEST_first '0%' '50%' mkpart SPDK_TEST_second '50%' '100%'
|
||||
# change the GUID to SPDK GUID value
|
||||
SPDK_GPT_GUID=$(get_spdk_gpt)
|
||||
sgdisk -t "1:$SPDK_GPT_GUID" "$gpt_nvme"
|
||||
|
@ -91,7 +91,7 @@ if [ $(uname) = Linux ]; then
|
||||
# just create a 100MB partition - this tests our ability to detect mountpoints
|
||||
# on partitions of the device, not just the device itself; it also is faster
|
||||
# since we don't trim and initialize the whole namespace
|
||||
parted -s /dev/$blkname mkpart primary 1 100
|
||||
parted -s /dev/$blkname mkpart SPDK_TEST 1 100
|
||||
sleep 1
|
||||
mkfs.ext4 -F /dev/${blkname}p1
|
||||
mkdir -p /tmp/nvmetest
|
||||
|
@ -43,7 +43,7 @@ for fs in $fs; do
|
||||
i=$((i + 1))
|
||||
sleep 0.1
|
||||
done
|
||||
$parted_cmd mkpart primary 2048s 100%
|
||||
$parted_cmd mkpart SPDK_TEST 2048s 100%
|
||||
|
||||
mkfs_cmd="mkfs.$fs"
|
||||
if [[ $fs == "ntfs" ]] || [[ $fs == "btrfs" ]]; then
|
||||
|
@ -30,7 +30,7 @@ if (($(lsblk -r -n -o RO -d "/dev/$disk_name") == 1)); then
|
||||
fi
|
||||
|
||||
parted -s /dev/$disk_name mklabel gpt
|
||||
parted -s /dev/$disk_name mkpart primary 2048s 100%
|
||||
parted -s /dev/$disk_name mkpart SPDK_TEST 2048s 100%
|
||||
partprobe
|
||||
sleep 0.1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user