1#!/usr/local/bin/ksh93 -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 http://www.opensolaris.org/os/licensing.
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 2008 Sun Microsystems, Inc.  All rights reserved.
25# Use is subject to license terms.
26. $STF_SUITE/include/libtest.kshlib
27. $STF_SUITE/tests/cli_root/zpool_create/zpool_create.kshlib
28
29################################################################################
30#
31# __stc_assertion_start
32#
33# ID: zpool_create_004_pos
34#
35# DESCRIPTION:
36# 'zpool create [-f]' can create a storage pool with large number of
37# file-in-zfs-filesystem-based vdevs without any errors.
38#
39# STRATEGY:
40# 1. Create assigned number of files in ZFS filesystem as vdevs
41# 2. Creating a new pool based on the vdevs should get success
42# 3. Fill in the filesystem and create a partially writen file as vdev
43# 4. Add the new file into vdevs list and create a pool
44# 5. Creating a storage pool with the new vdevs list should be failed.
45#
46# TESTABILITY: explicit
47#
48# TEST_AUTOMATION_LEVEL: automated
49#
50# CODING_STATUS: COMPLETED (2005-08-25)
51#
52# __stc_assertion_end
53#
54################################################################################
55
56verify_runnable "global"
57
58VDEVS_POOL=create_004_pool
59
60function cleanup
61{
62	destroy_pool $VDEVS_POOL
63	destroy_pool $TESTPOOL2
64	destroy_pool $TESTPOOL1
65	destroy_pool $TESTPOOL
66	[ -d "$TESTDIR" ] && log_must $RM -rf $TESTDIR
67}
68
69log_assert "'zpool create [-f]' can create a pool with $VDEVS_NUM vdevs " \
70		"without any errors."
71log_onexit cleanup
72
73log_note "Creating storage pool with $VDEVS_NUM file vdevs should succeed."
74vdevs_list=""
75file_size=$FILE_SIZE
76
77[ -n "$DISK" ] && disk=$DISK || disk=$DISK0
78create_pool $TESTPOOL $disk
79$ZFS create -o mountpoint=$TESTDIR $TESTPOOL/$TESTFS
80
81for (( i = 0; $i < $VDEVS_NUM; i++ )); do
82	log_must create_vdevs $TESTDIR/vdev.${i}
83	vdevs_list="$vdevs_list $TESTDIR/vdev.${i}"
84done
85
86create_pool $TESTPOOL1 $vdevs_list
87destroy_pool $TESTPOOL1
88
89log_pass "'zpool create [-f]' with $VDEVS_NUM vdevs success."
90