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 https://opensource.org/licenses/CDDL-1.0.
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.
25 # Copyright (c) 2020 by Delphix. All rights reserved.
28 .
$STF_SUITE/include
/libtest.shlib
29 .
$STF_SUITE/tests
/functional
/cli_root
/zpool_create
/zpool_create.shlib
33 # 'zpool attach -o ashift=<n> ...' should work with different ashift
37 # 1. Create various pools with different ashift values.
38 # 2. Verify 'attach' works.
41 verify_runnable
"global"
45 log_must set_tunable32 VDEV_FILE_PHYSICAL_ASHIFT
$orig_ashift
46 poolexists
$TESTPOOL1 && destroy_pool
$TESTPOOL1
50 log_assert
"zpool attach -o ashift=<n>' works with different ashift values"
53 disk1
=$TEST_BASE_DIR/disk1
54 disk2
=$TEST_BASE_DIR/disk2
55 log_must truncate
-s $SIZE $disk1
56 log_must truncate
-s $SIZE $disk2
58 orig_ashift
=$
(get_tunable VDEV_FILE_PHYSICAL_ASHIFT
)
60 # Set the file vdev's ashift to the max. Overriding
61 # the ashift using the -o ashift property should still
64 log_must set_tunable32 VDEV_FILE_PHYSICAL_ASHIFT
16
66 typeset ashifts
=("9" "10" "11" "12" "13" "14" "15" "16")
67 for ashift
in ${ashifts[@]}
69 log_must zpool create
-o ashift
=$ashift $TESTPOOL1 $disk1
70 log_must verify_ashift
$disk1 $ashift
71 log_must zpool attach
$TESTPOOL1 $disk1 $disk2
72 log_must verify_ashift
$disk2 $ashift
73 # clean things for the next run
74 log_must zpool destroy
$TESTPOOL1
75 log_must zpool labelclear
$disk1
76 log_must zpool labelclear
$disk2
79 typeset badvals
=("off" "on" "1" "8" "17" "1b" "ff" "-")
80 for badval
in ${badvals[@]}
82 log_must zpool create
$TESTPOOL1 $disk1
83 log_mustnot zpool attach
-o ashift
=$badval $TESTPOOL1 $disk1 $disk2
84 log_must zpool destroy
$TESTPOOL1
85 log_must zpool labelclear
$disk1
86 log_mustnot zpool labelclear
$disk2
89 log_pass
"zpool attach -o ashift=<n>' works with different ashift values"