mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Pool allocation classes
Allocation Classes add the ability to have allocation classes in a pool that are dedicated to serving specific block categories, such as DDT data, metadata, and small file blocks. A pool can opt-in to this feature by adding a 'special' or 'dedup' top-level VDEV. Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com> Reviewed-by: Richard Laager <rlaager@wiktel.com> Reviewed-by: Alek Pinchuk <apinchuk@datto.com> Reviewed-by: Håkan Johansson <f96hajo@chalmers.se> Reviewed-by: Andreas Dilger <andreas.dilger@chamcloud.com> Reviewed-by: DHE <git@dehacked.net> Reviewed-by: Richard Elling <Richard.Elling@RichardElling.com> Reviewed-by: Gregor Kopka <gregor@kopka.net> Reviewed-by: Kash Pande <kash@tripleback.net> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Signed-off-by: Don Brady <don.brady@delphix.com> Closes #5182
This commit is contained in:
committed by
Brian Behlendorf
parent
cfa37548eb
commit
cc99f275a2
@@ -24,6 +24,14 @@ tags = ['functional']
|
||||
tests = ['posix_001_pos', 'posix_002_pos', 'posix_003_pos']
|
||||
tags = ['functional', 'acl', 'posix']
|
||||
|
||||
[tests/functional/alloc_class]
|
||||
tests = ['alloc_class_001_pos', 'alloc_class_002_neg', 'alloc_class_003_pos',
|
||||
'alloc_class_004_pos', 'alloc_class_005_pos', 'alloc_class_006_pos',
|
||||
'alloc_class_007_pos', 'alloc_class_008_pos', 'alloc_class_009_pos',
|
||||
'alloc_class_010_pos', 'alloc_class_011_neg', 'alloc_class_012_pos',
|
||||
'alloc_class_013_pos']
|
||||
tags = ['functional', 'alloc_class']
|
||||
|
||||
[tests/functional/arc]
|
||||
tests = ['dbufstats_001_pos', 'dbufstats_002_pos']
|
||||
tags = ['functional', 'arc']
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
SUBDIRS = \
|
||||
acl \
|
||||
alloc_class \
|
||||
arc \
|
||||
atime \
|
||||
bootfs \
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/alloc_class
|
||||
dist_pkgdata_SCRIPTS = \
|
||||
alloc_class.cfg \
|
||||
alloc_class.kshlib \
|
||||
setup.ksh \
|
||||
cleanup.ksh \
|
||||
alloc_class_001_pos.ksh \
|
||||
alloc_class_002_neg.ksh \
|
||||
alloc_class_003_pos.ksh \
|
||||
alloc_class_004_pos.ksh \
|
||||
alloc_class_005_pos.ksh \
|
||||
alloc_class_006_pos.ksh \
|
||||
alloc_class_007_pos.ksh \
|
||||
alloc_class_008_pos.ksh \
|
||||
alloc_class_009_pos.ksh \
|
||||
alloc_class_010_pos.ksh \
|
||||
alloc_class_011_neg.ksh \
|
||||
alloc_class_012_pos.ksh \
|
||||
alloc_class_013_pos.ksh
|
||||
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2017, Intel Corporation.
|
||||
# Copyright (c) 2018 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
||||
export ZPOOL_DISK0="$TEST_BASE_DIR/device-0"
|
||||
export ZPOOL_DISK1="$TEST_BASE_DIR/device-1"
|
||||
export ZPOOL_DISK2="$TEST_BASE_DIR/device-2"
|
||||
export ZPOOL_DISKS="${ZPOOL_DISK0} ${ZPOOL_DISK1} ${ZPOOL_DISK2}"
|
||||
|
||||
export CLASS_DISK0="$TEST_BASE_DIR/device-3"
|
||||
export CLASS_DISK1="$TEST_BASE_DIR/device-4"
|
||||
export CLASS_DISK2="$TEST_BASE_DIR/device-5"
|
||||
export CLASS_DISK3="$TEST_BASE_DIR/device-6"
|
||||
export CLASS_DISKS="${CLASS_DISK0} ${CLASS_DISK1} ${CLASS_DISK2} ${CLASS_DISK3}"
|
||||
|
||||
export ZPOOL_DEVSIZE=1G
|
||||
export CLASS_DEVSIZE=512M
|
||||
@@ -0,0 +1,67 @@
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2017, Intel Corporation.
|
||||
# Copyright (c) 2018 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
. $STF_SUITE/tests/functional/alloc_class/alloc_class.cfg
|
||||
|
||||
function disk_setup
|
||||
{
|
||||
truncate -s $ZPOOL_DEVSIZE $ZPOOL_DISKS
|
||||
truncate -s $CLASS_DEVSIZE $CLASS_DISKS
|
||||
}
|
||||
|
||||
function disk_cleanup
|
||||
{
|
||||
rm -f $ZPOOL_DEVSIZE $ZPOOL_DISKS 2> /dev/null
|
||||
rm -f $CLASS_DEVSIZE $CLASS_DISKS 2> /dev/null
|
||||
}
|
||||
|
||||
function cleanup
|
||||
{
|
||||
if datasetexists $TESTPOOL ; then
|
||||
zpool destroy -f $TESTPOOL 2> /dev/null
|
||||
fi
|
||||
|
||||
disk_cleanup
|
||||
}
|
||||
|
||||
#
|
||||
# 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
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
#!/bin/ksh -p
|
||||
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2017, Intel Corporation.
|
||||
# Copyright (c) 2018 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/tests/functional/alloc_class/alloc_class.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Creating a pool with a special device succeeds.
|
||||
#
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
claim="Creating a pool with a special device succeeds."
|
||||
|
||||
log_assert $claim
|
||||
log_onexit cleanup
|
||||
|
||||
log_must disk_setup
|
||||
log_must zpool create $TESTPOOL raidz $ZPOOL_DISKS special mirror \
|
||||
$CLASS_DISK0 $CLASS_DISK1
|
||||
log_must display_status "$TESTPOOL"
|
||||
log_must zpool destroy -f "$TESTPOOL"
|
||||
|
||||
log_pass $claim
|
||||
@@ -0,0 +1,48 @@
|
||||
#!/bin/ksh -p
|
||||
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2017, Intel Corporation.
|
||||
# Copyright (c) 2018 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/tests/functional/alloc_class/alloc_class.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Creating a pool fails when an invalid special device type is specified.
|
||||
#
|
||||
claim="Creating a pool with an invalid special device type fails."
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
log_assert $claim
|
||||
log_onexit cleanup
|
||||
|
||||
log_must disk_setup
|
||||
|
||||
log_mustnot zpool create $TESTPOOL raidz $ZPOOL_DISKS special $CLASS_DISK0
|
||||
log_mustnot display_status $TESTPOOL
|
||||
log_mustnot zpool destroy -f $TESTPOOL
|
||||
|
||||
log_mustnot zpool create $TESTPOOL $ZPOOL_DISKS special mirror \
|
||||
$CLASS_DISK0 $CLASS_DISK1
|
||||
log_mustnot display_status $TESTPOOL
|
||||
log_mustnot zpool destroy -f $TESTPOOL
|
||||
|
||||
log_mustnot zpool create $TESTPOOL raidz $ZPOOL_DISKS special raidz \
|
||||
$CLASS_DISK0 $CLASS_DISK1 $CLASS_DISK2
|
||||
log_mustnot display_status $TESTPOOL
|
||||
log_mustnot zpool destroy -f $TESTPOOL
|
||||
|
||||
log_pass $claim
|
||||
@@ -0,0 +1,57 @@
|
||||
#!/bin/ksh -p
|
||||
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2017, Intel Corporation.
|
||||
# Copyright (c) 2018 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/tests/functional/alloc_class/alloc_class.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Adding a special device to a normal pool succeeds.
|
||||
#
|
||||
claim="Adding a special device to a normal pool succeeds."
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
log_assert $claim
|
||||
log_onexit cleanup
|
||||
|
||||
log_must disk_setup
|
||||
|
||||
for type in "" "mirror" "raidz"
|
||||
do
|
||||
log_must zpool create $TESTPOOL $type $ZPOOL_DISKS
|
||||
|
||||
if [ "$type" = "mirror" ]; then
|
||||
log_must zpool add $TESTPOOL special mirror \
|
||||
$CLASS_DISK0 $CLASS_DISK1 $CLASS_DISK2
|
||||
log_must zpool iostat -H $TESTPOOL $CLASS_DISK0
|
||||
log_must zpool iostat -H $TESTPOOL $CLASS_DISK1
|
||||
log_must zpool iostat -H $TESTPOOL $CLASS_DISK2
|
||||
elif [ "$type" = "raidz" ]; then
|
||||
log_must zpool add $TESTPOOL special mirror \
|
||||
$CLASS_DISK0 $CLASS_DISK1
|
||||
log_must zpool iostat -H $TESTPOOL $CLASS_DISK0
|
||||
log_must zpool iostat -H $TESTPOOL $CLASS_DISK1
|
||||
else
|
||||
log_must zpool add $TESTPOOL special $CLASS_DISK0
|
||||
log_must zpool iostat -H $TESTPOOL $CLASS_DISK0
|
||||
fi
|
||||
|
||||
log_must zpool destroy -f $TESTPOOL
|
||||
done
|
||||
|
||||
log_pass $claim
|
||||
@@ -0,0 +1,67 @@
|
||||
#!/bin/ksh -p
|
||||
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2017, Intel Corporation.
|
||||
# Copyright (c) 2018 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/tests/functional/alloc_class/alloc_class.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Checking if allocation_classes feature flag status is active after
|
||||
# creating a pool with a special device.
|
||||
#
|
||||
claim="Checking active allocation classes feature flag status successful."
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
log_assert $claim
|
||||
log_onexit cleanup
|
||||
|
||||
log_must disk_setup
|
||||
|
||||
typeset ac_value
|
||||
typeset stype=""
|
||||
typeset sdisks=""
|
||||
|
||||
for type in "" "mirror" "raidz"
|
||||
do
|
||||
if [ "$type" = "mirror" ]; then
|
||||
stype="mirror"
|
||||
sdisks="${CLASS_DISK0} ${CLASS_DISK1} ${CLASS_DISK2}"
|
||||
elif [ "$type" = "raidz" ]; then
|
||||
stype="mirror"
|
||||
sdisks="${CLASS_DISK0} ${CLASS_DISK1}"
|
||||
else
|
||||
stype=""
|
||||
sdisks="${CLASS_DISK0}"
|
||||
fi
|
||||
|
||||
log_must zpool create $TESTPOOL $type $ZPOOL_DISKS \
|
||||
special $stype $sdisks
|
||||
|
||||
ac_value="$(zpool get all -H -o property,value | \
|
||||
egrep allocation_classes | nawk '{print $2}')"
|
||||
if [ "$ac_value" = "active" ]; then
|
||||
log_note "feature@allocation_classes is active"
|
||||
else
|
||||
log_fail "feature@allocation_classes not active, \
|
||||
status = $ac_value"
|
||||
fi
|
||||
|
||||
log_must zpool destroy -f $TESTPOOL
|
||||
done
|
||||
|
||||
log_pass $claim
|
||||
@@ -0,0 +1,71 @@
|
||||
#!/bin/ksh -p
|
||||
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2017, Intel Corporation.
|
||||
# Copyright (c) 2018 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/tests/functional/alloc_class/alloc_class.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Checking allocation_classes feature flag value after pool is created
|
||||
# (should be enabled) and also after a special device added to existing
|
||||
# pool (should be active).
|
||||
#
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
log_assert "Values of allocation_classes feature flag correct."
|
||||
log_onexit cleanup
|
||||
|
||||
log_must disk_setup
|
||||
|
||||
typeset ac_value
|
||||
|
||||
for type in "" "mirror" "raidz"
|
||||
do
|
||||
if [ "$type" = "mirror" ]; then
|
||||
log_must zpool create $TESTPOOL $type $ZPOOL_DISK0 $ZPOOL_DISK1
|
||||
else
|
||||
log_must zpool create $TESTPOOL $type $ZPOOL_DISKS
|
||||
fi
|
||||
ac_value="$(zpool get all -H -o property,value | \
|
||||
egrep allocation_classes | awk '{print $2}')"
|
||||
if [ "$ac_value" = "enabled" ]; then
|
||||
log_note "feature@allocation_classes is enabled"
|
||||
else
|
||||
log_fail "feature@allocation_classes not enabled, \
|
||||
status = $ac_value"
|
||||
fi
|
||||
|
||||
if [ "$type" = "" ]; then
|
||||
log_must zpool add $TESTPOOL special $CLASS_DISK0
|
||||
else
|
||||
log_must zpool add $TESTPOOL special mirror \
|
||||
$CLASS_DISK0 $CLASS_DISK1
|
||||
fi
|
||||
ac_value="$(zpool get all -H -o property,value | \
|
||||
egrep allocation_classes | awk '{print $2}')"
|
||||
if [ "$ac_value" = "active" ]; then
|
||||
log_note "feature@allocation_classes is active"
|
||||
else
|
||||
log_fail "feature@allocation_classes not active, \
|
||||
status = $ac_value"
|
||||
fi
|
||||
|
||||
log_must zpool destroy -f $TESTPOOL
|
||||
done
|
||||
|
||||
log_pass "Values of allocation_classes feature flag correct."
|
||||
@@ -0,0 +1,41 @@
|
||||
#!/bin/ksh -p
|
||||
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2017, Intel Corporation.
|
||||
# Copyright (c) 2018 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/tests/functional/alloc_class/alloc_class.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Using zpool split command to detach disks from mirrored special pool
|
||||
# to create a new pool with the detached disks.
|
||||
#
|
||||
claim="zpool split command succeeds with special devices present."
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
log_assert $claim
|
||||
log_onexit cleanup
|
||||
|
||||
log_must disk_setup
|
||||
|
||||
log_must zpool create $TESTPOOL \
|
||||
mirror $ZPOOL_DISK0 $ZPOOL_DISK1 \
|
||||
special mirror $CLASS_DISK0 $CLASS_DISK1
|
||||
log_must zpool split $TESTPOOL split_pool
|
||||
log_must zpool destroy -f $TESTPOOL
|
||||
|
||||
log_pass $claim
|
||||
@@ -0,0 +1,41 @@
|
||||
#!/bin/ksh -p
|
||||
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2017, Intel Corporation.
|
||||
# Copyright (c) 2018 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/tests/functional/alloc_class/alloc_class.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Replacing a special device succeeds
|
||||
#
|
||||
claim="Replacing a special device is successful."
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
log_assert $claim
|
||||
log_onexit cleanup
|
||||
|
||||
log_must disk_setup
|
||||
|
||||
log_must zpool create $TESTPOOL raidz $ZPOOL_DISKS \
|
||||
special mirror $CLASS_DISK0 $CLASS_DISK1
|
||||
log_must zpool replace $TESTPOOL $CLASS_DISK1 $CLASS_DISK2
|
||||
log_must sleep 10
|
||||
log_must zpool iostat -H $TESTPOOL $CLASS_DISK2
|
||||
log_must zpool destroy -f $TESTPOOL
|
||||
|
||||
log_pass $claim
|
||||
@@ -0,0 +1,56 @@
|
||||
#!/bin/ksh -p
|
||||
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2017, Intel Corporation.
|
||||
# Copyright (c) 2018 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/tests/functional/alloc_class/alloc_class.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Adding an additional special device to a pool with special succeeds.
|
||||
#
|
||||
claim="Adding an additional special device succeeds."
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
log_assert $claim
|
||||
log_onexit cleanup
|
||||
|
||||
log_must disk_setup
|
||||
|
||||
typeset special_type=""
|
||||
typeset create_disks=""
|
||||
typeset added_disks=""
|
||||
|
||||
for type in "" "raidz"
|
||||
do
|
||||
if [ "$type" = "raidz" ]; then
|
||||
special_type="mirror"
|
||||
create_disks="${CLASS_DISK0} ${CLASS_DISK1}"
|
||||
added_disks="${CLASS_DISK2} ${CLASS_DISK3}"
|
||||
else
|
||||
special_type=""
|
||||
create_disks="${CLASS_DISK0}"
|
||||
added_disks="${CLASS_DISK1}"
|
||||
fi
|
||||
log_must zpool create $TESTPOOL $type $ZPOOL_DISKS \
|
||||
special $special_type $create_disks
|
||||
log_must zpool add $TESTPOOL special $special_type $added_disks
|
||||
log_must zpool iostat $TESTPOOL $added_disks
|
||||
log_must zpool destroy -f $TESTPOOL
|
||||
done
|
||||
|
||||
log_pass $claim
|
||||
@@ -0,0 +1,58 @@
|
||||
#!/bin/ksh -p
|
||||
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2017, Intel Corporation.
|
||||
# Copyright (c) 2018 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/tests/functional/alloc_class/alloc_class.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Importing and exporting pool with special device succeeds.
|
||||
#
|
||||
claim="Import/export of pool with special device mirror succeeds."
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
log_assert $claim
|
||||
log_onexit cleanup
|
||||
|
||||
log_must disk_setup
|
||||
|
||||
typeset stype=""
|
||||
typeset sdisks=""
|
||||
|
||||
for type in "" "mirror" "raidz"
|
||||
do
|
||||
if [ "$type" = "mirror" ]; then
|
||||
stype="mirror"
|
||||
sdisks="${CLASS_DISK0} ${CLASS_DISK1} ${CLASS_DISK2}"
|
||||
elif [ "$type" = "raidz" ]; then
|
||||
stype="mirror"
|
||||
sdisks="${CLASS_DISK0} ${CLASS_DISK1}"
|
||||
else
|
||||
stype=""
|
||||
special_args="${CLASS_DISK0}"
|
||||
fi
|
||||
|
||||
log_must zpool create $TESTPOOL $type $ZPOOL_DISKS \
|
||||
special $stype $sdisks
|
||||
log_must zpool export $TESTPOOL
|
||||
log_must zpool import -d $TEST_BASE_DIR -s $TESTPOOL
|
||||
log_must display_status $TESTPOOL
|
||||
log_must zpool destroy -f $TESTPOOL
|
||||
done
|
||||
|
||||
log_pass $claim
|
||||
@@ -0,0 +1,50 @@
|
||||
#!/bin/ksh -p
|
||||
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2017, Intel Corporation.
|
||||
# Copyright (c) 2018 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/tests/functional/alloc_class/alloc_class.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Setting the special_small_blocks property to a valid value succeeds.
|
||||
#
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
claim="Setting the special_small_blocks property to a valid value succeeds."
|
||||
|
||||
log_assert $claim
|
||||
log_onexit cleanup
|
||||
|
||||
log_must disk_setup
|
||||
|
||||
log_must zpool create $TESTPOOL raidz $ZPOOL_DISKS special mirror \
|
||||
$CLASS_DISK0 $CLASS_DISK1
|
||||
|
||||
for value in 0 512 1024 2048 4096 8192 16384 32768 65536 131072
|
||||
do
|
||||
log_must zfs set special_small_blocks=$value $TESTPOOL
|
||||
ACTUAL=$(zfs get -p special_small_blocks $TESTPOOL | \
|
||||
grep special_small_blocks | awk '{print $3}')
|
||||
if [ "$ACTUAL" != "$value" ]
|
||||
then
|
||||
log_fail "v. $ACTUAL set for $TESTPOOL, expected v. $value!"
|
||||
fi
|
||||
done
|
||||
|
||||
log_must zpool destroy -f "$TESTPOOL"
|
||||
log_pass $claim
|
||||
@@ -0,0 +1,43 @@
|
||||
#!/bin/ksh -p
|
||||
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2017, Intel Corporation.
|
||||
# Copyright (c) 2018 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/tests/functional/alloc_class/alloc_class.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Setting the special_small_blocks property to invalid values fails.
|
||||
#
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
claim="Setting the special_small_blocks property to invalid values fails."
|
||||
|
||||
log_assert $claim
|
||||
log_onexit cleanup
|
||||
|
||||
log_must disk_setup
|
||||
log_must zpool create $TESTPOOL raidz $ZPOOL_DISKS special mirror \
|
||||
$CLASS_DISK0 $CLASS_DISK1
|
||||
|
||||
for value in 256 1025 262144
|
||||
do
|
||||
log_mustnot zfs set special_small_blocks=$value $TESTPOOL
|
||||
done
|
||||
|
||||
log_must zpool destroy -f "$TESTPOOL"
|
||||
log_pass $claim
|
||||
@@ -0,0 +1,69 @@
|
||||
#!/bin/ksh -p
|
||||
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2018 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/tests/functional/alloc_class/alloc_class.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Removing a special device from a pool succeeds.
|
||||
#
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
claim= "Removing a special device from a pool succeeds."
|
||||
|
||||
log_assert $claim
|
||||
log_onexit cleanup
|
||||
|
||||
#
|
||||
# Create a non-raidz pool so we can remove top-level vdevs
|
||||
#
|
||||
log_must disk_setup
|
||||
log_must zpool create $TESTPOOL $ZPOOL_DISK0 $ZPOOL_DISK1 $ZPOOL_DISK2 \
|
||||
special $CLASS_DISK0 special $CLASS_DISK1
|
||||
log_must display_status "$TESTPOOL"
|
||||
|
||||
#
|
||||
# Generate some metadata and small blocks in the special class before removal
|
||||
#
|
||||
typeset -l i=1
|
||||
typeset -l blocks=25
|
||||
|
||||
log_must zfs create -o special_small_blocks=32K -o recordsize=32K \
|
||||
$TESTPOOL/$TESTFS
|
||||
for i in 1 2 3 4; do
|
||||
log_must dd if=/dev/urandom of=/$TESTPOOL/$TESTFS/testfile.$i bs=1M \
|
||||
count=$blocks
|
||||
((blocks = blocks + 25))
|
||||
done
|
||||
log_must sync_pool $TESTPOOL
|
||||
log_must zpool list -v $TESTPOOL
|
||||
|
||||
#
|
||||
# remove a special allocation vdev and force a remapping
|
||||
#
|
||||
log_must zpool remove $TESTPOOL $CLASS_DISK0
|
||||
log_must zfs remap $TESTPOOL/$TESTFS
|
||||
|
||||
sleep 5
|
||||
log_must sync_pool $TESTPOOL
|
||||
sleep 1
|
||||
|
||||
log_must zdb -bbcc $TESTPOOL
|
||||
log_must zpool destroy -f "$TESTPOOL"
|
||||
|
||||
log_pass $claim
|
||||
@@ -0,0 +1,63 @@
|
||||
#!/bin/ksh -p
|
||||
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2018 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/tests/functional/alloc_class/alloc_class.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Removing a dedup device from a pool succeeds.
|
||||
#
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
claim= "Removing a dedup device from a pool succeeds."
|
||||
|
||||
log_assert $claim
|
||||
log_onexit cleanup
|
||||
|
||||
#
|
||||
# Create a non-raidz pool so we can remove top-level vdevs
|
||||
#
|
||||
log_must disk_setup
|
||||
log_must zpool create $TESTPOOL $ZPOOL_DISKS dedup $CLASS_DISK0
|
||||
log_must display_status "$TESTPOOL"
|
||||
|
||||
#
|
||||
# Generate some dedup data in the dedup class before removal
|
||||
#
|
||||
|
||||
log_must zfs create -o dedup=on -V 2G $TESTPOOL/$TESTVOL
|
||||
|
||||
log_must echo y | newfs $ZVOL_DEVDIR/$TESTPOOL/$TESTVOL >/dev/null 2>&1
|
||||
|
||||
sync_pool
|
||||
log_must zpool list -v $TESTPOOL
|
||||
|
||||
#
|
||||
# remove a dedup allocation vdev
|
||||
#
|
||||
log_must zpool remove $TESTPOOL $CLASS_DISK0
|
||||
|
||||
sleep 5
|
||||
log_must sync_pool $TESTPOOL
|
||||
sleep 1
|
||||
|
||||
log_must zdb -bbcc $TESTPOOL
|
||||
|
||||
log_must zpool destroy -f "$TESTPOOL"
|
||||
|
||||
log_pass $claim
|
||||
@@ -0,0 +1,27 @@
|
||||
#!/bin/ksh -p
|
||||
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2017, Intel Corporation.
|
||||
# Copyright (c) 2018, Delphix
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
. $STF_SUITE/tests/functional/alloc_class/alloc_class.kshlib
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
pool_cleanup
|
||||
disk_cleanup
|
||||
|
||||
log_pass
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/ksh -p
|
||||
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2017, Intel Corporation.
|
||||
# Copyright (c) 2018 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
. $STF_SUITE/tests/functional/alloc_class/alloc_class.kshlib
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
disk_cleanup
|
||||
|
||||
log_pass
|
||||
@@ -86,5 +86,6 @@ if is_linux; then
|
||||
"feature@userobj_accounting"
|
||||
"feature@encryption"
|
||||
"feature@project_quota"
|
||||
"feature@allocation_classes"
|
||||
)
|
||||
fi
|
||||
|
||||
@@ -50,6 +50,7 @@ function cleanup
|
||||
# "l" - log
|
||||
# "ll" - mirrored log
|
||||
# "c" - cache
|
||||
# "sc" - special class
|
||||
#
|
||||
function pool_config # <vdev-type>
|
||||
{
|
||||
@@ -66,6 +67,7 @@ function pool_config # <vdev-type>
|
||||
disks[l]="l1"
|
||||
disks[ll]="l1 l2"
|
||||
disks[c]="c1"
|
||||
disks[sc]="sc1 sc2"
|
||||
case $1 in
|
||||
d|t) # single disk or stripe
|
||||
vdev='' ;;
|
||||
@@ -85,6 +87,8 @@ function pool_config # <vdev-type>
|
||||
vdev='log mirror';;
|
||||
c) # cache
|
||||
vdev='cache';;
|
||||
sc) # mirrored special class
|
||||
vdev='special mirror';;
|
||||
*)
|
||||
log_fail "setup_pool: unsupported vdev type '$1'"
|
||||
esac
|
||||
@@ -108,7 +112,7 @@ log_onexit cleanup
|
||||
# "good" and "bad" pool layouts
|
||||
# first token is always used with "zpool create"
|
||||
# second to last tokens, if any, are used with "zpool add"
|
||||
typeset -a goodconfs=("m" "m l" "m s" "m c" "m m" "m3" "m3 m3" "m m3 l s c")
|
||||
typeset -a goodconfs=("m" "m l" "m s" "m c" "m m" "m3" "m3 m3" "m m3 l s c" "m m sc")
|
||||
typeset -a badconfs=("d" "z1" "z2" "z3" "m d" "m3 d" "m z1" "m z2" "m z3")
|
||||
typeset FILEDEV_PREFIX="$TEST_BASE_DIR/filedev"
|
||||
typeset altroot="$TESTDIR/altroot-$TESTPOOL2"
|
||||
|
||||
Reference in New Issue
Block a user