]> granicus.if.org Git - zfs/commitdiff
Real disk partitioning now enabled in test suite for Linux
authorSydney Vanda <sydney.m.vanda@intel.com>
Fri, 22 Jul 2016 15:07:04 +0000 (15:07 +0000)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 8 Sep 2016 20:45:34 +0000 (13:45 -0700)
When using real devices, specify DISKS="sdb sdc sdd" opposed to
/dev/sdb in zfs-tests.sh - otherwise errors with directory names and
disk names registering as "/dev//dev/sdb" for some tests.  The same
goes for mpath: DISK="mpatha mpathad mpathb"

Expected Usage:

$ DISKS="sdb sdc sdd" zfs-tests.sh

SLICE_PREFIX is now set as "p" for a loop device (ie loop0p2) or
"" for a real device (ie sdb2), or either for multipath devices
(ie mpatha1 or mpath1p1) instead of only "p" by default.  Note that
kpartx partitioning is not currently supported in this patch
(ie "partx") and may need to be disabled on Debian distributions.
Functions added for determining test directory (/dev or /dev/mapper)
as well as slice prefix are determined and exported mostly in the cfg
file of each test group directory.

Currently zpools cannot be created on whole mpath devices that have
been partitioned. In order to fix this tests have either been revised
to use a partition instead, or if there is a size constraint and the
pool needs to be created on the whole disk, partitions are then deleted
if the device is a multipath device.  This functionality is added to
default_cleanup() or to individual cleanup scripts if a non-default
cleanup method is used.

The max partitions is currently set at 8 to account for all of the
tests thus far.

Patch changes are generally encompassed in "if is_linux" construct.

Signed-off-by: Sydney Vanda <sydney.m.vanda@intel.com>
Reviewed-by: John Salinas <John.Salinas@intel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: David Quigley <david.quigley@intel.com>
Closes #4447
Closes #4964
Closes #5074

64 files changed:
config/user-commands.m4
tests/zfs-tests/include/commands.cfg.in
tests/zfs-tests/include/default.cfg.in
tests/zfs-tests/include/libtest.shlib
tests/zfs-tests/tests/functional/cache/cache.cfg
tests/zfs-tests/tests/functional/cache/setup.ksh
tests/zfs-tests/tests/functional/clean_mirror/cleanup.ksh
tests/zfs-tests/tests/functional/clean_mirror/default.cfg
tests/zfs-tests/tests/functional/clean_mirror/setup.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_add/cleanup.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_add/setup.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add.cfg
tests/zfs-tests/tests/functional/cli_root/zpool_create/setup.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.cfg
tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_003_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_006_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_021_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_022_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_001_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_002_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_003_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_004_neg.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy.cfg
tests/zfs-tests/tests/functional/cli_root/zpool_export/Makefile.am
tests/zfs-tests/tests/functional/cli_root/zpool_export/setup.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export.cfg [new file with mode: 0644]
tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export_001_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_import/cleanup.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_import/setup.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import.cfg
tests/zfs-tests/tests/functional/cli_root/zpool_remove/cleanup.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_remove/zpool_remove.cfg
tests/zfs-tests/tests/functional/cli_root/zpool_scrub/zpool_scrub.cfg
tests/zfs-tests/tests/functional/grow_pool/grow_pool.cfg
tests/zfs-tests/tests/functional/grow_replicas/grow_replicas.cfg
tests/zfs-tests/tests/functional/inuse/inuse.cfg
tests/zfs-tests/tests/functional/migration/cleanup.ksh
tests/zfs-tests/tests/functional/migration/migration.cfg
tests/zfs-tests/tests/functional/migration/setup.ksh
tests/zfs-tests/tests/functional/mmap/Makefile.am
tests/zfs-tests/tests/functional/mmap/mmap.cfg [new file with mode: 0644]
tests/zfs-tests/tests/functional/mmap/mmap_read_001_pos.ksh
tests/zfs-tests/tests/functional/mv_files/mv_files.cfg
tests/zfs-tests/tests/functional/no_space/cleanup.ksh
tests/zfs-tests/tests/functional/no_space/enospc.cfg
tests/zfs-tests/tests/functional/no_space/setup.ksh
tests/zfs-tests/tests/functional/online_offline/online_offline.cfg
tests/zfs-tests/tests/functional/rsend/rsend.cfg
tests/zfs-tests/tests/functional/scrub_mirror/cleanup.ksh
tests/zfs-tests/tests/functional/scrub_mirror/default.cfg
tests/zfs-tests/tests/functional/sparse/sparse.cfg
tests/zfs-tests/tests/functional/truncate/truncate.cfg
tests/zfs-tests/tests/functional/write_dirs/Makefile.am
tests/zfs-tests/tests/functional/write_dirs/cleanup.ksh
tests/zfs-tests/tests/functional/write_dirs/setup.ksh
tests/zfs-tests/tests/functional/write_dirs/write_dirs.cfg [new file with mode: 0644]
tests/zfs-tests/tests/functional/write_dirs/write_dirs_001_pos.ksh
tests/zfs-tests/tests/functional/write_dirs/write_dirs_002_pos.ksh
tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/Makefile.am
tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/setup.ksh
tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg [new file with mode: 0644]
tests/zfs-tests/tests/functional/zvol/zvol_cli/Makefile.am
tests/zfs-tests/tests/functional/zvol/zvol_cli/setup.ksh
tests/zfs-tests/tests/functional/zvol/zvol_cli/zvol_cli.cfg [new file with mode: 0644]

