]>
Commit | Line | Data |
---|---|---|
379ca9cf OF |
1 | #!/bin/ksh -p |
2 | # | |
3 | # CDDL HEADER START | |
4 | # | |
5 | # This file and its contents are supplied under the terms of the | |
6 | # Common Development and Distribution License ("CDDL"), version 1.0. | |
7 | # You may only use this file in accordance with the terms of version | |
8 | # 1.0 of the CDDL. | |
9 | # | |
10 | # A full copy of the text of the CDDL should have accompanied this | |
11 | # source. A copy of the CDDL is also available via the Internet at | |
12 | # http://www.illumos.org/license/CDDL. | |
13 | # | |
14 | # CDDL HEADER END | |
15 | # | |
16 | ||
17 | # | |
18 | # Copyright (c) 2017 by Lawrence Livermore National Security, LLC. | |
19 | # | |
20 | ||
21 | # DESCRIPTION: | |
22 | # Ensure that MMP updates uberblocks at the expected intervals. | |
23 | # | |
24 | # STRATEGY: | |
25 | # 1. Set zfs_txg_timeout to large value | |
26 | # 2. Create a zpool | |
12acabe2 GDN |
27 | # 3. Clear multihost history |
28 | # 4. Sleep, then collect count of uberblocks written | |
379ca9cf OF |
29 | # 5. If number of changes seen is less than min threshold, then fail |
30 | # 6. If number of changes seen is more than max threshold, then fail | |
31 | # | |
32 | ||
33 | . $STF_SUITE/include/libtest.shlib | |
34 | . $STF_SUITE/tests/functional/mmp/mmp.cfg | |
35 | . $STF_SUITE/tests/functional/mmp/mmp.kshlib | |
36 | ||
37 | verify_runnable "both" | |
38 | ||
39 | UBER_CHANGES=0 | |
12acabe2 GDN |
40 | EXPECTED=$(($(echo $DISKS | wc -w) * 10)) |
41 | FUDGE=$((EXPECTED * 20 / 100)) | |
42 | MIN=$((EXPECTED - FUDGE)) | |
43 | MAX=$((EXPECTED + FUDGE)) | |
379ca9cf OF |
44 | |
45 | function cleanup | |
46 | { | |
47 | default_cleanup_noexit | |
48 | set_tunable64 zfs_txg_timeout $TXG_TIMEOUT_DEFAULT | |
379ca9cf OF |
49 | log_must mmp_clear_hostid |
50 | } | |
51 | ||
52 | log_assert "Ensure MMP uberblocks update at the correct interval" | |
53 | log_onexit cleanup | |
54 | ||
55 | log_must set_tunable64 zfs_txg_timeout $TXG_TIMEOUT_LONG | |
56 | log_must mmp_set_hostid $HOSTID1 | |
57 | ||
12acabe2 | 58 | default_setup_noexit "$DISKS" |
379ca9cf | 59 | log_must zpool set multihost=on $TESTPOOL |
12acabe2 | 60 | clear_mmp_history |
927f40d0 | 61 | UBER_CHANGES=$(count_mmp_writes $TESTPOOL 10) |
379ca9cf OF |
62 | |
63 | log_note "Uberblock changed $UBER_CHANGES times" | |
64 | ||
12acabe2 GDN |
65 | if [ $UBER_CHANGES -lt $MIN ]; then |
66 | log_fail "Fewer uberblock writes occured than expected ($EXPECTED)" | |
379ca9cf OF |
67 | fi |
68 | ||
12acabe2 GDN |
69 | if [ $UBER_CHANGES -gt $MAX ]; then |
70 | log_fail "More uberblock writes occured than expected ($EXPECTED)" | |
379ca9cf OF |
71 | fi |
72 | ||
73 | log_pass "Ensure MMP uberblocks update at the correct interval passed" |