ZTS: Fix a few defaults

Linux was missing a default value for DEV_DSKDIR. Set it to /dev.
Fix resulting fallout.

SLICE_PREFIX seems like a good candidate for including in the defaults.

Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #9898
This commit is contained in:
Ryan Moeller 2020-01-31 11:51:23 -05:00 committed by GitHub
parent 9d8ce2457d
commit a3bddd49f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 11 additions and 35 deletions

View File

@ -89,8 +89,8 @@ function block_device_wait
# #
function is_physical_device #device function is_physical_device #device
{ {
typeset device=${1#$DEV_DSKDIR} typeset device=${1#$DEV_DSKDIR/}
device=${device#$DEV_RDSKDIR} device=${device#$DEV_RDSKDIR/}
if is_linux; then if is_linux; then
is_disk_device "$DEV_DSKDIR/$device" && \ is_disk_device "$DEV_DSKDIR/$device" && \
@ -216,9 +216,6 @@ function set_slice_prefix
fi fi
(( i = i + 1)) (( i = i + 1))
done done
elif is_freebsd; then
export SLICE_PREFIX="p"
return 0
fi fi
} }

View File

@ -173,6 +173,7 @@ if is_linux; then
ZVOL_DEVDIR="/dev/zvol" ZVOL_DEVDIR="/dev/zvol"
ZVOL_RDEVDIR="/dev/zvol" ZVOL_RDEVDIR="/dev/zvol"
DEV_DSKDIR="/dev"
DEV_RDSKDIR="/dev" DEV_RDSKDIR="/dev"
DEV_MPATHDIR="/dev/mapper" DEV_MPATHDIR="/dev/mapper"
@ -182,8 +183,8 @@ if is_linux; then
VDEVID_CONF="$ZEDLET_DIR/vdev_id.conf" VDEVID_CONF="$ZEDLET_DIR/vdev_id.conf"
VDEVID_CONF_ETC="/etc/zfs/vdev_id.conf" VDEVID_CONF_ETC="/etc/zfs/vdev_id.conf"
NEWFS_DEFAULT_FS="ext2" NEWFS_DEFAULT_FS="ext2"
SLICE_PREFIX=""
elif is_freebsd; then elif is_freebsd; then
unpack_opts="xv" unpack_opts="xv"
pack_opts="cf" pack_opts="cf"
@ -198,6 +199,7 @@ elif is_freebsd; then
DEV_MPATHDIR="/dev/multipath" DEV_MPATHDIR="/dev/multipath"
NEWFS_DEFAULT_FS="ufs" NEWFS_DEFAULT_FS="ufs"
SLICE_PREFIX="p"
else else
unpack_opts="xv" unpack_opts="xv"
pack_opts="cf" pack_opts="cf"
@ -211,8 +213,9 @@ else
DEV_RDSKDIR="/dev/rdsk" DEV_RDSKDIR="/dev/rdsk"
NEWFS_DEFAULT_FS="ufs" NEWFS_DEFAULT_FS="ufs"
SLICE_PREFIX="s"
fi fi
export unpack_opts pack_opts verbose unpack_preserve pack_preserve \ export unpack_opts pack_opts verbose unpack_preserve pack_preserve \
ZVOL_DEVDIR ZVOL_RDEVDIR DEV_DSKDIR DEV_RDSKDIR DEV_MPATHDIR \ ZVOL_DEVDIR ZVOL_RDEVDIR DEV_DSKDIR DEV_RDSKDIR DEV_MPATHDIR \
ZEDLET_DIR ZED_LOG ZED_DEBUG_LOG VDEVID_CONF VDEVID_CONF_ETC \ ZEDLET_DIR ZED_LOG ZED_DEBUG_LOG VDEVID_CONF VDEVID_CONF_ETC \
NEWFS_DEFAULT_FS NEWFS_DEFAULT_FS SLICE_PREFIX

View File

@ -914,14 +914,15 @@ function set_partition
typeset -i slicenum=$1 typeset -i slicenum=$1
typeset start=$2 typeset start=$2
typeset size=$3 typeset size=$3
typeset disk=$4 typeset disk=${4#$DEV_DSKDIR/}
disk=${disk#$DEV_RDSKDIR/}
case "$(uname)" in case "$(uname)" in
Linux) Linux)
if [[ -z $size || -z $disk ]]; then if [[ -z $size || -z $disk ]]; then
log_fail "The size or disk name is unspecified." log_fail "The size or disk name is unspecified."
fi fi
[[ -n $DEV_DSKDIR ]] && disk=$DEV_DSKDIR/$disk disk=$DEV_DSKDIR/$disk
typeset size_mb=${size%%[mMgG]} typeset size_mb=${size%%[mMgG]}
size_mb=${size_mb%%[mMgG][bB]} size_mb=${size_mb%%[mMgG][bB]}
@ -969,7 +970,7 @@ function set_partition
if [[ -z $size || -z $disk ]]; then if [[ -z $size || -z $disk ]]; then
log_fail "The size or disk name is unspecified." log_fail "The size or disk name is unspecified."
fi fi
[[ -n $DEV_DSKDIR ]] && disk=$DEV_DSKDIR/$disk disk=$DEV_DSKDIR/$disk
if [[ $slicenum -eq 0 ]] || ! gpart show $disk >/dev/null 2>&1; then if [[ $slicenum -eq 0 ]] || ! gpart show $disk >/dev/null 2>&1; then
gpart destroy -F $disk >/dev/null 2>&1 gpart destroy -F $disk >/dev/null 2>&1

View File

@ -73,8 +73,6 @@ if is_linux || is_freebsd; then
export SLICE5=6 export SLICE5=6
export SLICE6=7 export SLICE6=7
else else
export DEV_DSKDIR="/dev"
export SLICE_PREFIX="s"
export SLICE0=0 export SLICE0=0
export SLICE1=1 export SLICE1=1
export SLICE3=3 export SLICE3=3

View File

@ -78,7 +78,6 @@ if is_linux; then
delete_partitions delete_partitions
fi fi
else else
export SLICE_PREFIX="s"
export SLICE0=0 export SLICE0=0
export SLICE1=1 export SLICE1=1
export SLICE2=2 export SLICE2=2

View File

@ -38,7 +38,6 @@ if is_linux; then
export SLICE0=1 export SLICE0=1
export SLICE1=2 export SLICE1=2
else else
export SLICE_PREFIX="s"
export SLICE0=0 export SLICE0=0
export SLICE1=1 export SLICE1=1

View File

@ -45,7 +45,6 @@ if is_linux; then
export SLICE6=7 export SLICE6=7
export SLICE7=8 export SLICE7=8
else else
export SLICE_PREFIX="s"
export SLICE0=0 export SLICE0=0
export SLICE1=1 export SLICE1=1
export SLICE2=2 export SLICE2=2

View File

@ -40,6 +40,4 @@ if is_linux; then
devs_id[1]=$(get_persistent_disk_name $DISK2) devs_id[1]=$(get_persistent_disk_name $DISK2)
devs_id[2]=$(get_persistent_disk_name $DISK3) devs_id[2]=$(get_persistent_disk_name $DISK3)
export devs_id export devs_id
else
DEV_DSKDIR="/dev"
fi fi

View File

@ -47,8 +47,6 @@ if is_linux; then
devs_id[1]=$(get_persistent_disk_name $DISK2) devs_id[1]=$(get_persistent_disk_name $DISK2)
devs_id[2]=$(get_persistent_disk_name $DISK3) devs_id[2]=$(get_persistent_disk_name $DISK3)
export devs_id export devs_id
else
DEV_DSKDIR="/dev"
fi fi
export VDEV_FILES="$TEST_BASE_DIR/file-1 $TEST_BASE_DIR/file-2 \ export VDEV_FILES="$TEST_BASE_DIR/file-1 $TEST_BASE_DIR/file-2 \

View File

@ -38,7 +38,6 @@ if is_linux; then
export SLICE0=1 export SLICE0=1
export SLICE1=2 export SLICE1=2
else else
export SLICE_PREFIX="s"
export SLICE0=0 export SLICE0=0
export SLICE1=1 export SLICE1=1
fi fi

View File

@ -60,7 +60,6 @@ case "${#disk_array[*]}" in
log_fail "$ZFS_DISK not supported for partitioning." log_fail "$ZFS_DISK not supported for partitioning."
fi fi
else else
export DEV_DSKDIR="/dev"
ZFSSIDE_DISK=${SINGLE_DISK}s0 ZFSSIDE_DISK=${SINGLE_DISK}s0
NONZFSSIDE_DISK=${SINGLE_DISK}s1 NONZFSSIDE_DISK=${SINGLE_DISK}s1
fi fi
@ -93,7 +92,6 @@ case "${#disk_array[*]}" in
log_fail "$NONZFS_DISK not supported for partitioning." log_fail "$NONZFS_DISK not supported for partitioning."
fi fi
else else
export DEV_DSKDIR="/dev"
ZFSSIDE_DISK=${ZFS_DISK}s0 ZFSSIDE_DISK=${ZFS_DISK}s0
NONZFSSIDE_DISK=${NONZFS_DISK}s0 NONZFSSIDE_DISK=${NONZFS_DISK}s0
fi fi

View File

@ -41,7 +41,5 @@ if is_linux; then
set_device_dir set_device_dir
export SLICE=1 export SLICE=1
else else
DEV_DSKDIR="/dev"
export SLICE_PREFIX="s"
export SLICE=0 export SLICE=0
fi fi

View File

@ -32,17 +32,10 @@
verify_runnable "global" verify_runnable "global"
#export SIZE="1gb"
export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}') export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
export DISKSARRAY=$DISKS export DISKSARRAY=$DISKS
if is_linux; then if is_linux; then
set_slice_prefix set_slice_prefix
set_device_dir set_device_dir
# export SLICE=1
else
DEV_DSKDIR="/dev"
export SLICE_PREFIX="s"
# export SLICE=0
fi fi

View File

@ -35,11 +35,7 @@ verify_runnable "global"
export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}') export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
export DISKSARRAY=$DISKS export DISKSARRAY=$DISKS
if is_linux; then if is_linux; then
set_slice_prefix set_slice_prefix
set_device_dir set_device_dir
else
DEV_DSKDIR="/dev"
export SLICE_PREFIX="s"
fi fi