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.
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
34 # zpool set can modify 'ashift' property
38 # 2. Verify that we can set 'ashift' only to allowed values on that pool
41 verify_runnable "global"
45 log_must set_tunable64 VDEV_FILE_PHYSICAL_ASHIFT $orig_ashift
46 destroy_pool $TESTPOOL1
50 typeset goodvals=("0" "9" "10" "11" "12" "13" "14" "15" "16")
51 typeset badvals=("off" "on" "1" "8" "17" "1b" "ff" "-")
55 log_assert "zpool set can modify 'ashift' property"
57 orig_ashift=$(get_tunable VDEV_FILE_PHYSICAL_ASHIFT)
59 # Set the file vdev's ashift to the max. Overriding
60 # the ashift using the -o ashift property should still
63 log_must set_tunable64 VDEV_FILE_PHYSICAL_ASHIFT 16
65 disk=$TEST_BASE_DIR/disk
66 log_must mkfile $SIZE $disk
67 log_must zpool create $TESTPOOL1 $disk
69 for ashift in ${goodvals[@]}
71 log_must zpool set ashift=$ashift $TESTPOOL1
72 typeset value=$(get_pool_prop ashift $TESTPOOL1)
73 if [[ "$ashift" != "$value" ]]; then
74 log_fail "'zpool set' did not update ashift value to $ashift "\
79 for ashift in ${badvals[@]}
81 log_mustnot zpool set ashift=$ashift $TESTPOOL1
82 typeset value=$(get_pool_prop ashift $TESTPOOL1)
83 if [[ "$ashift" == "$value" ]]; then
84 log_fail "'zpool set' incorrectly set ashift value to $value"
88 log_pass "zpool set can modify 'ashift' property"