]> git.proxmox.com Git - mirror_zfs-debian.git/blame - tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_003_neg.ksh
New upstream version 0.7.2
[mirror_zfs-debian.git] / tests / zfs-tests / tests / functional / cli_root / zpool_expand / zpool_expand_003_neg.ksh
CommitLineData
cae5b340
AX
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
51# See issue: https://github.com/zfsonlinux/zfs/issues/5771
52if is_linux; then
53 log_unsupported "Requires additional ZED support"
54fi
55
56function cleanup
57{
58 if poolexists $TESTPOOL1; then
59 log_must zpool destroy $TESTPOOL1
60 fi
61
62 for i in 1 2 3; do
63 if datasetexists $VFS/vol$i; then
64 log_must zfs destroy $VFS/vol$i
65 fi
66 done
67}
68
69log_onexit cleanup
70
71log_assert "zpool can not expand if set autoexpand=off after LUN expansion"
72
73for i in 1 2 3; do
74 log_must zfs create -V $org_size $VFS/vol$i
75done
76block_device_wait
77
78for type in " " mirror raidz raidz2; do
79 log_must zpool create $TESTPOOL1 $type ${ZVOL_DEVDIR}/$VFS/vol1 \
80 ${ZVOL_DEVDIR}/$VFS/vol2 ${ZVOL_DEVDIR}/$VFS/vol3
81
82 typeset autoexp=$(get_pool_prop autoexpand $TESTPOOL1)
83 if [[ $autoexp != "off" ]]; then
84 log_fail "zpool $TESTPOOL1 autoexpand should off but is " \
85 "$autoexp"
86 fi
87
88 typeset prev_size=$(get_pool_prop size $TESTPOOL1)
89
90 for i in 1 2 3; do
91 log_must zfs set volsize=$exp_size $VFS/vol$i
92 done
93
94 sync
95 sleep 10
96 sync
97
98 # check for zpool history for the pool size expansion
99 zpool history -il $TESTPOOL1 | grep "pool '$TESTPOOL1' size:" | \
100 grep "vdev online" >/dev/null 2>&1
101
102 if [[ $? -eq 0 ]]; then
103 log_fail "pool $TESTPOOL1 is not autoexpand after LUN " \
104 "expansion"
105 fi
106
107 typeset expand_size=$(get_pool_prop size $TESTPOOL1)
108
109 if [[ "$prev_size" != "$expand_size" ]]; then
110 log_fail "pool $TESTPOOL1 size changed after LUN expansion"
111 fi
112
113 log_must zpool destroy $TESTPOOL1
114
115 for i in 1 2 3; do
116 log_must zfs set volsize=$org_size $VFS/vol$i
117 done
118
119done
120
121log_pass "zpool can not expand if set autoexpand=off after LUN expansion"