1*5711d393Sloli#!/bin/ksh -p 2*5711d393Sloli# 3*5711d393Sloli# CDDL HEADER START 4*5711d393Sloli# 5*5711d393Sloli# The contents of this file are subject to the terms of the 6*5711d393Sloli# Common Development and Distribution License (the "License"). 7*5711d393Sloli# You may not use this file except in compliance with the License. 8*5711d393Sloli# 9*5711d393Sloli# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*5711d393Sloli# or http://www.opensolaris.org/os/licensing. 11*5711d393Sloli# See the License for the specific language governing permissions 12*5711d393Sloli# and limitations under the License. 13*5711d393Sloli# 14*5711d393Sloli# When distributing Covered Code, include this CDDL HEADER in each 15*5711d393Sloli# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*5711d393Sloli# If applicable, add the following below this CDDL HEADER, with the 17*5711d393Sloli# fields enclosed by brackets "[]" replaced with your own identifying 18*5711d393Sloli# information: Portions Copyright [yyyy] [name of copyright owner] 19*5711d393Sloli# 20*5711d393Sloli# CDDL HEADER END 21*5711d393Sloli# 22*5711d393Sloli 23*5711d393Sloli# 24*5711d393Sloli# Copyright 2017, loli10K. All rights reserved. 25*5711d393Sloli# 26*5711d393Sloli 27*5711d393Sloli. $STF_SUITE/include/libtest.shlib 28*5711d393Sloli. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib 29*5711d393Sloli 30*5711d393Sloli# 31*5711d393Sloli# DESCRIPTION: 32*5711d393Sloli# 'zpool add -o ashift=<n> ...' should work with different ashift 33*5711d393Sloli# values. 34*5711d393Sloli# 35*5711d393Sloli# STRATEGY: 36*5711d393Sloli# 1. Create a pool with default values. 37*5711d393Sloli# 2. Verify 'zpool add -o ashift=<n>' works with allowed values (9-16). 38*5711d393Sloli# 3. Verify 'zpool add -o ashift=<n>' doesn't accept other invalid values. 39*5711d393Sloli# 40*5711d393Sloli 41*5711d393Sloliverify_runnable "global" 42*5711d393Sloli 43*5711d393Slolifunction cleanup 44*5711d393Sloli{ 45*5711d393Sloli poolexists $TESTPOOL && destroy_pool $TESTPOOL 46*5711d393Sloli log_must rm -f $disk1 $disk2 47*5711d393Sloli} 48*5711d393Sloli 49*5711d393Slolilog_assert "zpool add -o ashift=<n>' works with different ashift values" 50*5711d393Slolilog_onexit cleanup 51*5711d393Sloli 52*5711d393Slolidisk1=$TEST_BASE_DIR/$FILEDISK0 53*5711d393Slolidisk2=$TEST_BASE_DIR/$FILEDISK1 54*5711d393Slolilog_must mkfile $SIZE $disk1 55*5711d393Slolilog_must mkfile $SIZE $disk2 56*5711d393Sloli 57*5711d393Slolitypeset ashifts=("9" "10" "11" "12" "13" "14" "15" "16") 58*5711d393Slolifor ashift in ${ashifts[@]} 59*5711d393Slolido 60*5711d393Sloli log_must zpool create $TESTPOOL $disk1 61*5711d393Sloli log_must zpool add -o ashift=$ashift $TESTPOOL $disk2 62*5711d393Sloli verify_ashift $disk2 $ashift 63*5711d393Sloli if [[ $? -ne 0 ]] 64*5711d393Sloli then 65*5711d393Sloli log_fail "Device was added without setting ashift value to "\ 66*5711d393Sloli "$ashift" 67*5711d393Sloli fi 68*5711d393Sloli # clean things for the next run 69*5711d393Sloli log_must zpool destroy $TESTPOOL 70*5711d393Sloli log_must zpool labelclear $disk1 71*5711d393Sloli log_must zpool labelclear $disk2 72*5711d393Slolidone 73*5711d393Sloli 74*5711d393Slolitypeset badvals=("off" "on" "1" "8" "17" "1b" "ff" "-") 75*5711d393Slolifor badval in ${badvals[@]} 76*5711d393Slolido 77*5711d393Sloli log_must zpool create $TESTPOOL $disk1 78*5711d393Sloli log_mustnot zpool add $TESTPOOL -o ashift="$badval" $disk2 79*5711d393Sloli # clean things for the next run 80*5711d393Sloli log_must zpool destroy $TESTPOOL 81*5711d393Sloli log_must zpool labelclear $disk1 82*5711d393Sloli log_mustnot zpool labelclear $disk2 83*5711d393Slolidone 84*5711d393Sloli 85*5711d393Slolilog_pass "zpool add -o ashift=<n>' works with different ashift values" 86