test/setup: Make sure big enough drive is selected for the tests
Look for drives with 2GB of space at minimum. Signed-off-by: Michal Berger <michalx.berger@intel.com> Change-Id: Ic326229120ffc5d839bbf465855d8be857ab4f73 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7377 Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Karol Latecki <karol.latecki@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
9c7f460f55
commit
0c78378a63
@ -68,3 +68,11 @@ mkfs() {
|
|||||||
mkfs.ext4 -qF "$dev" $size
|
mkfs.ext4 -qF "$dev" $size
|
||||||
mount "$dev" "$mount"
|
mount "$dev" "$mount"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sec_size_to_bytes() {
|
||||||
|
local dev=$1
|
||||||
|
|
||||||
|
[[ -e /sys/block/$dev ]] || return 1
|
||||||
|
# /size is always represented in 512B blocks
|
||||||
|
echo $(($(< "/sys/block/$dev/size") * 512))
|
||||||
|
}
|
||||||
|
@ -170,6 +170,7 @@ setup reset
|
|||||||
|
|
||||||
declare -a blocks=()
|
declare -a blocks=()
|
||||||
declare -A blocks_to_pci=()
|
declare -A blocks_to_pci=()
|
||||||
|
min_disk_size=$((1024 ** 3 * 2)) # 2GB
|
||||||
|
|
||||||
for block in "/sys/block/nvme"*; do
|
for block in "/sys/block/nvme"*; do
|
||||||
pci=$(readlink -f "$block/device/device")
|
pci=$(readlink -f "$block/device/device")
|
||||||
@ -181,7 +182,9 @@ for block in "/sys/block/nvme"*; do
|
|||||||
done
|
done
|
||||||
# Skip devices that are in use - simple blkid it to see if
|
# Skip devices that are in use - simple blkid it to see if
|
||||||
# there's any metadata (pt, fs, etc.) present on the drive.
|
# there's any metadata (pt, fs, etc.) present on the drive.
|
||||||
if ! blkid "/dev/${block##*/}"; then
|
# If the drive's size is less than 2G, skip it as we need
|
||||||
|
# something bigger for the tests.
|
||||||
|
if ! blkid "/dev/${block##*/}" && (($(sec_size_to_bytes "${block##*/}") >= min_disk_size)); then
|
||||||
blocks+=("${block##*/}")
|
blocks+=("${block##*/}")
|
||||||
blocks_to_pci["${block##*/}"]=$pci
|
blocks_to_pci["${block##*/}"]=$pci
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user