d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# CDDL HEADER START
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# The contents of this file are subject to the terms of the
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# Common Development and Distribution License (the "License").
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# You may not use this file except in compliance with the License.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# or http://www.opensolaris.org/os/licensing.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# See the License for the specific language governing permissions
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# and limitations under the License.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# When distributing Covered Code, include this CDDL HEADER in each
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# If applicable, add the following below this CDDL HEADER, with the
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# fields enclosed by brackets "[]" replaced with your own identifying
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# information: Portions Copyright [yyyy] [name of copyright owner]
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# CDDL HEADER END
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# Use is subject to license terms.
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy. $STF_SUITE/tests/functional/cli_root/zpool_expand/zpool_expand.cfg
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# After zpool online -e poolname zvol vdevs, zpool can autoexpand by
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# Dynamic LUN Expansion
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# 1) Create a pool
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# 2) Create volume on top of the pool
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# 3) Create pool by using the zvols
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# 4) Expand the vol size by zfs set volsize
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# 5 Use zpool online -e to online the zvol vdevs
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# 6) Check that the pool size was expaned
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy for i in 1 2 3; do
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedylog_assert "zpool can expand after zpool online -e zvol vdevs on LUN expansion"
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy log_must zfs create -V $org_size $VFS/vol$i
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy log_must zpool create $TESTPOOL1 $type /dev/zvol/dsk/$VFS/vol1 \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy /dev/zvol/dsk/$VFS/vol2 /dev/zvol/dsk/$VFS/vol3
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy typeset autoexp=$(get_pool_prop autoexpand $TESTPOOL1)
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy log_fail "zpool $TESTPOOL1 autoexpand should off but is " \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy typeset prev_size=$(get_pool_prop size $TESTPOOL1)
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy typeset zfs_prev_size=$(zfs get -p avail $TESTPOOL1 | tail -1 | \
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy log_must zfs set volsize=$exp_size $VFS/vol$i
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy log_must zpool online -e $TESTPOOL1 /dev/zvol/dsk/$VFS/vol$i
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy typeset expand_size=$(get_pool_prop size $TESTPOOL1)
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy typeset zfs_expand_size=$(zfs get -p avail $TESTPOOL1 | tail -1 | \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy log_note "$TESTPOOL1 $type has previous size: $prev_size and " \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "expanded size: $expand_size"
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy # compare available pool size from zfs
4b5c8e93cab28d3c65ba9d407fd8f46e3be1db1cMatthew Ahrens if [[ $zfs_expand_size -gt $zfs_prev_size ]]; then
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy # check for zpool history for the pool size expansion
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy typeset size_addition=$(zpool history -il $TESTPOOL1 \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy log_fail "pool $TESTPOOL1 is not autoexpand " \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "after LUN expansion"
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy log_fail "pool $TESTPOOL1 is not autoexpand " \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "after LUN expansion"
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy log_fail "pool $TESTPOOL1 is not autoexpand " \
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy "after LUN expansion"
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy log_fail "pool $TESTPOOL1 is not autoexpanded after LUN " \
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy log_must zfs set volsize=$org_size $VFS/vol$i
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedylog_pass "zpool can expand after zpool online -e zvol vdevs on LUN expansion"