1#! /usr/local/bin/ksh93 -p 2# 3# CDDL HEADER START 4# 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. 8# 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. 13# 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] 19# 20# CDDL HEADER END 21# 22 23# 24# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 25# Use is subject to license terms. 26 27. $STF_SUITE/include/libtest.kshlib 28 29############################################################################### 30# 31# __stc_assertion_start 32# 33# ID: zpool_expand_003_neg 34# 35# Description: 36# Once set zpool autoexpand=off, zpool can *NOT* autoexpand by 37# Dynamic LUN Expansion 38# 39# 40# STRATEGY: 41# 1) Create a pool 42# 2) Create volumes on top of the pool 43# 3) Create pool by using the zvols and set autoexpand=off 44# 4) Expand the vol size by zfs set volsize 45# 5) Check that the pool size is not changed 46# 47# TESTABILITY: explicit 48# 49# TEST_AUTOMATION_LEVEL: automated 50# 51# CODING_STATUS: COMPLETED (2009-06-12) 52# 53# __stc_assertion_end 54# 55################################################################################ 56 57verify_runnable "global" 58 59function cleanup 60{ 61 destroy_pool $TESTPOOL1 62 63 for i in 1 2 3; do 64 if datasetexists $VFS/vol$i; then 65 log_must $ZFS destroy $VFS/vol$i 66 fi 67 done 68} 69 70log_onexit cleanup 71 72log_assert "zpool can not expand if set autoexpand=off after LUN expansion" 73 74for i in 1 2 3; do 75 log_must $ZFS create -V $org_size $VFS/vol$i 76done 77 78for type in "" mirror raidz raidz2; do 79 log_must $ZPOOL create $TESTPOOL1 $type \ 80 /dev/zvol/$VFS/vol1 \ 81 /dev/zvol/$VFS/vol2 \ 82 /dev/zvol/$VFS/vol3 83 84 typeset autoexp=$(get_pool_prop autoexpand $TESTPOOL1) 85 if [[ $autoexp != "off" ]]; then 86 log_fail "zpool $TESTPOOL1 autoexpand should off but is $autoexp" 87 fi 88 89 typeset prev_size=$(get_pool_prop size $TESTPOOL1) 90 91 for i in 1 2 3; do 92 log_must $ZFS set volsize=$exp_size $VFS/vol$i 93 done 94 95 $SYNC 96 $SLEEP 10 97 $SYNC 98 99 # check for zpool history for the pool size expansion 100 $ZPOOL history -il $TESTPOOL1 | \ 101 $GREP "pool '$TESTPOOL1' size:" | \ 102 $GREP "internal vdev online" >/dev/null 2>&1 103 104 if [[ $? -eq 0 ]]; then 105 log_fail "pool $TESTPOOL1" \ 106 " is not autoexpand after LUN expansion" 107 fi 108 109 typeset expand_size=$(get_pool_prop size $TESTPOOL1) 110 111 if [[ "$prev_size" != "$expand_size" ]]; then 112 log_fail "pool $TESTPOOL1 size changed after LUN expansion" 113 fi 114 115 log_must $ZPOOL destroy $TESTPOOL1 116 117 for i in 1 2 3; do 118 log_must $ZFS set volsize=$org_size $VFS/vol$i 119 done 120 121done 122 123log_pass "zpool can not expand if set autoexpand=off after LUN expansion" 124