xref: /illumos-gate/usr/src/test/zfs-tests/tests/functional/alloc_class/alloc_class_003_pos.ksh (revision f52943a93040563107b95bccb9db87d9971ef47d)
1#!/bin/ksh -p
2
3#
4# This file and its contents are supplied under the terms of the
5# Common Development and Distribution License ("CDDL"), version 1.0.
6# You may only use this file in accordance with the terms of version
7# 1.0 of the CDDL.
8#
9# A full copy of the text of the CDDL should have accompanied this
10# source.  A copy of the CDDL is also available via the Internet at
11# http://www.illumos.org/license/CDDL.
12#
13
14#
15# Copyright (c) 2017, Intel Corporation.
16# Copyright (c) 2018 by Delphix. All rights reserved.
17# Copyright 2019 Joyent, Inc.
18#
19
20. $STF_SUITE/tests/functional/alloc_class/alloc_class.kshlib
21
22#
23# DESCRIPTION:
24#	Adding a special device to a normal pool succeeds.
25#
26claim="Adding a special device to a normal pool succeeds."
27
28verify_runnable "global"
29
30log_assert $claim
31log_onexit cleanup
32
33log_must disk_setup
34
35for type in "" "mirror" "raidz"
36do
37	log_must zpool create $TESTPOOL $type $ZPOOL_DISKS
38
39	if [ "$type" = "mirror" ]; then
40		log_must zpool add $TESTPOOL special mirror \
41		    $CLASS_DISK0 $CLASS_DISK1 $CLASS_DISK2
42		log_must zpool clear $TESTPOOL $CLASS_DISK0
43		log_must zpool clear $TESTPOOL $CLASS_DISK1
44		log_must zpool clear $TESTPOOL $CLASS_DISK2
45	elif [ "$type" = "raidz" ]; then
46		log_must zpool add $TESTPOOL special mirror \
47		    $CLASS_DISK0 $CLASS_DISK1
48		log_must zpool clear $TESTPOOL $CLASS_DISK0
49		log_must zpool clear $TESTPOOL $CLASS_DISK1
50	else
51		log_must zpool add $TESTPOOL special $CLASS_DISK0
52		log_must zpool clear $TESTPOOL $CLASS_DISK0
53	fi
54
55	log_must zpool destroy -f $TESTPOOL
56done
57
58log_pass $claim
59