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# $FreeBSD$ 24 25# 26# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 27# Use is subject to license terms. 28# 29# ident "@(#)zpool_create_001_pos.ksh 1.4 09/05/19 SMI" 30# 31. $STF_SUITE/include/libtest.kshlib 32. $STF_SUITE/tests/cli_root/zpool_create/zpool_create.kshlib 33 34################################################################################ 35# 36# __stc_assertion_start 37# 38# ID: zpool_create_001_pos 39# 40# DESCRIPTION: 41# 'zpool create <pool> <vspec> ...' can successfully create a 42# new pool with a name in ZFS namespace. 43# 44# STRATEGY: 45# 1. Create storage pools with a name in ZFS namespace with different 46# vdev specs. 47# 2. Verify the pool created successfully 48# 49# TESTABILITY: explicit 50# 51# TEST_AUTOMATION_LEVEL: automated 52# 53# CODING_STATUS: COMPLETED (2005-07-04) 54# 55# __stc_assertion_end 56# 57################################################################################ 58 59verify_runnable "global" 60 61function cleanup 62{ 63 poolexists $TESTPOOL && destroy_pool $TESTPOOL 64 65 clean_blockfile "$TESTDIR0 $TESTDIR1" 66} 67 68log_assert "'zpool create <pool> <vspec> ...' can successfully create" \ 69 "a new pool with a name in ZFS namespace." 70 71log_onexit cleanup 72 73set -A keywords "" "mirror" "raidz" "raidz1" 74 75typeset diskname0=${DISK0#/dev/} 76typeset diskname1=${DISK1#/dev/} 77 78case $DISK_ARRAY_NUM in 790|1) 80 typeset disk="" 81 if (( $DISK_ARRAY_NUM == 0 )); then 82 disk=$DISK 83 else 84 disk=$DISK0 85 fi 86 typeset diskname=${disk#/dev/} 87 create_blockfile ${disk}p5 $TESTDIR0/$FILEDISK0 88 create_blockfile ${disk}p6 $TESTDIR1/$FILEDISK1 89 90 pooldevs="${diskname}p1 \ 91 /dev/${diskname}p1 \ 92 \"${diskname}p1 ${diskname}p2\" \ 93 $TESTDIR0/$FILEDISK0" 94 raidzdevs="\"/dev/${diskname}p1 ${diskname}p2\" \ 95 \"${diskname}p1 ${diskname}p2 ${diskname}p3\" \ 96 \"${diskname}p1 ${diskname}p2 ${diskname}p3 \ 97 ${diskname}p4\"\ 98 \"$TESTDIR0/$FILEDISK0 $TESTDIR1/$FILEDISK1\"" 99 mirrordevs=$raidzdevs 100 ;; 1012|*) 102 create_blockfile ${DISK0}p5 $TESTDIR0/$FILEDISK0 103 create_blockfile ${DISK1}p5 $TESTDIR1/$FILEDISK1 104 105 pooldevs="${diskname0}p1\ 106 \"/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 raidzdevs="\"/dev/${diskname0}p1 ${diskname1}p1\" \ 112 \"${diskname0}p1 ${diskname0}p2 ${diskname1}p2\"\ 113 \"${diskname0}p1 ${diskname1}p1 ${diskname0}p2\ 114 ${diskname1}p2\" \ 115 \"$TESTDIR0/$FILEDISK0 $TESTDIR1/$FILEDISK1\"" 116 mirrordevs=$raidzdevs 117 ;; 118esac 119 120typeset -i i=0 121while (( $i < ${#keywords[*]} )); do 122 case ${keywords[i]} in 123 "") 124 create_pool_test "$TESTPOOL" "${keywords[i]}" "$pooldevs";; 125 mirror) 126 create_pool_test "$TESTPOOL" "${keywords[i]}" "$mirrordevs";; 127 raidz|raidz1) 128 create_pool_test "$TESTPOOL" "${keywords[i]}" "$raidzdevs" ;; 129 esac 130 (( i = i+1 )) 131done 132 133log_pass "'zpool create <pool> <vspec> ...' success." 134