1*e0f1c0afSOlaf Faaland#!/bin/ksh -p 2*e0f1c0afSOlaf Faaland# 3*e0f1c0afSOlaf Faaland# CDDL HEADER START 4*e0f1c0afSOlaf Faaland# 5*e0f1c0afSOlaf Faaland# This file and its contents are supplied under the terms of the 6*e0f1c0afSOlaf Faaland# Common Development and Distribution License ("CDDL"), version 1.0. 7*e0f1c0afSOlaf Faaland# You may only use this file in accordance with the terms of version 8*e0f1c0afSOlaf Faaland# 1.0 of the CDDL. 9*e0f1c0afSOlaf Faaland# 10*e0f1c0afSOlaf Faaland# A full copy of the text of the CDDL should have accompanied this 11*e0f1c0afSOlaf Faaland# source. A copy of the CDDL is also available via the Internet at 12*e0f1c0afSOlaf Faaland# http://www.illumos.org/license/CDDL. 13*e0f1c0afSOlaf Faaland# 14*e0f1c0afSOlaf Faaland# CDDL HEADER END 15*e0f1c0afSOlaf Faaland# 16*e0f1c0afSOlaf Faaland 17*e0f1c0afSOlaf Faaland# 18*e0f1c0afSOlaf Faaland# Copyright (c) 2017 by Lawrence Livermore National Security, LLC. 19*e0f1c0afSOlaf Faaland# Copyright 2019 Joyent, Inc. 20*e0f1c0afSOlaf Faaland# 21*e0f1c0afSOlaf Faaland 22*e0f1c0afSOlaf Faaland# DESCRIPTION: 23*e0f1c0afSOlaf Faaland# Verify import behavior for exported pool (no activity check) 24*e0f1c0afSOlaf Faaland# 25*e0f1c0afSOlaf Faaland# STRATEGY: 26*e0f1c0afSOlaf Faaland# 1. Create a zpool 27*e0f1c0afSOlaf Faaland# 2. Verify multihost=off and hostids match (no activity check) 28*e0f1c0afSOlaf Faaland# 3. Verify multihost=off and hostids differ (no activity check) 29*e0f1c0afSOlaf Faaland# 4. Verify multihost=off and hostid zero allowed (no activity check) 30*e0f1c0afSOlaf Faaland# 5. Verify multihost=on and hostids match (no activity check) 31*e0f1c0afSOlaf Faaland# 6. Verify multihost=on and hostids differ (no activity check) 32*e0f1c0afSOlaf Faaland# 7. Verify multihost=on and hostid zero fails (no activity check) 33*e0f1c0afSOlaf Faaland# 34*e0f1c0afSOlaf Faaland 35*e0f1c0afSOlaf Faaland. $STF_SUITE/include/libtest.shlib 36*e0f1c0afSOlaf Faaland. $STF_SUITE/tests/functional/mmp/mmp.cfg 37*e0f1c0afSOlaf Faaland. $STF_SUITE/tests/functional/mmp/mmp.kshlib 38*e0f1c0afSOlaf Faaland 39*e0f1c0afSOlaf Faalandverify_runnable "both" 40*e0f1c0afSOlaf Faaland 41*e0f1c0afSOlaf Faalandfunction cleanup 42*e0f1c0afSOlaf Faaland{ 43*e0f1c0afSOlaf Faaland default_cleanup_noexit 44*e0f1c0afSOlaf Faaland log_must mmp_clear_hostid 45*e0f1c0afSOlaf Faaland} 46*e0f1c0afSOlaf Faaland 47*e0f1c0afSOlaf Faalandlog_assert "multihost=on|off activity checks exported pool" 48*e0f1c0afSOlaf Faalandlog_onexit cleanup 49*e0f1c0afSOlaf Faaland 50*e0f1c0afSOlaf Faaland# 1. Create a zpool 51*e0f1c0afSOlaf Faalandlog_must mmp_set_hostid $HOSTID1 52*e0f1c0afSOlaf Faalanddefault_setup_noexit $DISK 53*e0f1c0afSOlaf Faaland 54*e0f1c0afSOlaf Faaland# 2. Verify multihost=off and hostids match (no activity check) 55*e0f1c0afSOlaf Faalandlog_must zpool set multihost=off $TESTPOOL 56*e0f1c0afSOlaf Faaland 57*e0f1c0afSOlaf Faalandfor opt in "" "-f"; do 58*e0f1c0afSOlaf Faaland log_must zpool export $TESTPOOL 59*e0f1c0afSOlaf Faaland log_must import_no_activity_check $TESTPOOL $opt 60*e0f1c0afSOlaf Faalanddone 61*e0f1c0afSOlaf Faaland 62*e0f1c0afSOlaf Faaland# 3. Verify multihost=off and hostids differ (no activity check) 63*e0f1c0afSOlaf Faalandfor opt in "" "-f"; do 64*e0f1c0afSOlaf Faaland log_must mmp_pool_set_hostid $TESTPOOL $HOSTID1 65*e0f1c0afSOlaf Faaland log_must zpool export $TESTPOOL 66*e0f1c0afSOlaf Faaland log_must mmp_clear_hostid 67*e0f1c0afSOlaf Faaland log_must mmp_set_hostid $HOSTID2 68*e0f1c0afSOlaf Faaland log_must import_no_activity_check $TESTPOOL $opt 69*e0f1c0afSOlaf Faalanddone 70*e0f1c0afSOlaf Faaland 71*e0f1c0afSOlaf Faaland# 4. Verify multihost=off and hostid zero allowed (no activity check) 72*e0f1c0afSOlaf Faalandlog_must mmp_clear_hostid 73*e0f1c0afSOlaf Faaland 74*e0f1c0afSOlaf Faalandfor opt in "" "-f"; do 75*e0f1c0afSOlaf Faaland log_must zpool export $TESTPOOL 76*e0f1c0afSOlaf Faaland log_must import_no_activity_check $TESTPOOL $opt 77*e0f1c0afSOlaf Faalanddone 78*e0f1c0afSOlaf Faaland 79*e0f1c0afSOlaf Faaland# 5. Verify multihost=on and hostids match (no activity check) 80*e0f1c0afSOlaf Faalandlog_must mmp_pool_set_hostid $TESTPOOL $HOSTID1 81*e0f1c0afSOlaf Faalandlog_must zpool set multihost=on $TESTPOOL 82*e0f1c0afSOlaf Faaland 83*e0f1c0afSOlaf Faalandfor opt in "" "-f"; do 84*e0f1c0afSOlaf Faaland log_must zpool export $TESTPOOL 85*e0f1c0afSOlaf Faaland log_must import_no_activity_check $TESTPOOL $opt 86*e0f1c0afSOlaf Faalanddone 87*e0f1c0afSOlaf Faaland 88*e0f1c0afSOlaf Faaland# 6. Verify multihost=on and hostids differ (no activity check) 89*e0f1c0afSOlaf Faalandfor opt in "" "-f"; do 90*e0f1c0afSOlaf Faaland log_must mmp_pool_set_hostid $TESTPOOL $HOSTID1 91*e0f1c0afSOlaf Faaland log_must zpool export $TESTPOOL 92*e0f1c0afSOlaf Faaland log_must mmp_clear_hostid 93*e0f1c0afSOlaf Faaland log_must mmp_set_hostid $HOSTID2 94*e0f1c0afSOlaf Faaland log_must import_no_activity_check $TESTPOOL $opt 95*e0f1c0afSOlaf Faalanddone 96*e0f1c0afSOlaf Faaland 97*e0f1c0afSOlaf Faaland# 7. Verify multihost=on and hostid zero fails (no activity check) 98*e0f1c0afSOlaf Faalandlog_must zpool export $TESTPOOL 99*e0f1c0afSOlaf Faalandlog_must mmp_clear_hostid 100*e0f1c0afSOlaf Faaland 101*e0f1c0afSOlaf Faalandfor opt in "" "-f"; do 102*e0f1c0afSOlaf Faaland case "$(uname)" in 103*e0f1c0afSOlaf Faaland Linux) MMP_IMPORTED_MSG="Set a unique system hostid";; 104*e0f1c0afSOlaf Faaland SunOS) MMP_IMPORTED_MSG="Check the SMF svc:/system/hostid service.";; 105*e0f1c0afSOlaf Faaland esac 106*e0f1c0afSOlaf Faaland log_must check_pool_import $TESTPOOL "" "action" "$MMP_IMPORTED_MSG" 107*e0f1c0afSOlaf Faaland log_mustnot import_no_activity_check $TESTPOOL $opt 108*e0f1c0afSOlaf Faalanddone 109*e0f1c0afSOlaf Faaland 110*e0f1c0afSOlaf Faalandlog_pass "multihost=on|off exported pool activity checks passed" 111