1#!/bin/ksh 2 3# 4# This file and its contents are supplied under the terms of the 5# Common Development and Distribution License ("CDDL"), version 1.0. 6# You may only use this file in accordance with the terms of version 7# 1.0 of the CDDL. 8# 9# A full copy of the text of the CDDL should have accompanied this 10# source. A copy of the CDDL is also available via the Internet at 11# http://www.illumos.org/license/CDDL. 12# 13 14# 15# Copyright (c) 2018 Lawrence Livermore National Security, LLC. 16# Copyright (c) 2018 by Nutanix. All rights reserved. 17# Copyright 2019 Joyent, Inc. 18# 19 20. $STF_SUITE/include/libtest.shlib 21. $STF_SUITE/tests/functional/mmp/mmp.cfg 22. $STF_SUITE/tests/functional/mmp/mmp.kshlib 23 24# 25# Description: 26# zdb will work while multihost is enabled. 27# 28# Strategy: 29# 1. Create a pool 30# 2. Enable multihost 31# 3. Run zdb -d with pool and dataset arguments. 32# 4. Create a checkpoint 33# 5. Run zdb -kd with pool and dataset arguments. 34# 6. Discard the checkpoint 35# 7. Export the pool 36# 8. Run zdb -ed with pool and dataset arguments. 37# 38 39function cleanup 40{ 41 datasetexists $TESTPOOL && destroy_pool $TESTPOOL 42 cleanup_devices $DISKS 43 log_must mmp_clear_hostid 44} 45 46log_assert "Verify zdb -d works while multihost is enabled" 47log_onexit cleanup 48 49verify_runnable "global" 50verify_disk_count "$DISKS" 2 51 52default_mirror_setup_noexit $DISKS 53log_must mmp_set_hostid $HOSTID1 54log_must zpool set multihost=on $TESTPOOL 55log_must zfs snap $TESTPOOL/$TESTFS@snap 56 57log_must zdb -d $TESTPOOL 58log_must zdb -d $TESTPOOL/ 59log_must zdb -d $TESTPOOL/$TESTFS 60log_must zdb -d $TESTPOOL/$TESTFS@snap 61 62log_must zpool checkpoint $TESTPOOL 63log_must zdb -kd $TESTPOOL 64log_must zdb -kd $TESTPOOL/ 65log_must zdb -kd $TESTPOOL/$TESTFS 66log_must zdb -kd $TESTPOOL/$TESTFS@snap 67log_must zpool checkpoint -d $TESTPOOL 68 69log_must zpool export $TESTPOOL 70 71log_must zdb -ed $TESTPOOL 72log_must zdb -ed $TESTPOOL/ 73log_must zdb -ed $TESTPOOL/$TESTFS 74log_must zdb -ed $TESTPOOL/$TESTFS@snap 75 76log_must zpool import $TESTPOOL 77 78cleanup 79 80log_pass "zdb -d works while multihost is enabled" 81