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
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.
18 # Copyright (c) 2017 by Lawrence Livermore National Security, LLC.
22 # Verify import behavior for inactive, but not exported, pools
26 # 2. Verify multihost=off and hostids match (no activity check)
27 # 3. Verify multihost=off and hostids differ (no activity check)
28 # 4. Verify multihost=off and hostid allowed (no activity check)
29 # 5. Verify multihost=on and hostids match (no activity check)
30 # 6. Verify multihost=on and hostids differ (activity check)
31 # 7. Verify mmp_write and mmp_fail are set correctly
32 # 8. Verify multihost=on and hostid zero fails (no activity check)
33 # 9. Verify activity check duration based on mmp_write and mmp_fail
36 .
$STF_SUITE/include
/libtest.shlib
37 .
$STF_SUITE/tests
/functional
/mmp
/mmp.cfg
38 .
$STF_SUITE/tests
/functional
/mmp
/mmp.kshlib
40 verify_runnable
"both"
44 default_cleanup_noexit
45 log_must mmp_clear_hostid
46 log_must set_tunable64 zfs_multihost_interval
$MMP_INTERVAL_DEFAULT
49 log_assert
"multihost=on|off inactive pool activity checks"
53 log_must mmp_set_hostid
$HOSTID1
54 default_setup_noexit
$DISK
56 # 2. Verify multihost=off and hostids match (no activity check)
57 log_must zpool
set multihost
=off
$TESTPOOL
59 for opt
in "" "-f"; do
60 log_must zpool
export -F $TESTPOOL
61 log_must import_no_activity_check
$TESTPOOL $opt
64 # 3. Verify multihost=off and hostids differ (no activity check)
65 log_must zpool
export -F $TESTPOOL
66 log_must mmp_clear_hostid
67 log_must mmp_set_hostid
$HOSTID2
68 log_mustnot import_no_activity_check
$TESTPOOL ""
69 log_must import_no_activity_check
$TESTPOOL "-f"
71 # 4. Verify multihost=off and hostid zero allowed (no activity check)
72 log_must zpool
export -F $TESTPOOL
73 log_must mmp_clear_hostid
74 log_mustnot import_no_activity_check
$TESTPOOL ""
75 log_must import_no_activity_check
$TESTPOOL "-f"
77 # 5. Verify multihost=on and hostids match (no activity check)
78 log_must mmp_pool_set_hostid
$TESTPOOL $HOSTID1
79 log_must zpool
set multihost
=on
$TESTPOOL
81 for opt
in "" "-f"; do
82 log_must zpool
export -F $TESTPOOL
83 log_must import_no_activity_check
$TESTPOOL $opt
86 # 6. Verify multihost=on and hostids differ (activity check)
87 log_must zpool
export -F $TESTPOOL
88 log_must mmp_clear_hostid
89 log_must mmp_set_hostid
$HOSTID2
90 log_mustnot import_activity_check
$TESTPOOL ""
91 log_must import_activity_check
$TESTPOOL "-f"
93 # 7. Verify mmp_write and mmp_fail are set correctly
94 log_must zpool
export -F $TESTPOOL
95 log_must verify_mmp_write_fail_present
${DISK[0]}
97 # 8. Verify multihost=on and hostid zero fails (no activity check)
98 log_must mmp_clear_hostid
99 MMP_IMPORTED_MSG
="Set a unique system hostid"
100 log_must check_pool_import
$TESTPOOL "-f" "action" "$MMP_IMPORTED_MSG"
101 log_mustnot import_no_activity_check
$TESTPOOL "-f"
103 # 9. Verify activity check duration based on mmp_write and mmp_fail
104 # Specify a short test via tunables but import pool imported while
105 # tunables set to default duration.
106 log_must set_tunable64 zfs_multihost_interval
$MMP_INTERVAL_MIN
107 log_must mmp_clear_hostid
108 log_must mmp_set_hostid
$HOSTID1
109 log_must import_activity_check
$TESTPOOL "-f" $MMP_TEST_DURATION_DEFAULT
111 log_pass
"multihost=on|off inactive pool activity checks passed"