3 # This file and its contents are supplied under the terms of the
4 # Common Development and Distribution License ("CDDL"), version 1.0.
5 # You may only use this file in accordance with the terms of version
8 # A full copy of the text of the CDDL should have accompanied this
9 # source. A copy of the CDDL is also available via the Internet at
10 # http://www.illumos.org/license/CDDL.
14 # Copyright (c) 2018 by Delphix. All rights reserved.
17 . $STF_SUITE/include/libtest.shlib
18 . $STF_SUITE/tests/functional/cli_root/zpool_wait/zpool_wait.kshlib
22 # 'zpool wait' works when a replacing disks.
25 # 1. Attach a disk to pool to form two-way mirror.
26 # 2. Start a replacement of the new disk.
27 # 3. Start 'zpool wait'.
28 # 4. Monitor the waiting process to make sure it returns neither too soon nor
30 # 5. Repeat 2-4, except using the '-w' flag with 'zpool replace' instead of
38 get_disklist $TESTPOOL | grep $DISK2 >/dev/null && \
39 log_must zpool detach $TESTPOOL $DISK2
40 get_disklist $TESTPOOL | grep $DISK3 >/dev/null && \
41 log_must zpool detach $TESTPOOL $DISK3
46 zpool status $TESTPOOL | grep 'replacing-' >/dev/null
53 log_must zpool attach -w $TESTPOOL $DISK1 $DISK2
55 add_io_delay $TESTPOOL
57 # Test 'zpool wait -t replace'
58 log_must zpool replace $TESTPOOL $DISK2 $DISK3
59 log_bkgrnd zpool wait -t replace $TESTPOOL
61 check_while_waiting $pid in_progress
63 # Test 'zpool replace -w'
64 log_bkgrnd zpool replace -w $TESTPOOL $DISK3 $DISK2
66 while ! is_pool_resilvering $TESTPOOL && proc_exists $pid; do
69 check_while_waiting $pid in_progress
71 log_pass "'zpool wait -t replace' and 'zpool replace -w' work."