1*663207adSDon Brady#!/bin/ksh -p
2*663207adSDon Brady
3*663207adSDon Brady#
4*663207adSDon Brady# This file and its contents are supplied under the terms of the
5*663207adSDon Brady# Common Development and Distribution License ("CDDL"), version 1.0.
6*663207adSDon Brady# You may only use this file in accordance with the terms of version
7*663207adSDon Brady# 1.0 of the CDDL.
8*663207adSDon Brady#
9*663207adSDon Brady# A full copy of the text of the CDDL should have accompanied this
10*663207adSDon Brady# source.  A copy of the CDDL is also available via the Internet at
11*663207adSDon Brady# http://www.illumos.org/license/CDDL.
12*663207adSDon Brady#
13*663207adSDon Brady
14*663207adSDon Brady#
15*663207adSDon Brady# Copyright (c) 2017, Intel Corporation.
16*663207adSDon Brady# Copyright (c) 2018 by Delphix. All rights reserved.
17*663207adSDon Brady# Copyright 2019 Joyent, Inc.
18*663207adSDon Brady#
19*663207adSDon Brady
20*663207adSDon Brady. $STF_SUITE/tests/functional/alloc_class/alloc_class.kshlib
21*663207adSDon Brady
22*663207adSDon Brady#
23*663207adSDon Brady# DESCRIPTION:
24*663207adSDon Brady#	Checking if allocation_classes feature flag status is active after
25*663207adSDon Brady#	creating a pool with a special device.
26*663207adSDon Brady#
27*663207adSDon Bradyclaim="Checking active allocation classes feature flag status successful."
28*663207adSDon Brady
29*663207adSDon Bradyverify_runnable "global"
30*663207adSDon Brady
31*663207adSDon Bradylog_assert $claim
32*663207adSDon Bradylog_onexit cleanup
33*663207adSDon Brady
34*663207adSDon Bradylog_must disk_setup
35*663207adSDon Brady
36*663207adSDon Bradytypeset ac_value
37*663207adSDon Bradytypeset stype=""
38*663207adSDon Bradytypeset sdisks=""
39*663207adSDon Brady
40*663207adSDon Bradyfor type in "" "mirror" "raidz"
41*663207adSDon Bradydo
42*663207adSDon Brady	if [ "$type" = "mirror" ]; then
43*663207adSDon Brady		stype="mirror"
44*663207adSDon Brady		sdisks="${CLASS_DISK0} ${CLASS_DISK1} ${CLASS_DISK2}"
45*663207adSDon Brady	elif [ "$type" = "raidz" ]; then
46*663207adSDon Brady		stype="mirror"
47*663207adSDon Brady		sdisks="${CLASS_DISK0} ${CLASS_DISK1}"
48*663207adSDon Brady	else
49*663207adSDon Brady		stype=""
50*663207adSDon Brady		sdisks="${CLASS_DISK0}"
51*663207adSDon Brady	fi
52*663207adSDon Brady
53*663207adSDon Brady	log_must zpool create $TESTPOOL $type $ZPOOL_DISKS \
54*663207adSDon Brady	    special $stype $sdisks
55*663207adSDon Brady
56*663207adSDon Brady	ac_value="$(zpool get -Ho value feature@allocation_classes $TESTPOOL)"
57*663207adSDon Brady	if [ "$ac_value" = "active" ]; then
58*663207adSDon Brady		log_note "feature@allocation_classes is active"
59*663207adSDon Brady	else
60*663207adSDon Brady		log_fail "feature@allocation_classes not active, \
61*663207adSDon Brady		    status = $ac_value"
62*663207adSDon Brady	fi
63*663207adSDon Brady
64*663207adSDon Brady	log_must zpool destroy -f $TESTPOOL
65*663207adSDon Bradydone
66*663207adSDon Brady
67*663207adSDon Bradylog_pass $claim
68