]>
git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_001_pos.ksh
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.
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.
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]
24 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
29 # Copyright (c) 2012 by Delphix. All rights reserved.
32 .
$STF_SUITE/include
/libtest.shlib
33 .
$STF_SUITE/tests
/functional
/cli_root
/zpool_expand
/zpool_expand.cfg
37 # Once zpool set autoexpand=on poolname, zpool can autoexpand by
38 # Dynamic LUN Expansion
43 # 2) Create volume on top of the pool
44 # 3) Create pool by using the zvols and set autoexpand=on
45 # 4) Expand the vol size by 'zfs set volsize'
46 # 5) Check that the pool size was expanded
49 verify_runnable
"global"
53 if poolexists
$TESTPOOL1; then
54 log_must
$ZPOOL destroy
$TESTPOOL1
58 if datasetexists
$VFS/vol
$i; then
59 log_must
$ZFS destroy
$VFS/vol
$i
66 log_assert
"zpool can be autoexpanded after set autoexpand=on on LUN expansion"
69 log_must
$ZFS create
-V $org_size $VFS/vol
$i
72 for type in " " mirror raidz raidz2
; do
74 log_must
$ZPOOL create
-o autoexpand
=on
$TESTPOOL1 $type \
75 ${ZVOL_DEVDIR}/$VFS/vol1
${ZVOL_DEVDIR}/$VFS/vol2 \
76 ${ZVOL_DEVDIR}/$VFS/vol3
78 typeset autoexp
=$
(get_pool_prop autoexpand
$TESTPOOL1)
79 if [[ $autoexp != "on" ]]; then
80 log_fail
"zpool $TESTPOOL1 autoexpand should on but is $autoexp"
83 typeset prev_size
=$
(get_pool_prop size
$TESTPOOL1)
84 typeset zfs_prev_size
=$
($ZFS get
-p avail
$TESTPOOL1 |
$TAIL -1 | \
88 log_must
$ZFS set volsize
=$exp_size $VFS/vol
$i
95 typeset expand_size
=$
(get_pool_prop size
$TESTPOOL1)
96 typeset zfs_expand_size
=$
($ZFS get
-p avail
$TESTPOOL1 |
$TAIL -1 | \
99 log_note
"$TESTPOOL1 $type has previous size: $prev_size and " \
100 "expanded size: $expand_size"
101 # compare available pool size from zfs
102 if [[ $zfs_expand_size > $zfs_prev_size ]]; then
103 # check for zpool history for the pool size expansion
104 if [[ $type == " " ]]; then
105 typeset size_addition
=$
($ZPOOL history -il $TESTPOOL1 |\
106 $GREP "pool '$TESTPOOL1' size:" | \
107 $GREP "vdev online" | \
108 $GREP "(+${EX_1GB}" |
wc -l)
110 if [[ $size_addition -ne $i ]]; then
111 log_fail
"pool $TESTPOOL1 is not autoexpand " \
112 "after LUN expansion"
114 elif [[ $type == "mirror" ]]; then
115 $ZPOOL history -il $TESTPOOL1 | \
116 $GREP "pool '$TESTPOOL1' size:" | \
117 $GREP "vdev online" | \
118 $GREP "(+${EX_1GB})" >/dev
/null
2>&1
120 if [[ $?
-ne 0 ]] ; then
121 log_fail
"pool $TESTPOOL1 is not autoexpand " \
122 "after LUN expansion"
125 $ZPOOL history -il $TESTPOOL1 | \
126 $GREP "pool '$TESTPOOL1' size:" | \
127 $GREP "vdev online" | \
128 $GREP "(+${EX_3GB})" >/dev
/null
2>&1
130 if [[ $?
-ne 0 ]]; then
131 log_fail
"pool $TESTPOOL is not autoexpand " \
132 "after LUN expansion"
136 log_fail
"pool $TESTPOOL1 is not autoexpanded after LUN " \
140 log_must
$ZPOOL destroy
$TESTPOOL1
142 log_must
$ZFS set volsize
=$org_size $VFS/vol
$i
146 log_pass
"zpool can be autoexpanded after set autoexpand=on on LUN expansion"