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_002_pos 34# 35# DESCRIPTION: 36# After zpool online -e poolname zvol vdevs, zpool can autoexpand by 37# Dynamic LUN Expansion 38# 39# 40# STRATEGY: 41# 1) Create a pool 42# 2) Create volume on top of the pool 43# 3) Create pool by using the zvols 44# 4) Expand the vol size by zfs set volsize 45# 5 Use zpool online -e to online the zvol vdevs 46# 6) Check that the pool size was expaned 47# 48# TESTABILITY: explicit 49# 50# TEST_AUTOMATION_LEVEL: automated 51# 52# CODING_STATUS: COMPLETED (2009-06-12) 53# 54# __stc_assertion_end 55# 56################################################################################ 57 58verify_runnable "global" 59 60function cleanup 61{ 62 destroy_pool $TESTPOOL1 63 64 for i in 1 2 3; do 65 if datasetexists $VFS/vol$i; then 66 log_must $ZFS destroy $VFS/vol$i 67 fi 68 done 69} 70 71log_onexit cleanup 72 73log_assert "zpool can expand after zpool online -e zvol vdevs on LUN expansion" 74 75for i in 1 2 3; do 76 log_must $ZFS create -V $org_size $VFS/vol$i 77done 78 79for type in " " mirror raidz raidz2; do 80 log_must $ZPOOL create $TESTPOOL1 $type \ 81 /dev/zvol/$VFS/vol1 \ 82 /dev/zvol/$VFS/vol2 \ 83 /dev/zvol/$VFS/vol3 84 85 typeset autoexp=$(get_pool_prop autoexpand $TESTPOOL1) 86 if [[ $autoexp != "off" ]]; then 87 log_fail "zpool $TESTPOOL1 autoexpand should off but is $autoexp" 88 fi 89 90 typeset prev_size=$(get_pool_prop size $TESTPOOL1) 91 92 for i in 1 2 3; do 93 log_must $ZFS set volsize=$exp_size $VFS/vol$i 94 done 95 96 for i in 1 2 3; do 97 log_must $ZPOOL online -e $TESTPOOL1 /dev/zvol/$VFS/vol$i 98 done 99 100 $SYNC 101 $SLEEP 10 102 $SYNC 103 104 # check for zpool history for the pool size expansion 105 if [[ $type == " " || $type == "mirror" ]]; then 106 $ZPOOL history -il $TESTPOOL1 | \ 107 $GREP "pool '$TESTPOOL1' size:" | \ 108 $GREP "internal vdev online" | \ 109 $GREP "(+${EX_1GB})" >/dev/null 2>&1 110 111 if [[ $? -ne 0 ]]; then 112 log_fail "pool $TESTPOOL1" \ 113 " is not autoexpand after LUN expansion" 114 fi 115 else 116 $ZPOOL history -il $TESTPOOL1 | \ 117 $GREP "pool '$TESTPOOL1' size:" | \ 118 $GREP "internal vdev online" | \ 119 $GREP "(+${EX_3GB})" >/dev/null 2>&1 120 121 if [[ $? -ne 0 ]] ; then 122 log_fail "pool $TESTPOOL1" \ 123 " is not autoexpand after LUN expansion" 124 fi 125 fi 126 127 typeset expand_size=$(get_pool_prop size $TESTPOOL1) 128 129 log_must $ZPOOL destroy $TESTPOOL1 130 131 for i in 1 2 3; do 132 log_must $ZFS set volsize=$org_size $VFS/vol$i 133 done 134 135done 136 137log_pass "zpool can expand after zpool online -e zvol vdevs on LUN expansion" 138