1#!/bin/ksh -p
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
6# Common Development and Distribution License (the "License").
7# You may not use this file except in compliance with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or https://opensource.org/licenses/CDDL-1.0.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22
23#
24# Copyright (c) 2020 Lawrence Livermore National Security, LLC.
25
26. $STF_SUITE/include/libtest.shlib
27
28#
29# DESCRIPTION:
30# Create a variety of dRAID pools using the minimal dRAID vdev syntax.
31#
32# STRATEGY:
33# 1) Create the required number of allowed dRAID vdevs.
34# 2) Create few pools of various sizes using the draid1|draid2|draid3 syntax.
35#
36
37verify_runnable "global"
38
39function cleanup
40{
41	poolexists $TESTPOOL && destroy_pool $TESTPOOL
42
43	rm -f $all_vdevs
44	rmdir $TESTDIR
45}
46
47log_assert "'zpool create <pool> <draid1|2|3> ...' can create a pool."
48
49log_onexit cleanup
50
51all_vdevs=$(echo $TESTDIR/file.{01..84})
52
53mkdir $TESTDIR
54log_must truncate -s $MINVDEVSIZE $all_vdevs
55
56# Verify all configurations up to 24 vdevs.
57for parity in {1..3}; do
58	for children in {$((parity + 2))..24}; do
59		vdevs=$(echo $TESTDIR/file.{01..${children}})
60		log_must zpool create $TESTPOOL draid$parity $vdevs
61		log_must poolexists $TESTPOOL
62		destroy_pool $TESTPOOL
63	done
64done
65
66# Spot check a few large configurations.
67children_counts="53 84"
68for children in $children_counts; do
69	vdevs=$(echo $TESTDIR/file.{01..${children}})
70	log_must zpool create $TESTPOOL draid $vdevs
71	log_must poolexists $TESTPOOL
72	destroy_pool $TESTPOOL
73done
74
75log_pass "'zpool create <pool> <draid1|2|3> <vdevs> ...' success."
76