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.
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.
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]
24 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
29 # Copyright (c) 2013, 2016 by Delphix. All rights reserved.
32 . $STF_SUITE/include/libtest.shlib
37 # Test that a set of valid names can be used to create pools. Further
38 # verify that the created pools can be destroyed.
41 # 1) For each valid character in the character set, try to create
42 # and destroy the pool.
43 # 2) Given a list of valid pool names, try to create and destroy
44 # pools with the given names.
47 verify_runnable "global"
49 log_assert "Ensure that pool names can use the ASCII subset of UTF-8"
53 if [[ -n $name ]] && poolexists $name ; then
54 log_must zpool destroy $name
57 if [[ -d $TESTDIR ]]; then
58 log_must rm -rf $TESTDIR
66 if [[ ! -e $TESTDIR ]]; then
67 log_must mkdir $TESTDIR
70 log_note "Ensure letters of the alphabet are allowable"
74 for name in A B C D E F G H I J K L M \
75 N O P Q R S T U V W X Y Z \
76 a b c d e f g h i j k l m \
77 n o p q r s t u v w x y z
79 log_must zpool create -m $TESTDIR $name $DISK
80 if ! poolexists $name; then
81 log_fail "Could not create a pool called '$name'"
84 log_must zpool destroy $name
87 log_note "Ensure a variety of unusual names passes"
91 for name in "a.............................." "a_" "a-" "a:" \
92 "a." "a123456" "bc0t0d0" "m1rr0r_p00l" "ra1dz_p00l" \
93 "araidz2" "C0t2d0" "cc0t0" "raid2:-_." "mirr_:-." \
94 "m1rr0r-p00l" "ra1dz-p00l" "spar3_p00l" \
95 "spar3-p00l" "hiddenmirrorpool" "hiddenraidzpool" \
98 log_must zpool create -m $TESTDIR $name $DISK
99 if ! poolexists $name; then
100 log_fail "Could not create a pool called '$name'"
104 # Since the naming convention applies to datasets too,
105 # create datasets with the same names as above.
107 log_must zfs create $name/$name
108 log_must zfs snapshot $name/$name@$name
109 log_must zfs clone $name/$name@$name $name/clone_$name
110 log_must zfs create -V 150m $name/$name/$name
113 log_must zpool destroy $name
116 log_pass "Valid pool names were accepted correctly."