xref: /illumos-gate/usr/src/test/zfs-tests/tests/functional/alloc_class/alloc_class_009_pos.ksh (revision 3b436d06bb95fd180ef7416b2b1b9972e2f2a513)
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#	Importing and exporting pool with special device succeeds.
25#
26claim="Import/export of pool with special device mirror succeeds."
27
28verify_runnable "global"
29
30log_assert $claim
31log_onexit cleanup
32
33log_must disk_setup
34
35typeset stype=""
36typeset sdisks=""
37
38typeset imp_opt=""
39case "$(uname)" in
40	Linux)	imp_opt="-s"
41		;;
42esac
43
44for type in "" "mirror" "raidz"
45do
46	if [ "$type" = "mirror" ]; then
47		stype="mirror"
48		sdisks="${CLASS_DISK0} ${CLASS_DISK1} ${CLASS_DISK2}"
49	elif [ "$type" = "raidz" ]; then
50		stype="mirror"
51		sdisks="${CLASS_DISK0} ${CLASS_DISK1}"
52	else
53		stype=""
54		special_args="${CLASS_DISK0}"
55	fi
56
57	log_must zpool create $TESTPOOL $type $ZPOOL_DISKS \
58	    special $stype $sdisks
59	log_must zpool export $TESTPOOL
60	log_must zpool import -d $TEST_BASE_DIR $imp_opt $TESTPOOL
61	log_must display_status $TESTPOOL
62	log_must zpool destroy -f $TESTPOOL
63done
64
65log_pass $claim
66