ZTS: Add helper for disk device check

Replace `test -b` and equivalents with `is_disk_device`, so that `-c`
is used instead on FreeBSD which has no block cache layer for devices.

Reviewed-by: Richard Elling <Richard.Elling@RichardElling.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@ixsystems.com>
Closes #9795
This commit is contained in:
Ryan Moeller
2020-01-03 12:10:17 -05:00
committed by Brian Behlendorf
parent d7164b27be
commit 665684d721
7 changed files with 46 additions and 24 deletions
+2 -3
View File
@@ -2392,13 +2392,12 @@ EOF
# each case. limit the number to max_finddisksnum
count=0
for disk in $unused_candidates; do
if [ -b $DEV_DSKDIR/${disk}s0 ]; then
if [ $count -lt $max_finddisksnum ]; then
if is_disk_device $DEV_DSKDIR/${disk}s0 && \
[ $count -lt $max_finddisksnum ]; then
unused="$unused $disk"
# do not impose limit if $@ is provided
[[ -z $@ ]] && ((count = count + 1))
fi
fi
done
# finally, return our disk list