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 2017, loli10K. All rights reserved.
27 .
$STF_SUITE/include
/libtest.shlib
28 .
$STF_SUITE/tests
/functional
/cli_root
/zpool_create
/zpool_create.shlib
32 # 'zpool attach -o ashift=<n> ...' should work with different ashift
36 # 1. Create various pools with different ashift values.
37 # 2. Verify 'attach -o ashift=<n>' works only with allowed values.
40 verify_runnable
"global"
44 poolexists
$TESTPOOL1 && destroy_pool
$TESTPOOL1
49 log_assert
"zpool attach -o ashift=<n>' works with different ashift values"
52 disk1
=$TEST_BASE_DIR/$FILEDISK0
53 disk2
=$TEST_BASE_DIR/$FILEDISK1
54 log_must truncate
-s $SIZE $disk1
55 log_must truncate
-s $SIZE $disk2
57 typeset ashifts
=("9" "10" "11" "12" "13" "14" "15" "16")
58 for ashift
in ${ashifts[@]}
60 for cmdval
in ${ashifts[@]}
62 log_must zpool create
-o ashift
=$ashift $TESTPOOL1 $disk1
63 verify_ashift
$disk1 $ashift
66 log_fail
"Pool was created without setting ashift " \
69 # ashift_of(attached_disk) <= ashift_of(existing_vdev)
70 if [[ $cmdval -le $ashift ]]
72 log_must zpool attach
-o ashift
=$cmdval $TESTPOOL1 \
74 verify_ashift
$disk2 $ashift
77 log_fail
"Device was attached without " \
78 "setting ashift value to $ashift"
81 log_mustnot zpool attach
-o ashift
=$cmdval $TESTPOOL1 \
84 # clean things for the next run
85 log_must zpool destroy
$TESTPOOL1
86 log_must zpool labelclear
$disk1
87 log_must zpool labelclear
$disk2
91 typeset badvals
=("off" "on" "1" "8" "17" "1b" "ff" "-")
92 for badval
in ${badvals[@]}
94 log_must zpool create
$TESTPOOL1 $disk1
95 log_mustnot zpool attach
$TESTPOOL1 -o ashift
=$badval $disk1 $disk2
96 log_must zpool destroy
$TESTPOOL1
97 log_must zpool labelclear
$disk1
98 log_mustnot zpool labelclear
$disk2
101 log_pass
"zpool attach -o ashift=<n>' works with different ashift values"