diff --git a/scripts/common.sh b/scripts/common.sh index 3bfad54b1..5174487d1 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -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 } diff --git a/test/bdev/blockdev.sh b/test/bdev/blockdev.sh index cfdd03db6..8d6cdc9b7 100755 --- a/test/bdev/blockdev.sh +++ b/test/bdev/blockdev.sh @@ -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" diff --git a/test/nvme/nvme.sh b/test/nvme/nvme.sh index 7ba4a7703..7f705e833 100755 --- a/test/nvme/nvme.sh +++ b/test/nvme/nvme.sh @@ -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 diff --git a/test/vhost/integrity/integrity_vm.sh b/test/vhost/integrity/integrity_vm.sh index 3fff7eb27..c201f278c 100755 --- a/test/vhost/integrity/integrity_vm.sh +++ b/test/vhost/integrity/integrity_vm.sh @@ -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 diff --git a/test/vhost/readonly/disabled_readonly_vm.sh b/test/vhost/readonly/disabled_readonly_vm.sh index 2aec5b80a..92c2c1a39 100755 --- a/test/vhost/readonly/disabled_readonly_vm.sh +++ b/test/vhost/readonly/disabled_readonly_vm.sh @@ -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