index bda2b8652b5366f1993b4f87b81bf6e7cc1ec925..112e4c18c3de8d72952f37f8f67c9c31e293e101 100644 (file)
@@ -99,9 +99,11 @@ AC_DEFUN([ZFS_AC_CONFIG_USER_COMMANDS_LINUX], [
        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, "")
index bea8df62931cc1f7c56e3b0a081f8f0966fed543..10d8ffd8a789ae9697d23f3b9b85fea837b40d12 100644 (file)
@@ -52,6 +52,7 @@ export LOCKFS="@LOCKFS@"
 export LOFIADM="@LOFIADM@"
 export LOGNAME="@LOGNAME@"
 export LS="@LS@"
+export LSBLK="@LSBLK@"
 export MD5SUM="@MD5SUM@"
 export MKDIR="@MKDIR@"
 export MKNOD="@MKNOD@"
@@ -75,6 +76,7 @@ export PRTVTOC="@PRTVTOC@"
 export PS="@PS@"
 export PSRINFO="@PSRINFO@"
 export PYTHON="@PYTHON@"
+export READLINK="@READLINK@"
 export REBOOT="@REBOOT@"
 export RM="@RM@"
 export RMDIR="@RMDIR@"
index 13317ea877ac941366421d835b6b236f3d802738..ec2eb90f0463e34defebd666e7355d371f4b8e15 100644 (file)
@@ -171,6 +171,8 @@ for i in $ZFS_ALL_VERSIONS; do
        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"
@@ -180,8 +182,8 @@ if is_linux; then
 
        ZVOL_DEVDIR="/dev/zvol"
        ZVOL_RDEVDIR="/dev/zvol"
-       DEV_DSKDIR="/dev"
        DEV_RDSKDIR="/dev"
+       DEV_MPATHDIR="/dev/mapper"
 
        NEWFS_DEFAULT_FS="ext2"
 else
@@ -199,4 +201,4 @@ 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
index a9236a3bc773c8faa84a50000e089b3a8162ffdf..0c9ddd1cf02189406b76b6c292a3db0725813cbd 100644 (file)
@@ -456,6 +456,11 @@ function default_cleanup_noexit
 
        [[ -d $TESTDIR ]] && \
                log_must $RM -rf $TESTDIR
+
+       disk1=${DISKS%% *}
+       if is_mpath_device $disk1; then
+               delete_partitions
+       fi
 }
 
 
@@ -733,6 +738,69 @@ function set_partition #<slice_num> <slice_start> <size_plus_units>  <whole_disk
        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
 #
@@ -2482,6 +2550,113 @@ function is_physical_device #device
        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
 #
index f8a795d15542a5cd44820f6e0545a8ba543ad764..f3155323d3151512ede503751e18f73a59578954 100644 (file)
 
 . $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
