]>
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, 2016 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"
51 # See issue: https://github.com/zfsonlinux/zfs/issues/5771
53 log_unsupported
"Requires additional ZED support"
58 if poolexists
$TESTPOOL1; then
59 log_must zpool destroy
$TESTPOOL1
63 if datasetexists
$VFS/vol
$i; then
64 log_must zfs destroy
$VFS/vol
$i
71 log_assert
"zpool can be autoexpanded after set autoexpand=on on LUN expansion"
74 log_must zfs create
-V $org_size $VFS/vol
$i
78 for type in " " mirror raidz raidz2
; do
80 log_must zpool create
-o autoexpand
=on
$TESTPOOL1 $type \
81 ${ZVOL_DEVDIR}/$VFS/vol1
${ZVOL_DEVDIR}/$VFS/vol2 \
82 ${ZVOL_DEVDIR}/$VFS/vol3
84 typeset autoexp
=$
(get_pool_prop autoexpand
$TESTPOOL1)
85 if [[ $autoexp != "on" ]]; then
86 log_fail
"zpool $TESTPOOL1 autoexpand should on but is $autoexp"
89 typeset prev_size
=$
(get_pool_prop size
$TESTPOOL1)
90 typeset zfs_prev_size
=$
(zfs get
-p avail
$TESTPOOL1 |
tail -1 | \
94 log_must zfs
set volsize
=$exp_size $VFS/vol
$i
101 typeset expand_size
=$
(get_pool_prop size
$TESTPOOL1)
102 typeset zfs_expand_size
=$
(zfs get
-p avail
$TESTPOOL1 |
tail -1 | \
105 log_note
"$TESTPOOL1 $type has previous size: $prev_size and " \
106 "expanded size: $expand_size"
107 # compare available pool size from zfs
108 if [[ $zfs_expand_size > $zfs_prev_size ]]; then
109 # check for zpool history for the pool size expansion
110 if [[ $type == " " ]]; then
111 typeset expansion_size
=$
(($exp_size-$org_size))
112 typeset size_addition
=$
(zpool
history -il $TESTPOOL1 |\
113 grep "pool '$TESTPOOL1' size:" | \
114 grep "vdev online" | \
115 grep "(+${expansion_size}" |
wc -l)
117 if [[ $size_addition -ne $i ]]; then
118 log_fail
"pool $TESTPOOL1 is not autoexpand " \
119 "after LUN expansion"
121 elif [[ $type == "mirror" ]]; then
122 typeset expansion_size
=$
(($exp_size-$org_size))
123 zpool
history -il $TESTPOOL1 | \
124 grep "pool '$TESTPOOL1' size:" | \
125 grep "vdev online" | \
126 grep "(+${expansion_size})" >/dev
/null
2>&1
128 if [[ $?
-ne 0 ]] ; then
129 log_fail
"pool $TESTPOOL1 is not autoexpand " \
130 "after LUN expansion"
133 typeset expansion_size
=$
((3*($exp_size-$org_size)))
134 zpool
history -il $TESTPOOL1 | \
135 grep "pool '$TESTPOOL1' size:" | \
136 grep "vdev online" | \
137 grep "(+${expansion_size})" >/dev
/null
2>&1
139 if [[ $?
-ne 0 ]]; then
140 log_fail
"pool $TESTPOOL is not autoexpand " \
141 "after LUN expansion"
145 log_fail
"pool $TESTPOOL1 is not autoexpanded after LUN " \
149 log_must zpool destroy
$TESTPOOL1
151 log_must zfs
set volsize
=$org_size $VFS/vol
$i
155 log_pass
"zpool can be autoexpanded after set autoexpand=on on LUN expansion"