Add the ZFS Test Suite

Add the ZFS Test Suite and test-runner framework from illumos.
This is a continuation of the work done by Turbo Fredriksson to
port the ZFS Test Suite to Linux.  While this work was originally
conceived as a stand alone project integrating it directly with
the ZoL source tree has several advantages:

  * Allows the ZFS Test Suite to be packaged in zfs-test package.
    * Facilitates easy integration with the CI testing.
    * Users can locally run the ZFS Test Suite to validate ZFS.
      This testing should ONLY be done on a dedicated test system
      because the ZFS Test Suite in its current form is destructive.
  * Allows the ZFS Test Suite to be run directly in the ZoL source
    tree enabled developers to iterate quickly during development.
  * Developers can easily add/modify tests in the framework as
    features are added or functionality is changed.  The tests
    will then always be in sync with the implementation.

Full documentation for how to run the ZFS Test Suite is available
in the tests/README.md file.

Warning: This test suite is designed to be run on a dedicated test
system.  It will make modifications to the system including, but
not limited to, the following.

  * Adding new users
  * Adding new groups
  * Modifying the following /proc files:
    * /proc/sys/kernel/core_pattern
    * /proc/sys/kernel/core_uses_pid
  * Creating directories under /

Notes:
  * Not all of the test cases are expected to pass and by default
    these test cases are disabled.  The failures are primarily due
    to assumption made for illumos which are invalid under Linux.
  * When updating these test cases it should be done in as generic
    a way as possible so the patch can be submitted back upstream.
    Most existing library functions have been updated to be Linux
    aware, and the following functions and variables have been added.
    * Functions:
      * is_linux          - Used to wrap a Linux specific section.
      * block_device_wait - Waits for block devices to be added to /dev/.
    * Variables:            Linux          Illumos
      * ZVOL_DEVDIR         "/dev/zvol"    "/dev/zvol/dsk"
      * ZVOL_RDEVDIR        "/dev/zvol"    "/dev/zvol/rdsk"
      * DEV_DSKDIR          "/dev"         "/dev/dsk"
      * DEV_RDSKDIR         "/dev"         "/dev/rdsk"
      * NEWFS_DEFAULT_FS    "ext2"         "ufs"
  * Many of the disabled test cases fail because 'zfs/zpool destroy'
    returns EBUSY.  This is largely causes by the asynchronous nature
    of device handling on Linux and is expected, the impacted test
    cases will need to be updated to handle this.
  * There are several test cases which have been disabled because
    they can trigger a deadlock.  A primary example of this is to
    recursively create zpools within zpools.  These tests have been
    disabled until the root issue can be addressed.
  * Illumos specific utilities such as (mkfile) should be added to
    the tests/zfs-tests/cmd/ directory.  Custom programs required by
    the test scripts can also be added here.
  * SELinux should be either is permissive mode or disabled when
    running the tests.  The test cases should be updated to conform
    to a standard policy.
  * Redundant test functionality has been removed (zfault.sh).
  * Existing test scripts (zconfig.sh) should be migrated to use
    the framework for consistency and ease of testing.
  * The DISKS environment variable currently only supports loopback
    devices because of how the ZFS Test Suite expects partitions to
    be named (p1, p2, etc).  Support must be added to generate the
    correct partition name based on the device location and name.
  * The ZFS Test Suite is part of the illumos code base at:
    https://github.com/illumos/illumos-gate/tree/master/usr/src/test

