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 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# 27 28. $STF_SUITE/include/libtest.shlib 29 30# 31# DESCRIPTION: 32# Verify zpool create succeed with multiple keywords combination. 33# 34# STRATEGY: 35# 1. Create base filesystem to hold virtual disk files. 36# 2. Create several files >= 64M. 37# 3. Verify 'zpool create' succeed with valid keywords combination. 38# 39 40verify_runnable "global" 41 42function cleanup 43{ 44 datasetexists $TESTPOOL1 && destroy_pool $TESTPOOL1 45 datasetexists $TESTPOOL && destroy_pool $TESTPOOL 46} 47 48 49log_assert "Verify 'zpool create' succeed with keywords combination." 50log_onexit cleanup 51 52create_pool $TESTPOOL $DISKS 53mntpnt=$(get_prop mountpoint $TESTPOOL) 54 55typeset -i i=0 56while ((i < 10)); do 57 log_must $MKFILE 64M $mntpnt/vdev$i 58 59 eval vdev$i=$mntpnt/vdev$i 60 ((i += 1)) 61done 62 63set -A valid_args \ 64 "mirror $vdev0 $vdev1 $vdev2 mirror $vdev3 $vdev4 $vdev5" \ 65 "mirror $vdev0 $vdev1 mirror $vdev2 $vdev3 mirror $vdev4 $vdev5" \ 66 "mirror $vdev0 $vdev1 $vdev2 mirror $vdev3 $vdev4 $vdev5 \ 67 spare $vdev6" \ 68 "mirror $vdev0 $vdev1 mirror $vdev2 $vdev3 mirror $vdev4 $vdev5 \ 69 spare $vdev6 $vdev7" \ 70 "mirror $vdev0 $vdev1 spare $vdev2 mirror $vdev3 $vdev4" \ 71 "raidz $vdev0 $vdev1 $vdev2 raidz1 $vdev3 $vdev4 $vdev5" \ 72 "raidz $vdev0 $vdev1 raidz1 $vdev2 $vdev3 raidz $vdev4 $vdev5" \ 73 "raidz $vdev0 $vdev1 $vdev2 raidz1 $vdev3 $vdev4 $vdev5 \ 74 spare $vdev6" \ 75 "raidz $vdev0 $vdev1 raidz1 $vdev2 $vdev3 raidz $vdev4 $vdev5 \ 76 spare $vdev6 $vdev7" \ 77 "raidz $vdev0 $vdev1 spare $vdev2 raidz $vdev3 $vdev4" \ 78 "raidz2 $vdev0 $vdev1 $vdev2 raidz2 $vdev3 $vdev4 $vdev5" \ 79 "raidz2 $vdev0 $vdev1 $vdev2 raidz2 $vdev3 $vdev4 $vdev5 \ 80 raidz2 $vdev6 $vdev7 $vdev8" \ 81 "raidz2 $vdev0 $vdev1 $vdev2 raidz2 $vdev3 $vdev4 $vdev5 \ 82 spare $vdev6" \ 83 "raidz2 $vdev0 $vdev1 $vdev2 raidz2 $vdev3 $vdev4 $vdev5 \ 84 raidz2 $vdev6 $vdev7 $vdev8 spare $vdev9" \ 85 "raidz2 $vdev0 $vdev1 $vdev2 spare $vdev3 raidz2 $vdev4 $vdev5 $vdev6" 86 87set -A forced_args \ 88 "$vdev0 raidz $vdev1 $vdev2 raidz1 $vdev3 $vdev4 $vdev5" \ 89 "$vdev0 raidz2 $vdev1 $vdev2 $vdev3 raidz2 $vdev4 $vdev5 $vdev6" \ 90 "$vdev0 mirror $vdev1 $vdev2 mirror $vdev3 $vdev4" \ 91 "$vdev0 mirror $vdev1 $vdev2 raidz $vdev3 $vdev4 \ 92 raidz2 $vdev5 $vdev6 $vdev7 spare $vdev8" \ 93 "$vdev0 mirror $vdev1 $vdev2 spare $vdev3 raidz $vdev4 $vdev5" \ 94 "raidz $vdev0 $vdev1 raidz2 $vdev2 $vdev3 $vdev4" \ 95 "raidz $vdev0 $vdev1 raidz2 $vdev2 $vdev3 $vdev4 spare $vdev5" \ 96 "raidz $vdev0 $vdev1 spare $vdev2 raidz2 $vdev3 $vdev4 $vdev5" \ 97 "mirror $vdev0 $vdev1 raidz $vdev2 $vdev3 raidz2 $vdev4 $vdev5 $vdev6" \ 98 "mirror $vdev0 $vdev1 raidz $vdev2 $vdev3 \ 99 raidz2 $vdev4 $vdev5 $vdev6 spare $vdev7" \ 100 "mirror $vdev0 $vdev1 raidz $vdev2 $vdev3 \ 101 spare $vdev4 raidz2 $vdev5 $vdev6 $vdev7" \ 102 "spare $vdev0 $vdev1 $vdev2 mirror $vdev3 $vdev4 raidz $vdev5 $vdev6" 103 104i=0 105while ((i < ${#valid_args[@]})); do 106 log_must $ZPOOL create $TESTPOOL1 ${valid_args[$i]} 107 $SYNC; $SYNC 108 log_must $ZPOOL destroy -f $TESTPOOL1 109 110 ((i += 1)) 111done 112 113i=0 114while ((i < ${#forced_args[@]})); do 115 log_mustnot $ZPOOL create $TESTPOOL1 ${forced_args[$i]} 116 log_must $ZPOOL create -f $TESTPOOL1 ${forced_args[$i]} 117 $SYNC; $SYNC 118 log_must $ZPOOL destroy -f $TESTPOOL1 119 120 ((i += 1)) 121done 122 123log_pass "'zpool create' succeed with keywords combination." 124