@@ -58,6 +58,7 @@ function set_disks
 }
 
 set_disks
+set_device_dir
 
 export SIZE=64M
 
index 832dfe92b812b50e2cf43d95f7da3ce971e2a443..713eca9a2079da518f9fa56aa7cc383b6ec471b8 100755 (executable)
@@ -34,7 +34,7 @@
 
 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
 
index e09fb596f02c273a092eb032d2e4af97e3c719ba..05ef9c16a7cead8da3eb575e7d91572a384c3f22 100755 (executable)
@@ -38,6 +38,12 @@ $DF -F zfs -h | $GREP "$TESTFS " >/dev/null
 [[ $? == 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
index 35cd14161fde805480e02eed9e88cbd78b43744f..756ce2308029abcacee1c26768a5ad68f6794d40 100644 (file)
@@ -44,9 +44,23 @@ if [[ -z $MIRROR_SECONDARY ]]; 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
@@ -54,9 +68,30 @@ else
        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
index 6ea2f1ef28d6c75c1f6f022c78e30295c01f3733..2d17bf9cb298eed852757f0f652d8bb910ff0bd3 100755 (executable)
@@ -34,7 +34,7 @@
 
 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
 
index b4916f9579c1a81556328a23fa4005adf8204887..48a6bc301936ff56d61b5da9b91af582a19754f1 100755 (executable)
 . $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
index f35dedd3c7f9d06a386ed98d4ad62040b7065896..131876f8c6b7d9c6e3ff6bac3e8228a4447e139a 100755 (executable)
@@ -38,6 +38,11 @@ if ! $(is_physical_device $DISKS) ; then
        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
index c18c6aa4f7c98da453578a8a28629d6c45b2f77d..f12a883dc8c4a5d5e647d924df99eaba044c8367 100644 (file)
@@ -72,7 +72,8 @@ export SIZE="150m"
 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
@@ -80,6 +81,7 @@ if is_linux; then
        export SLICE5=6
        export SLICE6=7
 else
+       export DEV_DSKDIR="/dev"
        export SLICE_PREFIX="s"
        export SLICE0=0
        export SLICE1=1
index 409d5d04d39c507f8877cb4aac6ba9930518ed83..fa79e0bfaa2b95065504d0a32cc806b109fd8308 100755 (executable)
 . $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
index d39b98749b217629aeaa65f6b741a9996394f36f..33dd8866e21472bebc613caa550fc7681cbd8370 100644 (file)
@@ -41,6 +41,7 @@ function set_disks
 
        if (( ${#disk_array[*]} <= 1 )); then
                export DISK=${DISKS%% *}
+               export DISK_ARRAY_NUM=1
        else
                export DISK=""
                typeset -i i=0
@@ -63,7 +64,8 @@ export SIZE="200m"
 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
@@ -72,6 +74,10 @@ if is_linux; then
        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
index 008828b88844f81717a031c76f806824bdf6ce9a..e7917e8266dcb98ba837a03d593f1fbce4bf8b8f 100755 (executable)
@@ -51,7 +51,7 @@ function cleanup
 
 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
@@ -62,6 +62,11 @@ else
         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
 #
index 70dcadc91cd768158e3c17ff7a98b9ea0de9f33d..56c6e54eeb07d3081b6a115d4b9bb843f4505085 100755 (executable)
@@ -26,6 +26,7 @@
 #
 
 . $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
 
 #
 # DESCRIPTION:
index c4884413a95364c4fca2b43ac69c66fc0f80cded..df40f401dd940b86dead9d3a49614be9a02f7256 100755 (executable)
@@ -31,6 +31,7 @@
 
 . $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:
index 9cc78a16fdc4c2c85718f5f6fed38b25b1ee60bc..2186d6cf7a31a0e0044304ba8254de38484221ad 100755 (executable)
@@ -31,6 +31,7 @@
 
 . $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:
index 296a7b47fb4cd6a122e942139ff8482db441f582..746c5041a252134ac73e08f624f0dc70ec82a493 100755 (executable)
@@ -25,6 +25,7 @@
 #
 
 . $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
 
 ################################################################################
 #
index ce24b38dd87bf0332407e5f72e4ee640a0f7bde9..f0e2086cac7e93e11ae2da864e3182696c171f12 100755 (executable)
@@ -25,6 +25,7 @@
 #
 
 . $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
 
 ################################################################################
 #
index 936a1cd5710743b43cc80aeb35d7fb69a831e6f6..9d45dfd4046d96193146c6c5e6cfba7c1a61a830 100755 (executable)
@@ -25,6 +25,7 @@
 #
 
 . $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
 
 ################################################################################
 #
index 2d3ffc8b8f8a5070f6ee3392607289b48c5cb6a5..a52e86251df6745536ff7e742bd9ecbc7edae39a 100755 (executable)
@@ -25,6 +25,7 @@
 #
 
 . $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
 
 ################################################################################
 #
index 63051e2d6e0eb4d8bfb78f87687142adfe7acb80..e9d8831f82593d8ef7cc43b894a61013489c68b2 100644 (file)
@@ -31,7 +31,8 @@
 export DISK=${DISKS%% *}
 
 if is_linux; then
-       export SLICE_PREFIX="p"
+       set_device_dir
+       set_slice_prefix
        export SLICE0=1
        export SLICE1=2
 else
index a1d97ebab7a2f530a91e80d18d753cd6c0819a2b..d0af877f3a68aa8de5b96b356149454a03e736c7 100644 (file)
@@ -2,6 +2,7 @@ pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_expo
 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 \
index 9ce5226e610ce7c848650a3fd8dd6d311ee1f4cc..925f3e4af83315bbdc58c083a1149a6f5d2243b9 100755 (executable)
@@ -26,6 +26,7 @@
 #
 
 . $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zpool_export/zpool_export.cfg
 
 DISK=${DISKS%% *}
 
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export.cfg b/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export.cfg
new file mode 100644 (file)
index 0000000..1501c04
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# 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
index 6f404ce128e01568236853fa5544f6cea310e518..af7c6f2757521f62ed9aa7eeb777bfa3fe683b71 100755 (executable)
@@ -25,6 +25,7 @@
 # Use is subject to license terms.
 #
 . $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zpool_export/zpool_export.cfg
 
 #
 # DESCRIPTION:
index 03830c434f236a6ac0e2068382918ce3671a5ca4..c55d70c7b19323c7042af3e465586a1d314bfa3f 100755 (executable)
@@ -48,6 +48,10 @@ for dir in "$TESTDIR" "$TESTDIR1" "$DEVICE_DIR" ; do
                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
index f765da03fab9ea639f8f8205c2d1eaa6c37dddf7..9d0b913a01a8f3893be7c8c203ba1004457e1887 100755 (executable)
@@ -68,15 +68,27 @@ fi
 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
index 5f1638cec5d53f5e57a86e863363d0b27f622e49..017874ec07038d1f5e37b9094f83312ed0494a12 100644 (file)
@@ -30,6 +30,8 @@
 
 . $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)
@@ -43,10 +45,24 @@ case "${#disk_array[*]}" in
        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
@@ -59,10 +75,30 @@ case "${#disk_array[*]}" in
        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
index 4cc6b3bf05da732df4e73f4d660419626b55380d..307fae7196d2f594327bb979247d77a501c03938 100755 (executable)
 #
 
 . $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
 
index c611efd835e359ddc20879f8999ef7d392451139..345941bc9ae4b72d567a0c3c92cae914337f8929 100644 (file)
 
 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
index 36b4c0ebeb3efc63e100caede039d6dd4c34bc65..d0325633d2cebc79af7a2fcfc2de743463ba9450 100644 (file)
@@ -28,5 +28,5 @@
 # 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}')
index c2689e84c6e01774c67d358efd787dafb1d2cc97..8b0563201c7afba73e160fb86d173dbaa2eefd3a 100644 (file)
@@ -60,7 +60,8 @@ export TESTFILE1=file$$.1
 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
index 7b599cfc4a4712d926086b3397e57538dcad1dff..ebf32260211047f95aa83cda2b7b82e1951189ed 100644 (file)
@@ -61,7 +61,8 @@ export WRITE_COUNT=65536000
 
 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
index 1666cdb8f4892ffcda9e2d6ccd0ba427368db2ab..7d2b631caa7beec5327a74d093d0c33a13e6d0b4 100644 (file)
@@ -31,7 +31,8 @@
 . $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
index 1b146a7b59d4585080f97a693769c9ad6e69fa10..0b6efce6aba2c8973494c9482521d57db4ee7b20 100755 (executable)
@@ -41,6 +41,11 @@ ismounted $TESTPOOL/$TESTFS
 [[ $? == 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
index ddae25df197535d4eb4411d789ea0078779bcba4..340288025ee47e11de5aa4977016c6b41016bcd1 100644 (file)
@@ -30,6 +30,8 @@
 
 . $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)
@@ -42,9 +44,23 @@ case "${#disk_array[*]}" in
        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
@@ -55,9 +71,29 @@ case "${#disk_array[*]}" in
        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
index 18be6257fcb635990015a9489095c60fc929f9ae..2381b5f857b64b8456d6f2949b8bc38760687809 100755 (executable)
@@ -64,7 +64,7 @@ log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
 $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"
 
index a635b3dd063835dcb2a42557025cf6287fb70931..cb444ec379d0ab11ab1a02021a7883fd69f83152 100644 (file)
@@ -2,5 +2,6 @@ pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/mmap
 dist_pkgdata_SCRIPTS = \
        setup.ksh \
        cleanup.ksh \
+       mmap.cfg \
        mmap_read_001_pos.ksh \
        mmap_write_001_pos.ksh
diff --git a/tests/zfs-tests/tests/functional/mmap/mmap.cfg b/tests/zfs-tests/tests/functional/mmap/mmap.cfg
new file mode 100644 (file)
index 0000000..1501c04
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# 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
index 0b3ddb6626f3a03b93c7445bf0ae62ca5f917e1c..36bcaa802fd8bb603acb963707865130a3611860 100755 (executable)
@@ -30,6 +30,7 @@
 #
 
 . $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/mmap/mmap.cfg
 
 #
 # DESCRIPTION:
index 6c8186237709a002ff89518a732205a46bdd2fc6..e0c416638620c7a302dd5d9e9f6613f2810890e0 100644 (file)
@@ -29,6 +29,9 @@
 #
 
 export DISK=${DISKS%% *}
+export DISKSARRAY=$DISKS
+export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
+set_device_dir
 
 export TESTFILE=testfile
 
index 1ed7ee1c9ee4a4803262a06194f2fe79794087d3..6fedeaa58291553dd60576d59df805a1a8405ecd 100755 (executable)
@@ -40,6 +40,11 @@ ismounted "$TESTPOOL/$TESTFS"
         log_must $ZFS umount $TESTDIR
 
 destroy_pool $TESTPOOL
+
+if is_mpath_device $DISK; then
+       delete_partitions
+fi
+
 #
 # Remove 100mb partition.
 #
index 692482a82c91f536a0cef4791d03e191a78119af..df1c9393aa8e58c69a8576a41e21a578bb75fa58 100644 (file)
@@ -36,3 +36,7 @@ export ENOSPC=28
 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
index 5bd8918f9e3c64b7e962e4d126555e19e4436a9b..7d177c772f9a67904bac55f0c5dd5642cfbb1665 100755 (executable)
@@ -43,7 +43,14 @@ DISK=${DISKS%% *}
 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
index e68e8363f677dad303b4ae9b7ccd55f79d9de192..42be907bd0593d528c059895760cc5cfe2d48403 100644 (file)
@@ -36,3 +36,7 @@ export HOLES_SEED=${HOLES_SEED-""}
 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
index 24304075f8078a9845e97d87d8e4166f58c7c763..29aede5589153aa9a9bb7e1f7b60272fb0901fa9 100644 (file)
@@ -29,7 +29,7 @@
 
 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
index da628bcd1ac857c0dc740b17fb365bd4dd077424..d0d77b79c2a6276e4e7a87145cc6a265ec1b910f 100755 (executable)
@@ -39,6 +39,11 @@ $DF -F zfs -h | $GREP "$TESTFS " >/dev/null
 [[ $? == 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
index 461212bb950eca1c7b06ef1132c34a101d54f360..ee05daec4ba9ff2f440445fae27152a0b77dd057 100644 (file)
@@ -28,6 +28,9 @@
 # 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
@@ -41,9 +44,23 @@ if [[ -z $MIRROR_SECONDARY ]]; then
        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
@@ -51,9 +68,29 @@ else
        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
index ba969ee47940f77d7ae472601fc3806328046ab4..a01677d9117723e26397f5be0eb42d27eb14b159 100644 (file)
@@ -28,6 +28,8 @@
 # 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"}
@@ -35,3 +37,7 @@ export HOLES_SEED=${HOLES_SEED-""}
 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
index 703ff50b50bc881f4dd2868b791d73e772998503..e9449daff0bbda70ffe4e3ef81bb5001b2b58d90 100644 (file)
 # 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
index 9bdc46b902e03f7378bb8a42c4ae6e23a6c2077d..80493ab3ce499fc03bc2418924be21d3ef6d16f6 100644 (file)
@@ -2,5 +2,6 @@ pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/write_dirs
 dist_pkgdata_SCRIPTS = \
        setup.ksh \
        cleanup.ksh \
+       write_dirs.cfg \
        write_dirs_001_pos.ksh \
        write_dirs_002_pos.ksh
index 3166bd6ec16e2c80fa42c3c1427caa5d34006786..50526153e5d95d31e912d1ad2b219517b1511db4 100755 (executable)
@@ -30,5 +30,6 @@
 #
 
 . $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/write_dirs/write_dirs.cfg
 
 default_cleanup
index 49d5f7aa5de044b79e96afffccb06d9a21f6c318..3f10c7f74ff2ac054172ab8eb91348bdc099b462 100755 (executable)
 #
 
 . $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}"
diff --git a/tests/zfs-tests/tests/functional/write_dirs/write_dirs.cfg b/tests/zfs-tests/tests/functional/write_dirs/write_dirs.cfg
new file mode 100644 (file)
index 0000000..fe7b5ab
--- /dev/null
@@ -0,0 +1,48 @@
+#!/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
index dc5854bd921abca313c9004c2d334f2f3410b591..3261af167ab7adebe1c865a07476df740930cd30 100755 (executable)
@@ -30,6 +30,7 @@
 #
 
 . $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/write_dirs/write_dirs.cfg
 
 #
 # DESCRIPTION:
index bc4aff07f8351cafe60e72d0601ecb4c668d3ad8..39c410b9dc7657bb27eabe7a38a6f769d90a3765 100755 (executable)
@@ -30,6 +30,7 @@
 #
 
 . $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/write_dirs/write_dirs.cfg
 
 #
 # DESCRIPTION:
index a10023dca54fd82753ec365ecbdf8ff17066aee5..7007c8cf949b3abc17829388cc5ae312e5b23cd8 100644 (file)
@@ -2,4 +2,5 @@ pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/zvol/zvol_ENOSPC
 dist_pkgdata_SCRIPTS = \
        cleanup.ksh \
        setup.ksh \
+       zvol_ENOSPC.cfg \
        zvol_ENOSPC_001_pos.ksh
index 9a30a0373ad78a22fd5b26c3a7dd1bba7daa267b..e5feb6b5809b6c133405a5057ff99642c46331cc 100755 (executable)
 
 . $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
diff --git a/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg b/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg
new file mode 100644 (file)
index 0000000..8284ffb
--- /dev/null
@@ -0,0 +1,49 @@
+#!/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
index 451b8fe9255cad5bd7e46f2a79defb52b9c257cf..c4b80389909bddc1301ed12662dace3225086268 100644 (file)
@@ -2,6 +2,7 @@ pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/zvol/zvol_cli
 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
index 2a6228131becebd04e71126248d1099d55c7ccbb..c24933df2fbca13bf23b5bd131b2ddfc5d15e144 100755 (executable)
 
 . $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
diff --git a/tests/zfs-tests/tests/functional/zvol/zvol_cli/zvol_cli.cfg b/tests/zfs-tests/tests/functional/zvol/zvol_cli/zvol_cli.cfg
new file mode 100644 (file)
index 0000000..ebfbe5c
--- /dev/null
@@ -0,0 +1,46 @@
+#!/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