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 (c) 2018 Datto Inc.
27 .
$STF_SUITE/include
/libtest.shlib
28 .
$STF_SUITE/tests
/functional
/cli_root
/zpool_reopen
/zpool_reopen.shlib
29 .
$STF_SUITE/tests
/functional
/cli_root
/zpool_resilver
/zpool_resilver.cfg
33 # "Verify 'zpool resilver' restarts in-progress resilvers"
36 # 1. Write some data and detach the first drive so it has resilver
38 # 2. Repeat the process with a second disk
39 # 3. Reattach the drives, causing the second drive's resilver to be
41 # 4. Manually restart the resilver with all drives
44 verify_runnable
"global"
48 log_must set_tunable32 zfs_scan_suspend_progress
0
49 log_must
rm -f $mntpnt/biggerfile1
50 log_must
rm -f $mntpnt/biggerfile2
55 log_assert
"Verify 'zpool resilver' restarts in-progress resilvers"
57 mntpnt
=$
(get_prop mountpoint
$TESTPOOL/$TESTFS)
59 # 1. Write some data and detach the first drive so it has resilver work to do
60 log_must file_write
-b 524288 -c 1024 -o create
-d 0 -f $mntpnt/biggerfile1
62 log_must zpool detach
$TESTPOOL $DISK2
64 # 2. Repeat the process with a second disk
65 log_must file_write
-b 524288 -c 1024 -o create
-d 0 -f $mntpnt/biggerfile2
67 log_must zpool detach
$TESTPOOL $DISK3
69 # 3. Reattach the drives, causing the second drive's resilver to be deferred
70 log_must set_tunable32 zfs_scan_suspend_progress
1
72 log_must zpool attach
$TESTPOOL $DISK1 $DISK2
73 log_must is_pool_resilvering
$TESTPOOL true
75 log_must zpool attach
$TESTPOOL $DISK1 $DISK3
76 log_must is_pool_resilvering
$TESTPOOL true
78 # 4. Manually restart the resilver with all drives
79 log_must zpool resilver
$TESTPOOL
80 log_must is_deferred_scan_started
$TESTPOOL
81 log_must set_tunable32 zfs_scan_suspend_progress
0
82 log_must wait_for_resilver_end
$TESTPOOL $MAXTIMEOUT
83 log_must check_state
$TESTPOOL "$DISK2" "online"
84 log_must check_state
$TESTPOOL "$DISK3" "online"
86 log_pass
"Verified 'zpool resilver' restarts in-progress resilvers"