1#! /bin/ksh -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 28# 29# Copyright (c) 2012, 2016 by Delphix. All rights reserved. 30# 31 32. $STF_SUITE/include/libtest.shlib 33. $STF_SUITE/tests/functional/cli_root/zpool_expand/zpool_expand.cfg 34 35# 36# Description: 37# Once set zpool autoexpand=off, zpool can *NOT* autoexpand by 38# Dynamic LUN Expansion 39# 40# 41# STRATEGY: 42# 1) Create a pool 43# 2) Create volumes on top of the pool 44# 3) Create pool by using the zvols and set autoexpand=off 45# 4) Expand the vol size by zfs set volsize 46# 5) Check that the pool size is not changed 47# 48 49verify_runnable "global" 50 51function cleanup 52{ 53 if poolexists $TESTPOOL1; then 54 log_must zpool destroy $TESTPOOL1 55 fi 56 57 for i in 1 2 3; do 58 if datasetexists $VFS/vol$i; then 59 log_must zfs destroy $VFS/vol$i 60 fi 61 done 62} 63 64log_onexit cleanup 65 66log_assert "zpool can not expand if set autoexpand=off after LUN expansion" 67 68for i in 1 2 3; do 69 log_must zfs create -V $org_size $VFS/vol$i 70done 71 72for type in " " mirror raidz raidz2; do 73 log_must zpool create $TESTPOOL1 $type /dev/zvol/dsk/$VFS/vol1 \ 74 /dev/zvol/dsk/$VFS/vol2 /dev/zvol/dsk/$VFS/vol3 75 76 typeset autoexp=$(get_pool_prop autoexpand $TESTPOOL1) 77 if [[ $autoexp != "off" ]]; then 78 log_fail "zpool $TESTPOOL1 autoexpand should off but is " \ 79 "$autoexp" 80 fi 81 82 typeset prev_size=$(get_pool_prop size $TESTPOOL1) 83 84 for i in 1 2 3; do 85 log_must zfs set volsize=$exp_size $VFS/vol$i 86 done 87 88 sync 89 sleep 10 90 sync 91 92 # check for zpool history for the pool size expansion 93 zpool history -il $TESTPOOL1 | grep "pool '$TESTPOOL1' size:" | \ 94 grep "vdev online" >/dev/null 2>&1 95 96 if [[ $? -eq 0 ]]; then 97 log_fail "pool $TESTPOOL1 is not autoexpand after LUN " \ 98 "expansion" 99 fi 100 101 typeset expand_size=$(get_pool_prop size $TESTPOOL1) 102 103 if [[ "$prev_size" != "$expand_size" ]]; then 104 log_fail "pool $TESTPOOL1 size changed after LUN expansion" 105 fi 106 107 log_must zpool destroy $TESTPOOL1 108 109 for i in 1 2 3; do 110 log_must zfs set volsize=$org_size $VFS/vol$i 111 done 112 113done 114 115log_pass "zpool can not expand if set autoexpand=off after LUN expansion" 116