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