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# $FreeBSD$ 24 25# 26# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 27# Use is subject to license terms. 28# 29# ident "@(#)zpool_expand_001_pos.ksh 1.2 09/08/06 SMI" 30# 31 32. $STF_SUITE/include/libtest.kshlib 33 34############################################################################### 35# 36# __stc_assertion_start 37# 38# ID: zpool_expand_001_pos 39# 40# DESCRIPTION: 41# Once zpool set autoexpand=on poolname, zpool can autoexpand by 42# Dynamic LUN Expansion 43# 44# 45# STRATEGY: 46# 1) Create a pool 47# 2) Create volume on top of the pool 48# 3) Create pool by using the zvols and set autoexpand=on 49# 4) Expand the vol size by 'zfs set volsize' 50# 5) Check that the pool size was expanded 51# 52# TESTABILITY: explicit 53# 54# TEST_AUTOMATION_LEVEL: automated 55# 56# CODING_STATUS: COMPLETED (2009-06-12) 57# 58# __stc_assertion_end 59# 60################################################################################ 61 62verify_runnable "global" 63 64function cleanup 65{ 66 destroy_pool $TESTPOOL1 67 68 for i in 1 2 3; do 69 if datasetexists $VFS/vol$i; then 70 log_must $ZFS destroy $VFS/vol$i 71 fi 72 done 73} 74 75log_onexit cleanup 76 77log_assert "zpool can be autoexpanded after set autoexpand=on on LUN expansion" 78 79for i in 1 2 3; do 80 log_must $ZFS create -V $org_size $VFS/vol$i 81done 82 83for type in " " mirror raidz raidz2; do 84 85 log_must $ZPOOL create -o autoexpand=on $TESTPOOL1 $type \ 86 /dev/zvol/$VFS/vol1 \ 87 /dev/zvol/$VFS/vol2 \ 88 /dev/zvol/$VFS/vol3 89 90 typeset autoexp=$(get_pool_prop autoexpand $TESTPOOL1) 91 if [[ $autoexp != "on" ]]; then 92 log_fail "zpool $TESTPOOL1 autoexpand should on but is $autoexp" 93 fi 94 95 typeset prev_size=$(get_pool_prop size $TESTPOOL1) 96 97 for i in 1 2 3; do 98 log_must $ZFS set volsize=$exp_size $VFS/vol$i 99 done 100 101 $SYNC 102 $SLEEP 10 103 $SYNC 104 105 typeset expand_size=$(get_pool_prop size $TESTPOOL1) 106 107 # check for zpool history for the pool size expansion 108 if [[ $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 log_must $ZPOOL destroy $TESTPOOL1 131 132 for i in 1 2 3; do 133 log_must $ZFS set volsize=$org_size $VFS/vol$i 134 done 135 136done 137 138log_pass "zpool can be autoexpanded after set autoexpand=on on LUN expansion" 139