AC_PATH_TOOL(COMPRESS, gzip, "")
AC_PATH_TOOL(FORMAT, parted, "")
AC_PATH_TOOL(LOCKFS, lsof, "")
+ AC_PATH_TOOL(LSBLK, lsblk, "")
AC_PATH_TOOL(MODUNLOAD, rmmod, "")
AC_PATH_TOOL(NEWFS, mke2fs, "")
AC_PATH_TOOL(PFEXEC, sudo, "")
+ AC_PATH_TOOL(READLINK, readlink, "")
AC_PATH_TOOL(SHARE, exportfs, "")
AC_PATH_TOOL(SWAP, swapon, "")
AC_PATH_TOOL(SWAPADD, swapon, "")
export LOFIADM="@LOFIADM@"
export LOGNAME="@LOGNAME@"
export LS="@LS@"
+export LSBLK="@LSBLK@"
export MD5SUM="@MD5SUM@"
export MKDIR="@MKDIR@"
export MKNOD="@MKNOD@"
export PS="@PS@"
export PSRINFO="@PSRINFO@"
export PYTHON="@PYTHON@"
+export READLINK="@READLINK@"
export REBOOT="@REBOOT@"
export RM="@RM@"
export RMDIR="@RMDIR@"
eval 'export ZFS_VERSION_$i="v${i}-fs"'
done
+export MAX_PARTITIONS=8
+
if is_linux; then
unpack_opts="--sparse -xf"
pack_opts="--sparse -cf"
ZVOL_DEVDIR="/dev/zvol"
ZVOL_RDEVDIR="/dev/zvol"
- DEV_DSKDIR="/dev"
DEV_RDSKDIR="/dev"
+ DEV_MPATHDIR="/dev/mapper"
NEWFS_DEFAULT_FS="ext2"
else
NEWFS_DEFAULT_FS="ufs"
fi
export unpack_opts pack_opts verbose unpack_preserve pack_preserve \
- ZVOL_DEVDIR ZVOL_RDEVDIR NEWFS_DEFAULT_FS DEV_DSKDIR DEV_RDSKDIR
+ ZVOL_DEVDIR ZVOL_RDEVDIR NEWFS_DEFAULT_FS DEV_RDSKDIR DEV_MPATHDIR
[[ -d $TESTDIR ]] && \
log_must $RM -rf $TESTDIR
+
+ disk1=${DISKS%% *}
+ if is_mpath_device $disk1; then
+ delete_partitions
+ fi
}
return 0
}
+#
+# Delete all partitions on all disks - this is specifically for the use of multipath
+# devices which currently can only be used in the test suite as raw/un-partitioned
+# devices (ie a zpool cannot be created on a whole mpath device that has partitions)
+#
+function delete_partitions
+{
+ typeset -i j=1
+
+ if [[ -z $DISK_ARRAY_NUM ]]; then
+ DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
+ fi
+ if [[ -z $DISKSARRAY ]]; then
+ DISKSARRAY=$DISKS
+ fi
+
+ if is_linux; then
+ if (( $DISK_ARRAY_NUM == 1 )); then
+ while ((j < MAX_PARTITIONS)); do
+ $FORMAT $DEV_DSKDIR/$DISK -s rm $j > /dev/null 2>&1
+ if (( $? == 1 )); then
+ $LSBLK | $EGREP ${DISK}${SLICE_PREFIX}${j} > /dev/null
+ if (( $? == 1 )); then
+ log_note "Partitions for $DISK should be deleted"
+ else
+ log_fail "Partition for ${DISK}${SLICE_PREFIX}${j} not deleted"
+ fi
+ return 0
+ else
+ $LSBLK | $EGREP ${DISK}${SLICE_PREFIX}${j} > /dev/null
+ if (( $? == 0 )); then
+ log_fail "Partition for ${DISK}${SLICE_PREFIX}${j} not deleted"
+ fi
+ fi
+ ((j = j+1))
+ done
+ else
+ for disk in `$ECHO $DISKSARRAY`; do
+ while ((j < MAX_PARTITIONS)); do
+ $FORMAT $DEV_DSKDIR/$disk -s rm $j > /dev/null 2>&1
+ if (( $? == 1 )); then
+ $LSBLK | $EGREP ${disk}${SLICE_PREFIX}${j} > /dev/null
+ if (( $? == 1 )); then
+ log_note "Partitions for $disk should be deleted"
+ else
+ log_fail "Partition for ${disk}${SLICE_PREFIX}${j} not deleted"
+ fi
+ j=7
+ else
+ $LSBLK | $EGREP ${disk}${SLICE_PREFIX}${j} > /dev/null
+ if (( $? == 0 )); then
+ log_fail "Partition for ${disk}${SLICE_PREFIX}${j} not deleted"
+ fi
+ fi
+ ((j = j+1))
+ done
+ j=1
+ done
+ fi
+ fi
+ return 0
+}
+
#
# Get the end cyl of the given slice
#
fi
}
+#
+# Check if the given device is a real device (ie SCSI device)
+#
+function is_real_device #disk
+{
+ typeset disk=$1
+ [[ -z $disk ]] && log_fail "No argument for disk given."
+
+ if is_linux; then
+ $LSBLK $DEV_RDSKDIR/$disk -o TYPE | $EGREP disk > /dev/null 2>&1
+ return $?
+ fi
+}
+
+#
+# Check if the given device is a loop device
+#
+function is_loop_device #disk
+{
+ typeset disk=$1
+ [[ -z $disk ]] && log_fail "No argument for disk given."
+
+ if is_linux; then
+ $LSBLK $DEV_RDSKDIR/$disk -o TYPE | $EGREP loop > /dev/null 2>&1
+ return $?
+ fi
+}
+
+#
+# Check if the given device is a multipath device and if there is a sybolic
+# link to a device mapper and to a disk
+# Currently no support for dm devices alone without multipath
+#
+function is_mpath_device #disk
+{
+ typeset disk=$1
+ [[ -z $disk ]] && log_fail "No argument for disk given."
+
+ if is_linux; then
+ $LSBLK $DEV_MPATHDIR/$disk -o TYPE | $EGREP mpath > /dev/null 2>&1
+ if (($? == 0)); then
+ $READLINK $DEV_MPATHDIR/$disk > /dev/null 2>&1
+ return $?
+ else
+ return $?
+ fi
+ fi
+}
+
+# Set the slice prefix for disk partitioning depending
+# on whether the device is a real, multipath, or loop device.
+# Currently all disks have to be of the same type, so only
+# checks first disk to determine slice prefix.
+#
+function set_slice_prefix
+{
+ typeset disk
+ typeset -i i=0
+
+ if is_linux; then
+ while (( i < $DISK_ARRAY_NUM )); do
+ disk="$($ECHO $DISKS | $NAWK '{print $(i + 1)}')"
+ if ( is_mpath_device $disk ) && [[ -z $($ECHO $disk | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $disk ); then
+ export SLICE_PREFIX=""
+ return 0
+ elif ( is_mpath_device $disk || is_loop_device $disk ); then
+ export SLICE_PREFIX="p"
+ return 0
+ else
+ log_fail "$disk not supported for partitioning."
+ fi
+ (( i = i + 1))
+ done
+ fi
+}
+
+#
+# Set the directory path of the listed devices in $DISK_ARRAY_NUM
+# Currently all disks have to be of the same type, so only
+# checks first disk to determine device directory
+# default = /dev (linux)
+# real disk = /dev (linux)
+# multipath device = /dev/mapper (linux)
+#
+function set_device_dir
+{
+ typeset disk
+ typeset -i i=0
+
+ if is_linux; then
+ while (( i < $DISK_ARRAY_NUM )); do
+ disk="$($ECHO $DISKS | $NAWK '{print $(i + 1)}')"
+ if is_mpath_device $disk; then
+ export DEV_DSKDIR=$DEV_MPATHDIR
+ return 0
+ else
+ export DEV_DSKDIR=$DEV_RDSKDIR
+ return 0
+ fi
+ (( i = i + 1))
+ done
+ else
+ export DEV_DSKDIR=$DEV_RDSKDIR
+ fi
+}
+
#
# Get the directory path of given device
#
. $STF_SUITE/include/libtest.shlib
+export DISK_ARRAY_NUM=0
+
function set_disks
{
set -A disk_array $(find_disks $DISKS)
- typeset -i DISK_ARRAY_NUM=0
-
if (( ${#disk_array[*]} <= 1 )); then
export DISK=${DISKS%% *}
else
}
set_disks
+set_device_dir
export SIZE=64M
verify_runnable "global"
-if ! $(is_physical_device $LDEV) ; then
+if ! is_physical_device $LDEV; then
log_unsupported "Only physical disk could be cache device"
fi
[[ $? == 0 ]] && log_must $ZFS umount -f $TESTDIR
destroy_pool $TESTPOOL
+if is_mpath_device $MIRROR_PRIMARY; then
+ $FORMAT $DEV_DSKDIR/$MIRROR_PRIMARY -s rm 1
+fi
+if is_mpath_device $MIRROR_SECONDARY; then
+ $FORMAT $DEV_DSKDIR/$MIRROR_SECONDARY -s rm 1
+fi
# recreate and destroy a zpool over the disks to restore the partitions to
# normal
if [[ -n $SINGLE_DISK ]]; then
SIDE_SECONDARY_PART=1
if is_linux; then
- SIDE_PRIMARY=${SINGLE_DISK}p1
- SIDE_SECONDARY=${SINGLE_DISK}p2
+ if is_mpath_device $SINGLE_DISK; then
+ export DEV_DSKDIR=$DEV_MPATHDIR
+ else
+ export DEV_DSKDIR=$DEV_RDSKDIR
+ fi
+ if ( is_mpath_device $SINGLE_DISK ) && [[ -z $($ECHO $SINGLE_DISK | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $SINGLE_DISK ); then
+ SIDE_PRIMARY=${SINGLE_DISK}1
+ SIDE_SECONDARY=${SINGLE_DISK}2
+ elif ( is_mpath_device $SINGLE_DISK || is_loop_device $SINGLE_DISK ); then
+ SIDE_PRIMARY=${SINGLE_DISK}p1
+ SIDE_SECONDARY=${SINGLE_DISK}p2
+ else
+ log_fail "$SINGLE_DISK not supported for partitioning."
+ fi
else
+ export DEV_DSKDIR="/dev"
SIDE_PRIMARY=${SINGLE_DISK}s${SIDE_PRIMARY_PART}
SIDE_SECONDARY=${SINGLE_DISK}s${SIDE_SECONDARY_PART}
fi
SIDE_PRIMARY_PART=0
SIDE_SECONDARY_PART=0
if is_linux; then
- SIDE_PRIMARY=${MIRROR_PRIMARY}p1
- SIDE_SECONDARY=${MIRROR_SECONDARY}p1
+ if is_mpath_device $MIRROR_PRIMARY; then
+ export DEV_DSKDIR=$DEV_MPATHDIR
+ else
+ export DEV_DSKDIR=$DEV_RDSKDIR
+ fi
+ if ( is_mpath_device $MIRROR_PRIMARY ) && [[ -z $($ECHO $MIRROR_PRIMARY | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $MIRROR_PRIMARY ); then
+ SIDE_PRIMARY=${MIRROR_PRIMARY}1
+ elif ( is_mpath_device $MIRROR_PRIMARY || is_loop_device $MIRROR_PRIMARY ); then
+ SIDE_PRIMARY=${MIRROR_PRIMARY}p1
+ else
+ log_fail "$MIRROR_PRIMARY not supported for partitioning."
+ fi
+ if ( is_mpath_device $MIRROR_SECONDARY ) && [[ -z $($ECHO $MIRROR_SECONDARY | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $MIRROR_SECONDARY ); then
+ SIDE_SECONDARY=${MIRROR_SECONDARY}1
+ elif ( is_mpath_device $MIRROR_SECONDARY || is_loop_device $MIRROR_SECONDARY ); then
+ SIDE_SECONDARY=${MIRROR_SECONDARY}p1
+ else
+ log_fail "$MIRROR_SECONDARY not supported for partitioning."
+ fi
+
else
+ export DEV_DSKDIR="/dev"
SIDE_PRIMARY=${MIRROR_PRIMARY}s${SIDE_PRIMARY_PART}
SIDE_SECONDARY=${MIRROR_SECONDARY}s${SIDE_SECONDARY_PART}
fi
verify_runnable "global"
-if ! $(is_physical_device $DISKS) ; then
+if ! is_physical_device $DISKS; then
log_unsupported "This directory cannot be run on raw files."
fi
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/cli_root/zpool_add/zpool_add.kshlib
+DISK=${DISKS%% *}
+if is_mpath_device $DISK; then
+ delete_partitions
+fi
+
cleanup_devices $DISKS
log_pass
log_unsupported "This directory cannot be run on raw files."
fi
+disk1=${DISKS%% *}
+if is_mpath_device $disk1; then
+ delete_partitions
+fi
+
if [[ -n $DISK ]]; then
#
# Use 'zpool create' to clean up the infomation in
export SIZE1="250m"
if is_linux; then
- export SLICE_PREFIX="p"
+ set_device_dir
+ set_slice_prefix
export SLICE0=1
export SLICE1=2
export SLICE3=4
export SLICE5=6
export SLICE6=7
else
+ export DEV_DSKDIR="/dev"
export SLICE_PREFIX="s"
export SLICE0=0
export SLICE1=1
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
+[[ -z $FORMAT ]] || \
+[[ -z $MKDIR ]] || \
+[[ -z $LSBLK ]] || \
+[[ -z $READLINK ]] || \
+[[ -z $TOUCH ]] && \
+ log_fail "Missing required commands"
+
verify_runnable "global"
if ! $(is_physical_device $DISKS) ; then
if (( ${#disk_array[*]} <= 1 )); then
export DISK=${DISKS%% *}
+ export DISK_ARRAY_NUM=1
else
export DISK=""
typeset -i i=0
export SIZE1="250m"
if is_linux; then
- export SLICE_PREFIX="p"
+ set_device_dir
+ set_slice_prefix
export SLICE0=1
export SLICE1=2
export SLICE2=3
export SLICE5=6
export SLICE6=7
export SLICE7=8
+ disk1=${DISKS%% *}
+ if is_mpath_device $disk1; then
+ delete_partitions
+ fi
else
export SLICE_PREFIX="s"
export SLICE0=0
tmpfile="/var/tmp/zpool_create_003.tmp$$"
-log_assert "'zpool create -n <pool> <vspec> ...' can display the configureation" \
+log_assert "'zpool create -n <pool> <vspec> ...' can display the configuration" \
"without actually creating the pool."
log_onexit cleanup
disk=$DISK0
fi
+DISK=${DISKS%% *}
+if is_mpath_device $DISK; then
+ partition_disk $SIZE $disk 1
+fi
+
#
# Make sure disk is clean before we use it
#
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
#
# DESCRIPTION:
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/cli_root/zfs_create/zfs_create_common.kshlib
+. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
#
# DESCRIPTION:
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/cli_root/zfs_create/zfs_create_common.kshlib
+. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
#
# DESCRIPTION:
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
################################################################################
#
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
################################################################################
#
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
################################################################################
#
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
################################################################################
#
export DISK=${DISKS%% *}
if is_linux; then
- export SLICE_PREFIX="p"
+ set_device_dir
+ set_slice_prefix
export SLICE0=1
export SLICE1=2
else
dist_pkgdata_SCRIPTS = \
setup.ksh \
cleanup.ksh \
+ zpool_export.cfg \
zpool_export_001_pos.ksh \
zpool_export_002_pos.ksh \
zpool_export_003_neg.ksh \
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zpool_export/zpool_export.cfg
DISK=${DISKS%% *}
--- /dev/null
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# Copyright (c) 2012, 2014 by Delphix. All rights reserved.
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+export DISK_ARRAY_NUM=0
+export DISK_ARRAY_LIMIT=4
+export DISKSARRAY=""
+export VDEVS_NUM=32
+
+function set_disks
+{
+ typeset -a disk_array=($(find_disks $DISKS))
+
+ if (( ${#disk_array[*]} <= 1 )); then
+ export DISK=${DISKS%% *}
+ else
+ export DISK=""
+ typeset -i i=0
+ while (( i < ${#disk_array[*]} )); do
+ export DISK${i}="${disk_array[$i]}"
+ DISKSARRAY="$DISKSARRAY ${disk_array[$i]}"
+ (( i = i + 1 ))
+ (( i>$DISK_ARRAY_LIMIT )) && break
+ done
+ export DISK_ARRAY_NUM=$i
+ export DISKSARRAY
+ fi
+}
+
+set_disks
+set_device_dir
# Use is subject to license terms.
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zpool_export/zpool_export.cfg
#
# DESCRIPTION:
log_must $RM -rf $dir
done
+DISK=${DISKS%% *}
+if is_mpath_device $DISK; then
+ delete_partitions
+fi
# recreate and destroy a zpool over the disks to restore the partitions to
# normal
case $DISK_COUNT in
log_must $ZFS create $TESTPOOL/$TESTFS
log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
-log_must set_partition 0 "" $FS_SIZE $ZFS_DISK2
-$ECHO "y" | $NEWFS -v $DEV_RDSKDIR/$ZFSSIDE_DISK2 >/dev/null 2>&1
-(( $? != 0 )) &&
- log_untested "Unable to setup a $NEWFS_DEFAULT_FS file system"
-
-[[ ! -d $DEVICE_DIR ]] && \
- log_must $MKDIR -p $DEVICE_DIR
-
-log_must $MOUNT $DEV_DSKDIR/$ZFSSIDE_DISK2 $DEVICE_DIR
+DISK2="$($ECHO $DISKS | $NAWK '{print $2}')"
+if is_mpath_device $DISK2; then
+ $ECHO "y" | $NEWFS -v $DEV_DSKDIR/$DISK2 >/dev/null 2>&1
+ (( $? != 0 )) &&
+ log_untested "Unable to setup a $NEWFS_DEFAULT_FS file system"
+
+ [[ ! -d $DEVICE_DIR ]] && \
+ log_must $MKDIR -p $DEVICE_DIR
+
+ log_must $MOUNT $DEV_DSKDIR/$DISK2 $DEVICE_DIR
+else
+ log_must set_partition 0 "" $FS_SIZE $ZFS_DISK2
+ $ECHO "y" | $NEWFS -v $DEV_DSKDIR/$ZFSSIDE_DISK2 >/dev/null 2>&1
+ (( $? != 0 )) &&
+ log_untested "Unable to setup a $NEWFS_DEFAULT_FS file system"
+
+ [[ ! -d $DEVICE_DIR ]] && \
+ log_must $MKDIR -p $DEVICE_DIR
+
+ log_must $MOUNT $DEV_DSKDIR/$ZFSSIDE_DISK2 $DEVICE_DIR
+fi
i=0
while (( i < $MAX_NUM )); do
. $STF_SUITE/include/libtest.shlib
+export DISKSARRAY=$DISKS
+export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
typeset -a disk_array=($(find_disks $DISKS))
case "${#disk_array[*]}" in
0)
if is_linux; then
DISK_COUNT=1
ZFS_DISK1=${disk_array[0]}
- ZFSSIDE_DISK1=${ZFS_DISK1}p1
ZFS_DISK2=${disk_array[0]}
- ZFSSIDE_DISK2=${ZFS_DISK2}p2
+ if is_mpath_device $ZFS_DISK1; then
+ export DEV_DSKDIR=$DEV_MPATHDIR
+ else
+ export DEV_DSKDIR=$DEV_RDSKDIR
+ fi
+ if ( is_mpath_device $ZFS_DISK1 ) && [[ -z $($ECHO $ZFS_DISK1 | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $ZFS_DISK1 ); then
+ ZFSSIDE_DISK1=${ZFS_DISK1}1
+ ZFSSIDE_DISK2=${ZFS_DISK2}2
+ elif ( is_mpath_device $ZFS_DISK1 || is_loop_device $ZFS_DISK1 ); then
+ ZFSSIDE_DISK1=${ZFS_DISK1}p1
+ ZFSSIDE_DISK2=${ZFS_DISK2}p2
+ else
+ log_fail "$ZFS_DISK1 not supported for partitioning."
+ fi
else
+ export DEV_DSKDIR="/dev"
DISK_COUNT=1
ZFS_DISK1=${disk_array[0]}
ZFSSIDE_DISK1=${ZFS_DISK1}s0
if is_linux; then
DISK_COUNT=2
ZFS_DISK1=${disk_array[0]}
- ZFSSIDE_DISK1=${ZFS_DISK1}p1
+ if is_mpath_device $ZFS_DISK1; then
+ export DEV_DSKDIR=$DEV_MPATHDIR
+ else
+ export DEV_DSKDIR=$DEV_RDSKDIR
+ fi
+ if ( is_mpath_device $ZFS_DISK1 ) && [[ -z $($ECHO $ZFS_DISK1 | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $ZFS_DISK1 ); then
+ ZFSSIDE_DISK1=${ZFS_DISK1}1
+ elif ( is_mpath_device $ZFS_DISK1 || is_loop_device $ZFS_DISK1 ); then
+ ZFSSIDE_DISK1=${ZFS_DISK1}p1
+ else
+ log_fail "$ZFS_DISK1 not supported for partitioning."
+ fi
ZFS_DISK2=${disk_array[1]}
- ZFSSIDE_DISK2=${ZFS_DISK2}p1
+ if ( is_mpath_device $ZFS_DISK2 ) && [[ -z $($ECHO $ZFS_DISK2 | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $ZFS_DISK2 ); then
+ ZFSSIDE_DISK2=${ZFS_DISK2}1
+ elif ( is_mpath_device $ZFS_DISK2 || is_loop_device $ZFS_DISK2 ); then
+ ZFSSIDE_DISK2=${ZFS_DISK2}p1
+ else
+ log_fail "$ZFS_DISK2 not supported for partitioning."
+ fi
else
+ export DEV_DSKDIR="/dev"
DISK_COUNT=2
ZFS_DISK1=${disk_array[0]}
ZFSSIDE_DISK1=${ZFS_DISK1}s0
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zpool_remove/zpool_remove.cfg
+
+DISK=${DISKS%% *}
+if is_mpath_device $DISK; then
+ delete_partitions
+fi
cleanup_devices $DISKS
export DISK=${DISKS%% *}
export SIZE="200m"
+export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
+export DISKSARRAY=$DISKS
if is_linux; then
- export SLICE_PREFIX="p"
+ set_device_dir
+ set_slice_prefix
export SLICE0=1
export SLICE1=2
export SLICE2=3
# Copyright (c) 2012 by Delphix. All rights reserved.
#
-export DISK1=$($ECHO $DISKS | $AWK '{print $1}')
+export DISK1=${DISKS%% *}
export DISK2=$($ECHO $DISKS | $AWK '{print $2}')
export WRITE_COUNT=65536000
if is_linux; then
- export SLICE_PREFIX="p"
+ set_device_dir
+ set_slice_prefix
export SLICE=1
export SLICE0=1
export SLICE1=2
if is_linux; then
export SLICES="0 1 2 3 4"
- export SLICE_PREFIX="p"
+ set_device_dir
+ set_slice_prefix
export SLICE0=1
export SLICE1=2
export SLICE2=3
. $STF_SUITE/include/libtest.shlib
if is_linux; then
- export SLICE_PREFIX="p"
+ set_device_dir
+ set_slice_prefix
export SLICE0=1
export SLICE1=2
else
[[ $? == 0 ]] && log_must $ZFS umount -f $TESTDIR
destroy_pool $TESTPOOL
+DISK=${DISKS%% *}
+if is_mpath_device $DISK; then
+ delete_partitions
+fi
+
# recreate and destroy a zpool over the disks to restore the partitions to
# normal
case $DISK_COUNT in
. $STF_SUITE/include/libtest.shlib
+export DISKSARRAY=$DISKS
+export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
set -A disk_array $(find_disks $DISKS)
case "${#disk_array[*]}" in
0)
SINGLE_DISK=$ZFS_DISK
NONZFS_DISK=$ZFS_DISK
if is_linux; then
- ZFSSIDE_DISK=${SINGLE_DISK}p1
- NONZFSSIDE_DISK=${SINGLE_DISK}p2
+ if is_mpath_device $ZFS_DISK; then
+ export DEV_DSKDIR=$DEV_MPATHDIR
+ else
+ export DEV_DSKDIR=$DEV_RDSKDIR
+ fi
+ if ( is_mpath_device $ZFS_DISK ) && [[ -z $($ECHO $ZFS_DISK | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $ZFS_DISK ); then
+ ZFSSIDE_DISK=${SINGLE_DISK}1
+ NONZFSSIDE_DISK=${SINGLE_DISK}2
+ elif ( is_mpath_device $ZFS_DISK || is_loop_device $ZFS_DISK ); then
+ ZFSSIDE_DISK=${SINGLE_DISK}p1
+ NONZFSSIDE_DISK=${SINGLE_DISK}p2
+ else
+ log_fail "$ZFS_DISK not supported for partitioning."
+ fi
else
+ export DEV_DSKDIR="/dev"
ZFSSIDE_DISK=${SINGLE_DISK}s0
NONZFSSIDE_DISK=${SINGLE_DISK}s1
fi
ZFS_DISK=${disk_array[0]}
NONZFS_DISK=${disk_array[1]}
if is_linux; then
- ZFSSIDE_DISK=${ZFS_DISK}p1
- NONZFSSIDE_DISK=${NONZFS_DISK}p1
+ if is_mpath_device $ZFS_DISK; then
+ export DEV_DSKDIR=$DEV_MPATHDIR
+ else
+ export DEV_DSKDIR=$DEV_RDSKDIR
+ fi
+ if ( is_mpath_device $ZFS_DISK ) && [[ -z $($ECHO $ZFS_DISK | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $ZFS_DISK ); then
+ ZFSSIDE_DISK=${ZFS_DISK}1
+ elif ( is_mpath_device $ZFS_DISK || is_loop_device $ZFS_DISK ); then
+ ZFSSIDE_DISK=${ZFS_DISK}p1
+ else
+ log_fail "$ZFS_DISK not supported for partitioning."
+ fi
+ if ( is_mpath_device $NONZFS_DISK ) && [[ -z $($ECHO $NONZFS_DISK | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $NONZFS_DISK ); then
+ NONZFSSIDE_DISK=${NONZFS_DISK}1
+ elif ( is_mpath_device $NONZFS_DISK || is_loop_device $NONZFS_DISK ); then
+ NONZFSSIDE_DISK=${NONZFS_DISK}p1
+ else
+ log_fail "$NONZFS_DISK not supported for partitioning."
+ fi
else
+ export DEV_DSKDIR="/dev"
ZFSSIDE_DISK=${ZFS_DISK}s0
NONZFSSIDE_DISK=${NONZFS_DISK}s0
fi
$RM -rf $NONZFS_TESTDIR || log_unresolved Could not remove $NONZFS_TESTDIR
$MKDIR -p $NONZFS_TESTDIR || log_unresolved Could not create $NONZFS_TESTDIR
-$ECHO "y" | $NEWFS -v ${DEV_RDSKDIR}/$NONZFSSIDE_DISK
+$ECHO "y" | $NEWFS -v ${DEV_DSKDIR}/$NONZFSSIDE_DISK
(( $? != 0 )) &&
log_untested "Unable to setup a UFS file system"
dist_pkgdata_SCRIPTS = \
setup.ksh \
cleanup.ksh \
+ mmap.cfg \
mmap_read_001_pos.ksh \
mmap_write_001_pos.ksh
--- /dev/null
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# Copyright (c) 2012, 2014 by Delphix. All rights reserved.
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+export DISK_ARRAY_NUM=0
+export DISK_ARRAY_LIMIT=4
+export DISKSARRAY=""
+export VDEVS_NUM=32
+
+function set_disks
+{
+ typeset -a disk_array=($(find_disks $DISKS))
+
+ if (( ${#disk_array[*]} <= 1 )); then
+ export DISK=${DISKS%% *}
+ else
+ export DISK=""
+ typeset -i i=0
+ while (( i < ${#disk_array[*]} )); do
+ export DISK${i}="${disk_array[$i]}"
+ DISKSARRAY="$DISKSARRAY ${disk_array[$i]}"
+ (( i = i + 1 ))
+ (( i>$DISK_ARRAY_LIMIT )) && break
+ done
+ export DISK_ARRAY_NUM=$i
+ export DISKSARRAY
+ fi
+}
+
+set_disks
+set_device_dir
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/mmap/mmap.cfg
#
# DESCRIPTION:
#
export DISK=${DISKS%% *}
+export DISKSARRAY=$DISKS
+export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
+set_device_dir
export TESTFILE=testfile
log_must $ZFS umount $TESTDIR
destroy_pool $TESTPOOL
+
+if is_mpath_device $DISK; then
+ delete_partitions
+fi
+
#
# Remove 100mb partition.
#
export BLOCKSZ=8192
export NUM_WRITES=65536
export DATA=0
+
+export DISKSARRAY=$DISKS
+export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
+set_device_dir
log_must set_partition 0 "" $SIZE $DISK
if is_linux; then
- default_setup $DISK"p1"
+ if ( is_mpath_device $DISK ) && [[ -z $($ECHO $DISK | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $DISK ); then
+ default_setup $DISK"1"
+ elif ( is_mpath_device $DISK || is_loop_device $DISK ); then
+ default_setup $DISK"p1"
+ else
+ log_fail "$DISK not supported for partitioning."
+ fi
else
default_setup $DISK"s0"
fi
export HOLES_FILEOFFSET=${HOLES_FILEOFFSET-""}
export HOLES_COUNT=${HOLES_COUNT-"16384"} # FILESIZE/BLKSIZE/8
export STF_TIMEOUT=3600
+
+export DISKSARRAY=$DISKS
+export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
+set_device_dir
export BACKDIR=${TEST_BASE_DIR%%/}/backdir-rsend
-export DISK1=$($ECHO $DISKS | $AWK '{print $1}')
+export DISK1=${DISKS%% *}
export DISK2=$($ECHO $DISKS | $AWK '{print $2}')
export POOL=$TESTPOOL
[[ $? == 0 ]] && log_must $ZFS umount -f $TESTDIR
destroy_pool $TESTPOOL
+DISK=${DISKS%% *}
+if is_mpath_device $DISK; then
+ delete_partitions
+fi
+
# recreate and destroy a zpool over the disks to restore the partitions to
# normal
if [[ -n $SINGLE_DISK ]]; then
# Copyright (c) 2013 by Delphix. All rights reserved.
#
+export DISKSARRAY=$DISKS
+export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
+
typeset -i NUMBER_OF_DISKS=0
for i in $DISKS; do
[[ -n $MIRROR_PRIMARY ]] && MIRROR_SECONDARY=$i
SIDE_PRIMARY_PART=0
SIDE_SECONDARY_PART=1
if is_linux; then
- SIDE_PRIMARY=${SINGLE_DISK}p1
- SIDE_SECONDARY=${SINGLE_DISK}p2
+ if is_mpath_device $MIRROR_PRIMARY; then
+ export DEV_DSKDIR=$DEV_MPATHDIR
+ else
+ export DEV_DSKDIR=$DEV_RDSKDIR
+ fi
+ if ( is_mpath_device $SINGLE_DISK ) && [[ -z $($ECHO $SINGLE_DISK | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $SINGLE_DISK ); then
+ SIDE_PRIMARY=${SINGLE_DISK}1
+ SIDE_SECONDARY=${SINGLE_DISK}2
+ elif ( is_mpath_device $SINGLE_DISK || is_loop_device $SINGLE_DISK ); then
+ SIDE_PRIMARY=${SINGLE_DISK}p1
+ SIDE_SECONDARY=${SINGLE_DISK}p2
+ else
+ log_fail "$SINGLE_DISK not supported for partitioning."
+ fi
else
+ export DEV_DSKDIR="/dev"
SIDE_PRIMARY=${SINGLE_DISK}s${SIDE_PRIMARY_PART}
SIDE_SECONDARY=${SINGLE_DISK}s${SIDE_SECONDARY_PART}
fi
SIDE_PRIMARY_PART=0
SIDE_SECONDARY_PART=0
if is_linux; then
- SIDE_PRIMARY=${MIRROR_PRIMARY}p1
- SIDE_SECONDARY=${MIRROR_SECONDARY}p1
+ if is_mpath_device $MIRROR_PRIMARY; then
+ export DEV_DSKDIR=$DEV_MPATHDIR
+ else
+ export DEV_DSKDIR=$DEV_RDSKDIR
+ fi
+ if ( is_mpath_device $MIRROR_PRIMARY ) && [[ -z $($ECHO $MIRROR_PRIMARY | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $MIRROR_PRIMARY ); then
+ SIDE_PRIMARY=${MIRROR_PRIMARY}1
+ elif ( is_mpath_device $MIRROR_PRIMARY || is_loop_device $MIRROR_PRIMARY ); then
+ SIDE_PRIMARY=${MIRROR_PRIMARY}p1
+ else
+ log_fail "$MIRROR_PRIMARY not supported for partitioning."
+ fi
+ if ( is_mpath_device $MIRROR_SECONDARY ) && [[ -z $($ECHO $MIRROR_SECONDARY | awk 'substr($1,18,1)\
+ ~ /^[[:digit:]]+$/') ]] || ( is_real_device $MIRROR_SECONDARY ); then
+ SIDE_SECONDARY=${MIRROR_SECONDARY}1
+ elif ( is_mpath_device $MIRROR_SECONDARY || is_loop_device $MIRROR_SECONDARY ); then
+ SIDE_SECONDARY=${MIRROR_SECONDARY}p1
+ else
+ log_fail "$MIRROR_SECONDARY not supported for partitioning."
+ fi
else
+ export DEV_DSKDIR="/dev"
SIDE_PRIMARY=${MIRROR_PRIMARY}s${SIDE_PRIMARY_PART}
SIDE_SECONDARY=${MIRROR_SECONDARY}s${SIDE_SECONDARY_PART}
fi
# Copyright (c) 2013 by Delphix. All rights reserved.
#
+. $STF_SUITE/include/libtest.shlib
+
export TESTFILE=testfile.sparse
export HOLES_FILESIZE=${HOLES_FILESIZE-"67108864"} # 64 Mb
export HOLES_BLKSIZE=${HOLES_BLKSIZE-"512"}
export HOLES_FILEOFFSET=${HOLES_FILEOFFSET-""}
export HOLES_COUNT=${HOLES_COUNT-"16384"} # FILESIZE/BLKSIZE/8
export STF_TIMEOUT=3600
+
+export DISKSARRAY=$DISKS
+export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
+set_device_dir
# Use is subject to license terms.
#
+. $STF_SUITE/include/libtest.shlib
+
export TESTFILE=testfile.$$
export TRUNC_FILESIZE=${TRUNC_FILESIZE-"67108864"} # 64 Mb
export TRUNC_BLKSIZE=${TRUNC_BLKSIZE-"512"}
export TRUNC_SEED=${TRUNC_SEED-""}
export TRUNC_FILEOFFSET=${TRUNC_FILEOFFSET-""}
export TRUNC_COUNT=${TRUNC_COUNT-"16384"} # FILESIZE/BLKSIZE/8
+
+export DISKSARRAY=$DISKS
+export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
+
+set_device_dir
dist_pkgdata_SCRIPTS = \
setup.ksh \
cleanup.ksh \
+ write_dirs.cfg \
write_dirs_001_pos.ksh \
write_dirs_002_pos.ksh
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/write_dirs/write_dirs.cfg
default_cleanup
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/write_dirs/write_dirs.cfg
verify_runnable "global"
-export SIZE="1gb"
-
-if is_linux; then
- export SLICE_PREFIX="p"
- export SLICE=0
-else
- export SLICE_PREFIX="s"
- export SLICE=0
-fi
-
if ! $(is_physical_device $DISKS) ; then
log_unsupported "This directory cannot be run on raw files."
fi
DISK=${DISKS%% *}
-
-log_must set_partition $SLICE "" $SIZE $DISK
-
-if is_linux; then
- export SLICE=1
+if is_mpath_device $DISK; then
+ delete_partitions
fi
+log_must set_partition 0 "" $SIZE $DISK
+
default_setup "${DISK}${SLICE_PREFIX}${SLICE}"
--- /dev/null
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# Copyright (c) 2013 by Delphix. All rights reserved.
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+verify_runnable "global"
+
+export SIZE="1gb"
+export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
+export DISKSARRAY=$DISKS
+
+if is_linux; then
+ set_slice_prefix
+ set_device_dir
+ export SLICE=1
+else
+ DEV_DSKDIR="/dev"
+ export SLICE_PREFIX="s"
+ export SLICE=0
+fi
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/write_dirs/write_dirs.cfg
#
# DESCRIPTION:
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/write_dirs/write_dirs.cfg
#
# DESCRIPTION:
dist_pkgdata_SCRIPTS = \
cleanup.ksh \
setup.ksh \
+ zvol_ENOSPC.cfg \
zvol_ENOSPC_001_pos.ksh
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/zvol/zvol_common.shlib
+. $STF_SUITE/tests/functional/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg
verify_runnable "global"
+DISK=${DISKS%% *}
+if is_mpath_device $DISK; then
+ delete_partitions
+fi
+
default_zvol_setup $DISK $VOLSIZE
$ECHO "y" | $NEWFS -v ${ZVOL_RDEVDIR}/$TESTPOOL/$TESTVOL >/dev/null 2>&1
--- /dev/null
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# Copyright (c) 2013 by Delphix. All rights reserved.
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+verify_runnable "global"
+
+#export SIZE="1gb"
+export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
+export DISKSARRAY=$DISKS
+
+
+if is_linux; then
+ set_slice_prefix
+ set_device_dir
+# export SLICE=1
+else
+ DEV_DSKDIR="/dev"
+ export SLICE_PREFIX="s"
+# export SLICE=0
+fi
dist_pkgdata_SCRIPTS = \
cleanup.ksh \
setup.ksh \
+ zvol_cli.cfg \
zvol_cli_001_pos.ksh \
zvol_cli_002_pos.ksh \
zvol_cli_003_neg.ksh
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/zvol/zvol_common.shlib
+. $STF_SUITE/tests/functional/zvol/zvol_cli/zvol_cli.cfg
verify_runnable "global"
+DISK=${DISKS%% *}
+if is_mpath_device $DISK; then
+ delete_partitions
+fi
+
default_zvol_setup $DISK $VOLSIZE
log_pass
--- /dev/null
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# Copyright (c) 2013 by Delphix. All rights reserved.
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+verify_runnable "global"
+
+export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
+export DISKSARRAY=$DISKS
+
+
+if is_linux; then
+ set_slice_prefix
+ set_device_dir
+else
+ DEV_DSKDIR="/dev"
+ export SLICE_PREFIX="s"
+fi