]>
git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_005_pos.ksh
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 2008 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
29 # Copyright (c) 2012, 2016 by Delphix. All rights reserved.
32 .
$STF_SUITE/include
/libtest.shlib
33 .
$STF_SUITE/tests
/functional
/cli_root
/zpool_create
/zpool_create.shlib
37 # 'zpool create [-R root][-m mountpoint] <pool> <vdev> ...' can create an
38 # alternate root pool or a new pool mounted at the specified mountpoint.
41 # 1. Create a pool with '-m' option
42 # 2. Verify the pool is mounted at the specified mountpoint
45 verify_runnable
"global"
49 poolexists
$TESTPOOL && destroy_pool
$TESTPOOL
50 rm -rf $TESTDIR $TESTDIR1
53 log_assert
"'zpool create [-R root][-m mountpoint] <pool> <vdev> ...' can create" \
54 "an alternate pool or a new pool mounted at the specified mountpoint."
57 set -A pooltype
"" "mirror" "raidz" "raidz1" "raidz2" "draid" "draid2"
60 # cleanup the pools created in previous case if zpool_create_004_pos timedout
62 for pool
in $TESTPOOL2 $TESTPOOL1 $TESTPOOL; do
63 poolexists
$pool && destroy_pool
$pool
66 #prepare raw file for file disk
68 log_must mkdir
-p $TESTDIR
71 log_must truncate
-s $FILESIZE $TESTDIR/file.
$i
76 #Remove the directory with name as pool name if it exists
80 for opt
in "-R $TESTDIR1" "-m $TESTDIR1" \
81 "-R $TESTDIR1 -m $TESTDIR1" "-m $TESTDIR1 -R $TESTDIR1"
84 while (( i
< ${#pooltype[*]} )); do
85 #Remove the testing pool and its mount directory
86 poolexists
$TESTPOOL && \
87 log_must zpool destroy
-f $TESTPOOL
88 [[ -d $TESTDIR1 ]] && rm -rf $TESTDIR1
89 log_must zpool create
$opt $TESTPOOL ${pooltype[i]} \
90 $file.1 $file.2 $file.3 $file.4
91 ! poolexists
$TESTPOOL && \
92 log_fail
"Creating pool with $opt fails."
93 mpt
=`zfs mount | egrep "^$TESTPOOL[^/]" | awk '{print $2}'`
94 (( ${#mpt} == 0 )) && \
95 log_fail
"$TESTPOOL created with $opt is not mounted."
96 mpt_val
=$
(get_prop
"mountpoint" $TESTPOOL)
97 [[ "$mpt" != "$mpt_val" ]] && \
98 log_fail
"The value of mountpoint property is different\
99 from the output of zfs mount"
100 if [[ "$opt" == "-m $TESTDIR1" ]]; then
101 [[ ! -d $TESTDIR1 ]] && \
102 log_fail
"$TESTDIR1 is not created automatically."
103 [[ "$mpt" != "$TESTDIR1" ]] && \
104 log_fail
"$TESTPOOL is not mounted on $TESTDIR1."
105 elif [[ "$opt" == "-R $TESTDIR1" ]]; then
106 [[ ! -d $TESTDIR1/$TESTPOOL ]] && \
107 log_fail
"$TESTDIR1/$TESTPOOL is not created automatically."
108 [[ "$mpt" != "$TESTDIR1/$TESTPOOL" ]] && \
109 log_fail
"$TESTPOOL is not mounted on $TESTDIR1/$TESTPOOL."
111 [[ ! -d ${TESTDIR1}$TESTDIR1 ]] && \
112 log_fail
"${TESTDIR1}$TESTDIR1 is not created automatically."
113 [[ "$mpt" != "${TESTDIR1}$TESTDIR1" ]] && \
114 log_fail
"$TESTPOOL is not mounted on ${TESTDIR1}$TESTDIR1."
116 [[ -d /$TESTPOOL ]] && \
117 log_fail
"The default mountpoint /$TESTPOOL is created" \
118 "while with $opt option."
124 log_pass
"'zpool create [-R root][-m mountpoint] <pool> <vdev> ...' works as expected."