Original-patch-by: Turbo Fredriksson <turbo@bayour.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
Closes #6
Closes #1534
This commit is contained in:
Brian Behlendorf
2015-07-01 15:23:09 -07:00
parent 887d1e60ef
commit 6bb24f4dc7
1243 changed files with 89497 additions and 1042 deletions
+17
View File
@@ -0,0 +1,17 @@
pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cache
dist_pkgdata_SCRIPTS = \
cache.cfg \
cache.kshlib \
cleanup.ksh \
setup.ksh \
cache_001_pos.ksh \
cache_002_pos.ksh \
cache_003_pos.ksh \
cache_004_neg.ksh \
cache_005_neg.ksh \
cache_006_pos.ksh \
cache_007_neg.ksh \
cache_008_neg.ksh \
cache_009_pos.ksh \
cache_010_neg.ksh \
cache_011_pos.ksh
+70
View File
@@ -0,0 +1,70 @@
#
# 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
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
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 ))
done
export DISK_ARRAY_NUM=$i
export DISKSARRAY
fi
if (( $DISK_ARRAY_NUM == 0 )); then
export disk=$DISK
else
export disk=$DISK0
fi
}
set_disks
export SIZE=64M
export VDIR=$TESTDIR/disk.cache
export VDIR2=$TESTDIR/disk2.cache
export VDEV="$VDIR/a $VDIR/b $VDIR/c"
export LDEV="$DISK0"
export VDEV2="$VDIR2/a $VDIR2/b $VDIR2/c"
export LDEV2="$DISK1"
+160
View File
@@ -0,0 +1,160 @@
#
# 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
function cleanup
{
if datasetexists $TESTPOOL ; then
log_must $ZPOOL destroy -f $TESTPOOL
fi
if datasetexists $TESTPOOL2 ; then
log_must $ZPOOL destroy -f $TESTPOOL2
fi
}
#
# Try zpool status/iostat for given pool
#
# $1 pool
#
function display_status
{
typeset pool=$1
typeset -i ret=0
$ZPOOL status -xv $pool > /dev/null 2>&1
ret=$?
$ZPOOL iostat > /dev/null 2>&1
((ret |= $?))
typeset mntpnt=$(get_prop mountpoint $pool)
$DD if=/dev/random of=$mntpnt/testfile.$$ &
typeset pid=$!
$ZPOOL iostat -v 1 3 > /dev/null
((ret |= $?))
kill -9 $pid
return $ret
}
#
# Verify the given cache device have correct type and status
#
# $1 pool name
# $2 device name
# $3 device status
# $4 device type
#
function verify_cache_device
{
typeset pool=$1
typeset device=$2
typeset status=$3
typeset type=$4
if [[ -z $pool || -z $device || -z $status ]]; then
log_fail "Usage: verify_cache_device <pool> <device> " \
"<status> [type]"
fi
if [[ $WRAPPER == *"smi"* ]]; then
$ECHO $device | $EGREP "^c[0-F]+([td][0-F]+)+$" > /dev/null 2>&1
if (( $? == 0 )); then
device=${device}s2
fi
fi
#
# Get all the cache devices and status table like below
#
# mirror:/disks/d ONLINE mirror:/disks/e ONLINE stripe:/disks/f ONLINE
#
set -A dev_stat_tab $($ZPOOL status -v $pool | $NAWK 'BEGIN {start=0} \
/\tcache/ {start=1}
/\tmirror/ || /\tspares/ || /^$/ {start=0}
(start==1) && /\t (\/|[a-zA-Z])/ \
{print "stripe:" $1 " " $2}
(start==1) && /\t (\/|[a-zA-Z])/ \
{print "mirror:" $1 " " $2}
# When hotspare is replacing
(start==1) && /\t (\/|[a-zA-Z])/ \
{print "mirror:" $1 " " $2}'
)
typeset -i i=0
typeset find=0
while (( i < ${#dev_stat_tab[@]} )); do
typeset dev=${dev_stat_tab[$i]}
typeset stat=${dev_stat_tab[((i+1))]}
case $dev in
stripe:$device)
if [[ "$type" == 'mirror' ]]; then
log_note "Unexpected type: mirror"
return 1
else
if [[ $stat != $status ]]; then
log_note "Status($stat) " \
"!= Expected stat($status)"
return 1
fi
return 0
fi
;;
mirror:$device)
if [[ -z "$type" || $type == 'stripe' ]]; then
log_note "Unexpected type: stripe"
return 1
else
if [[ $stat != $status ]]; then
log_note "Status($stat) " \
"!= Expected stat($status)"
return 1
fi
return 0
fi
;;
esac
((i += 2))
done
log_note "Can not find device: $device"
return 1
}
function verify_cache_support
{
$ZPOOL upgrade -v | $GREP "Cache devices" > /dev/null 2>&1
return $?
}
+65
View File
@@ -0,0 +1,65 @@
#!/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 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
#
# DESCRIPTION:
# Creating a pool with a cache device succeeds.
#
# STRATEGY:
# 1. Create pool with separated cache devices.
# 2. Display pool status
# 3. Destroy and loop to create pool with different configuration.
#
verify_runnable "global"
log_assert "Creating a pool with a cache device succeeds."
log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
cache $LDEV
log_must display_status $TESTPOOL
ldev=$(random_get $LDEV)
log_must verify_cache_device $TESTPOOL $ldev 'ONLINE'
log_must $ZPOOL remove $TESTPOOL $ldev
log_must check_vdev_state $TESTPOOL $ldev ""
log_must $ZPOOL destroy -f $TESTPOOL
done
log_pass "Creating a pool with a cache device succeeds."
+65
View File
@@ -0,0 +1,65 @@
#!/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 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
#
# DESCRIPTION:
# Adding a cache device to normal pool works.
#
# STRATEGY:
# 1. Create pool
# 2. Add cache devices with different configuration
# 3. Display pool status
# 4. Destroy and loop to create pool with different configuration.
#
verify_runnable "global"
log_assert "Adding a cache device to normal pool works."
log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV
log_must $ZPOOL add $TESTPOOL cache $LDEV
log_must display_status $TESTPOOL
typeset ldev=$(random_get $LDEV)
log_must verify_cache_device $TESTPOOL $ldev 'ONLINE'
log_must $ZPOOL remove $TESTPOOL $ldev
log_must check_vdev_state $TESTPOOL $ldev ""
log_must $ZPOOL destroy -f $TESTPOOL
done
log_pass "Adding a cache device to normal pool works."
+69
View File
@@ -0,0 +1,69 @@
#!/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/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
#
# DESCRIPTION:
# Adding an extra cache device works
#
# STRATEGY:
# 1. Create pool with separated cache devices.
# 2. Add an extra cache devices
# 3. Display pool status
# 4. Destroy and loop to create pool with different configuration.
#
verify_runnable "global"
verify_disk_count "$LDEV2"
log_assert "Adding an extra cache device works."
log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
cache $LDEV
log_must $ZPOOL add $TESTPOOL \
cache $LDEV2
log_must display_status $TESTPOOL
ldev=$(random_get $LDEV2)
log_must verify_cache_device $TESTPOOL $ldev 'ONLINE'
log_must $ZPOOL remove $TESTPOOL $ldev
log_must check_vdev_state $TESTPOOL $ldev ""
log_must $ZPOOL destroy -f $TESTPOOL
done
log_pass "Adding an extra cache device works."
+64
View File
@@ -0,0 +1,64 @@
#!/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/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
#
# DESCRIPTION:
# Attaching a cache device fails.
#
# STRATEGY:
# 1. Create pool with separated cache devices.
# 2. Attaching a cache device for existing cache device
# 3. Verify the operation fails
#
verify_runnable "global"
verify_disk_count "$LDEV2"
log_assert "Attaching a cache device fails for an existing cache device."
log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
cache $LDEV
ldev=$(random_get $LDEV)
typeset ldev2=$(random_get $LDEV2)
log_mustnot $ZPOOL attach $TESTPOOL $ldev $ldev2
log_must check_vdev_state $TESTPOOL $ldev2 ""
log_must $ZPOOL destroy -f $TESTPOOL
done
log_pass "Attaching a cache device fails for an existing cache device."
+65
View File
@@ -0,0 +1,65 @@
#!/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/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
#
# DESCRIPTION:
# Replacing a cache device fails.
#
# STRATEGY:
# 1. Create pool with cache devices.
# 2. Replacing one cache device
# 3. Verify replace fails
# 4. Destroy and loop to create pool with different configuration.
#
verify_runnable "global"
verify_disk_count "$LDEV2"
log_assert "Replacing a cache device fails."
log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
cache $LDEV
sdev=$(random_get $LDEV)
tdev=$(random_get $LDEV2)
log_mustnot $ZPOOL replace $TESTPOOL $sdev $tdev
log_must verify_cache_device $TESTPOOL $sdev 'ONLINE'
log_must check_vdev_state $TESTPOOL $tdev ""
log_must $ZPOOL destroy -f $TESTPOOL
done
log_pass "Replacing a cache device fails."
+85
View File
@@ -0,0 +1,85 @@
#!/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/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
#
# DESCRIPTION:
# Exporting and importing pool with cache devices passes.
#
# STRATEGY:
# 1. Create pool with cache devices.
# 2. Export and import the pool
# 3. Display pool status
# 4. Destroy and import the pool again
# 5. Display pool status
# 6. Destroy and loop to create pool with different configuration.
#
verify_runnable "global"
verify_disk_count "$LDEV2"
log_assert "Exporting and importing pool with cache devices passes."
log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
cache $LDEV $LDEV2
ldev=$(random_get $LDEV $LDEV2)
log_must verify_cache_device \
$TESTPOOL $ldev 'ONLINE'
#
# Nomal export/import operating
#
log_must $ZPOOL export $TESTPOOL
log_must $ZPOOL import -d $VDIR $TESTPOOL
log_must display_status $TESTPOOL
ldev=$(random_get $LDEV $LDEV2)
log_must verify_cache_device \
$TESTPOOL $ldev 'ONLINE'
#
# Destroy the pool and import again
#
log_must $ZPOOL destroy $TESTPOOL
log_must $ZPOOL import -Df -d $VDIR $TESTPOOL
log_must display_status $TESTPOOL
ldev=$(random_get $LDEV $LDEV2)
log_must verify_cache_device \
$TESTPOOL $ldev 'ONLINE'
log_must $ZPOOL destroy -f $TESTPOOL
done
log_pass "Exporting and importing pool with cache devices passes."
+63
View File
@@ -0,0 +1,63 @@
#!/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/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
#
# DESCRIPTION:
# A mirror/raidz/raidz2 cache is not supported.
#
# STRATEGY:
# 1. Try to create pool with unsupported type
# 2. Verify failed to create pool.
#
verify_runnable "global"
verify_disk_count "$LDEV2"
log_assert "A mirror/raidz/raidz2 cache is not supported."
log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
for cachetype in "mirror" "raidz" "raidz1" "raidz2"
do
log_mustnot $ZPOOL create $TESTPOOL $type $VDEV \
cache $cachetype $LDEV $LDEV2
ldev=$(random_get $LDEV $LDEV2)
log_mustnot verify_cache_device \
$TESTPOOL $ldev 'ONLINE' $cachetype
log_must datasetnonexists $TESTPOOL
done
done
log_pass "A mirror/raidz/raidz2 cache is not supported."
+67
View File
@@ -0,0 +1,67 @@
#!/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/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
#
# DESCRIPTION:
# A mirror/raidz/raidz2 cache can not be added to existed pool.
#
# STRATEGY:
# 1. Create pool with or without cache.
# 2. Add a mirror/raidz/raidz2 cache to this pool.
# 3. Verify failed to add.
#
verify_runnable "global"
verify_disk_count "$LDEV2"
log_assert "A raidz/raidz2 cache can not be added to existed pool."
log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
for cachetype in "mirror" "raidz" "raidz1" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
cache $LDEV
log_mustnot $ZPOOL add $TESTPOOL cache $cachetype $LDEV2
ldev=$(random_get $LDEV2)
log_mustnot verify_cache_device \
$TESTPOOL $ldev 'ONLINE' $cachetype
log_must $ZPOOL destroy $TESTPOOL
done
done
log_pass "A mirror/raidz/raidz2 cache can not be added to existed pool."
+69
View File
@@ -0,0 +1,69 @@
#!/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/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
#
# DESCRIPTION:
# Offline and online a cache device succeed.
#
# STRATEGY:
# 1. Create pool with mirror cache devices.
# 2. Offine and online a cache device
# 3. Display pool status
# 4. Destroy and loop to create pool with different configuration.
#
verify_runnable "global"
verify_disk_count "$LDEV2"
log_assert "Offline and online a cache device succeed."
log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
cache $LDEV $LDEV2
ldev=$(random_get $LDEV $LDEV2)
log_must $ZPOOL offline $TESTPOOL $ldev
log_must display_status $TESTPOOL
log_must verify_cache_device $TESTPOOL $ldev 'OFFLINE' ''
log_must $ZPOOL online $TESTPOOL $ldev
log_must display_status $TESTPOOL
log_must verify_cache_device $TESTPOOL $ldev 'ONLINE' ''
log_must $ZPOOL destroy -f $TESTPOOL
done
log_pass "Offline and online a cache device succeed."
+90
View File
@@ -0,0 +1,90 @@
#!/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 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
#
# DESCRIPTION:
# Verify cache device must be a block device.
#
# STRATEGY:
# 1. Create a pool
# 2. Add different object as cache
# 3. Verify character devices and files fail
#
verify_runnable "global"
function cleanup_testenv
{
cleanup
if [[ -n $lofidev ]]; then
log_must $LOFIADM -d $lofidev
fi
}
log_assert "Cache device can only be block devices."
log_onexit cleanup_testenv
TESTVOL=testvol1$$
dsk1=${DISKS%% *}
log_must $ZPOOL create $TESTPOOL ${DISKS#$dsk1}
if is_linux; then
SLICE="p1"
else
SLICE="s0"
fi
# Add nomal ${DEV_RDSKDIR} device
log_mustnot $ZPOOL add $TESTPOOL cache ${DEV_RDSKDIR}/${dsk1}${SLICE}
#log_must verify_cache_device $TESTPOOL $dsk1 'ONLINE'
# Add nomal file
log_mustnot $ZPOOL add $TESTPOOL cache $VDEV2
# Add /dev/rlofi device
lofidev=${VDEV2%% *}
log_must $LOFIADM -a $lofidev
lofidev=$($LOFIADM $lofidev)
log_mustnot $ZPOOL add $TESTPOOL cache "/dev/rlofi/${lofidev#/dev/lofi/}"
if [[ -n $lofidev ]]; then
log_must $LOFIADM -d $lofidev
lofidev=""
fi
# Add ${ZVOL_RDEVDIR} device
log_must $ZPOOL create $TESTPOOL2 $VDEV2
log_must $ZFS create -V $SIZE $TESTPOOL2/$TESTVOL
log_mustnot $ZPOOL add $TESTPOOL cache ${ZVOL_RDEVDIR}/$TESTPOOL2/$TESTVOL
log_pass "Cache device can only be block devices."
+68
View File
@@ -0,0 +1,68 @@
#!/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/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
#
# DESCRIPTION:
# Remove cache device from pool with spare device should succeed.
#
# STRATEGY:
# 1. Create pool with cache devices and spare devices
# 2. Remove cache device from the pool
# 3. The upper action should succeed
#
verify_runnable "global"
verify_disk_count "$LDEV2"
function cleanup {
if datasetexists $TESTPOOL ; then
log_must $ZPOOL destroy -f $TESTPOOL
fi
}
log_assert "Remove cache device from pool with spare device should succeed"
log_onexit cleanup
for type in "" "mirror" "raidz" "raidz2"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
cache $LDEV spare $LDEV2
log_must $ZPOOL remove $TESTPOOL $LDEV
log_must display_status $TESTPOOL
log_must $ZPOOL destroy -f $TESTPOOL
done
log_pass "Remove cache device from pool with spare device should succeed"
+46
View File
@@ -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 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Copyright (c) 2013 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
verify_runnable "global"
if datasetexists $TESTPOOL ; then
log_must $ZPOOL destroy -f $TESTPOOL
fi
if datasetexists $TESTPOOL2 ; then
log_must $ZPOOL destroy -f $TESTPOOL2
fi
log_must $RM -rf $VDIR $VDIR2
log_pass
+45
View File
@@ -0,0 +1,45 @@
#!/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/tests/functional/cache/cache.cfg
. $STF_SUITE/tests/functional/cache/cache.kshlib
verify_runnable "global"
if ! $(is_physical_device $LDEV) ; then
log_unsupported "Only physical disk could be cache device"
fi
log_must $RM -rf $VDIR $VDIR2
log_must $MKDIR -p $VDIR $VDIR2
log_must $MKFILE $SIZE $VDEV $VDEV2
log_pass