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 2009 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_001_pos 34# 35# DESCRIPTION: 36# 'zpool create <pool> <vspec> ...' can successfully create a 37# new pool with a name in ZFS namespace. 38# 39# STRATEGY: 40# 1. Create storage pools with a name in ZFS namespace with different 41# vdev specs. 42# 2. Verify the pool created successfully 43# 44# TESTABILITY: explicit 45# 46# TEST_AUTOMATION_LEVEL: automated 47# 48# CODING_STATUS: COMPLETED (2005-07-04) 49# 50# __stc_assertion_end 51# 52################################################################################ 53 54verify_runnable "global" 55 56function cleanup 57{ 58 poolexists $TESTPOOL && destroy_pool $TESTPOOL 59 60 clean_blockfile "$TESTDIR0 $TESTDIR1" 61} 62 63log_assert "'zpool create <pool> <vspec> ...' can successfully create" \ 64 "a new pool with a name in ZFS namespace." 65 66log_onexit cleanup 67 68set -A keywords "" "mirror" "raidz" "raidz1" 69 70typeset diskname0=${DISK0#/dev/} 71typeset diskname1=${DISK1#/dev/} 72 73case $DISK_ARRAY_NUM in 740|1) 75 typeset disk="" 76 if (( $DISK_ARRAY_NUM == 0 )); then 77 disk=$DISK 78 else 79 disk=$DISK0 80 fi 81 typeset diskname=${disk#/dev/} 82 create_blockfile ${disk}p5 $TESTDIR0/$FILEDISK0 83 create_blockfile ${disk}p6 $TESTDIR1/$FILEDISK1 84 85 pooldevs="${diskname}p1 \ 86 /dev/${diskname}p1 \ 87 \"${diskname}p1 ${diskname}p2\" \ 88 $TESTDIR0/$FILEDISK0" 89 raidzdevs="\"/dev/${diskname}p1 ${diskname}p2\" \ 90 \"${diskname}p1 ${diskname}p2 ${diskname}p3\" \ 91 \"${diskname}p1 ${diskname}p2 ${diskname}p3 \ 92 ${diskname}p4\"\ 93 \"$TESTDIR0/$FILEDISK0 $TESTDIR1/$FILEDISK1\"" 94 mirrordevs=$raidzdevs 95 ;; 962|*) 97 create_blockfile ${DISK0}p5 $TESTDIR0/$FILEDISK0 98 create_blockfile ${DISK1}p5 $TESTDIR1/$FILEDISK1 99 100 pooldevs="${diskname0}p1\ 101 \"/dev/${diskname0}p1 ${diskname1}p1\" \ 102 \"${diskname0}p1 ${diskname0}p2 ${diskname1}p2\"\ 103 \"${diskname0}p1 ${diskname1}p1 ${diskname0}p2\ 104 ${diskname1}p2\" \ 105 \"$TESTDIR0/$FILEDISK0 $TESTDIR1/$FILEDISK1\"" 106 raidzdevs="\"/dev/${diskname0}p1 ${diskname1}p1\" \ 107 \"${diskname0}p1 ${diskname0}p2 ${diskname1}p2\"\ 108 \"${diskname0}p1 ${diskname1}p1 ${diskname0}p2\ 109 ${diskname1}p2\" \ 110 \"$TESTDIR0/$FILEDISK0 $TESTDIR1/$FILEDISK1\"" 111 mirrordevs=$raidzdevs 112 ;; 113esac 114 115typeset -i i=0 116while (( $i < ${#keywords[*]} )); do 117 case ${keywords[i]} in 118 "") 119 create_pool_test "$TESTPOOL" "${keywords[i]}" "$pooldevs";; 120 mirror) 121 create_pool_test "$TESTPOOL" "${keywords[i]}" "$mirrordevs";; 122 raidz|raidz1) 123 create_pool_test "$TESTPOOL" "${keywords[i]}" "$raidzdevs" ;; 124 esac 125 (( i = i+1 )) 126done 127 128log_pass "'zpool create <pool> <vspec> ...' success." 129