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 by Nutanix. All rights reserved. 16# 17 18. $STF_SUITE/include/libtest.shlib 19 20# 21# Description: 22# zdb -d will work on imported/exported pool with pool/dataset argument 23# 24# Strategy: 25# 1. Create a pool 26# 2. Run zdb -d with pool and dataset arguments. 27# 3. Export the pool 28# 4. Run zdb -ed with pool and dataset arguments. 29# 30 31function cleanup 32{ 33 datasetexists $TESTPOOL && destroy_pool $TESTPOOL 34 for DISK in $DISKS; do 35 zpool labelclear -f $DEV_RDSKDIR/$DISK 36 done 37} 38 39log_assert "Verify zdb -d works on imported/exported pool with pool/dataset argument" 40log_onexit cleanup 41 42verify_runnable "global" 43verify_disk_count "$DISKS" 2 44 45default_mirror_setup_noexit $DISKS 46log_must zfs snap $TESTPOOL/$TESTFS@snap 47 48log_must zdb -d $TESTPOOL 49log_must zdb -d $TESTPOOL/ 50log_must zdb -d $TESTPOOL/$TESTFS 51log_must zdb -d $TESTPOOL/$TESTFS@snap 52 53log_must zpool export $TESTPOOL 54 55log_must zdb -ed $TESTPOOL 56log_must zdb -ed $TESTPOOL/ 57log_must zdb -ed $TESTPOOL/$TESTFS 58log_must zdb -ed $TESTPOOL/$TESTFS@snap 59 60log_must zpool import $TESTPOOL 61 62cleanup 63 64log_pass "zdb -d works on imported/exported pool with pool/dataset argument" 65