]> git.proxmox.com Git - mirror_zfs-debian.git/blob - tests/zfs-tests/tests/functional/mmp/mmp_reset_interval.ksh
e98b162183b58ed12e2a13b1a29300d6d5a7d2a0
[mirror_zfs-debian.git] / tests / zfs-tests / tests / functional / mmp / mmp_reset_interval.ksh
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 the MMP thread is notified when zfs_multihost_interval is
23 # reduced.
24 #
25 # STRATEGY:
26 # 1. Set zfs_multihost_interval to much longer than the test duration
27 # 2. Create a zpool and enable multihost
28 # 3. Verify no MMP writes occurred
29 # 4. Set zfs_multihost_interval to 1 second
30 # 5. Sleep briefly
31 # 6. Verify MMP writes began
32 #
33
34 . $STF_SUITE/include/libtest.shlib
35 . $STF_SUITE/tests/functional/mmp/mmp.cfg
36 . $STF_SUITE/tests/functional/mmp/mmp.kshlib
37
38 verify_runnable "both"
39
40 function cleanup
41 {
42 default_cleanup_noexit
43 log_must set_tunable64 zfs_multihost_interval $MMP_INTERVAL_DEFAULT
44 log_must mmp_clear_hostid
45 }
46
47 log_assert "mmp threads notified when zfs_multihost_interval reduced"
48 log_onexit cleanup
49
50 log_must set_tunable64 zfs_multihost_interval $MMP_INTERVAL_HOUR
51 log_must mmp_set_hostid $HOSTID1
52
53 default_setup_noexit $DISK
54 log_must zpool set multihost=on $TESTPOOL
55
56 clear_mmp_history
57 log_must set_tunable64 zfs_multihost_interval $MMP_INTERVAL_DEFAULT
58 uber_count=$(count_uberblocks $TESTPOOL 1)
59
60 if [ $uber_count -eq 0 ]; then
61 log_fail "mmp writes did not start when zfs_multihost_interval reduced"
62 fi
63
64 log_pass "mmp threads notified when zfs_multihost_interval reduced"