]>
Commit | Line | Data |
---|---|---|
80a91e74 TC |
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 (c) 2018 Datto Inc. | |
25 | # | |
26 | ||
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 | |
30 | ||
31 | # | |
32 | # DESCRIPTION: | |
33 | # "Verify 'zpool resilver' restarts in-progress resilvers" | |
34 | # | |
35 | # STRATEGY: | |
99b0b5bc | 36 | # 1. Write some data and detach the first drive so it has resilver |
80a91e74 TC |
37 | # work to do |
38 | # 2. Repeat the process with a second disk | |
39 | # 3. Reattach the drives, causing the second drive's resilver to be | |
40 | # deferred | |
41 | # 4. Manually restart the resilver with all drives | |
42 | # | |
80a91e74 TC |
43 | |
44 | verify_runnable "global" | |
45 | ||
46 | function cleanup | |
47 | { | |
cef48f14 | 48 | log_must set_tunable32 zfs_scan_suspend_progress 0 |
80a91e74 TC |
49 | log_must rm -f $mntpnt/biggerfile1 |
50 | log_must rm -f $mntpnt/biggerfile2 | |
51 | } | |
52 | ||
53 | log_onexit cleanup | |
54 | ||
55 | log_assert "Verify 'zpool resilver' restarts in-progress resilvers" | |
56 | ||
57 | mntpnt=$(get_prop mountpoint $TESTPOOL/$TESTFS) | |
58 | ||
99b0b5bc | 59 | # 1. Write some data and detach the first drive so it has resilver work to do |
80a91e74 TC |
60 | log_must file_write -b 524288 -c 1024 -o create -d 0 -f $mntpnt/biggerfile1 |
61 | log_must sync | |
62 | log_must zpool detach $TESTPOOL $DISK2 | |
63 | ||
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 | |
66 | log_must sync | |
67 | log_must zpool detach $TESTPOOL $DISK3 | |
68 | ||
69 | # 3. Reattach the drives, causing the second drive's resilver to be deferred | |
cef48f14 | 70 | log_must set_tunable32 zfs_scan_suspend_progress 1 |
80a91e74 TC |
71 | |
72 | log_must zpool attach $TESTPOOL $DISK1 $DISK2 | |
80a91e74 TC |
73 | log_must is_pool_resilvering $TESTPOOL true |
74 | ||
75 | log_must zpool attach $TESTPOOL $DISK1 $DISK3 | |
80a91e74 TC |
76 | log_must is_pool_resilvering $TESTPOOL true |
77 | ||
78 | # 4. Manually restart the resilver with all drives | |
79 | log_must zpool resilver $TESTPOOL | |
80a91e74 | 80 | log_must is_deferred_scan_started $TESTPOOL |
cef48f14 TC |
81 | log_must set_tunable32 zfs_scan_suspend_progress 0 |
82 | log_must wait_for_resilver_end $TESTPOOL $MAXTIMEOUT | |
80a91e74 TC |
83 | log_must check_state $TESTPOOL "$DISK2" "online" |
84 | log_must check_state $TESTPOOL "$DISK3" "online" | |
85 | ||
86 | log_pass "Verified 'zpool resilver' restarts in-progress resilvers" |