]> git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/removal/removal_with_zdb.ksh
OpenZFS 9166 - zfs storage pool checkpoint
[mirror_zfs.git] / tests / zfs-tests / tests / functional / removal / removal_with_zdb.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) 2014, 2017 by Delphix. All rights reserved.
19 #
20
21 . $STF_SUITE/include/libtest.shlib
22 . $STF_SUITE/tests/functional/removal/removal.kshlib
23
24 zdbout=${TMPDIR:-$TEST_BASE_DIR}/zdbout.$$
25
26 if is_linux; then
27 log_unsupported "ZDB fails during concurrent pool activity."
28 fi
29
30 function cleanup
31 {
32 default_cleanup_noexit
33 log_must rm -f $zdbout
34 }
35
36 default_setup_noexit "$DISKS"
37 log_onexit cleanup
38 FIRSTDISK=${DISKS%% *}
39
40 DISKPATH=/dev
41 case $FIRSTDISK in
42 /*)
43 DISKPATH=$(dirname $FIRSTDISK)
44 ;;
45 esac
46
47 function callback
48 {
49 typeset count=$1
50 typeset zdbstat
51
52 log_must zpool set cachefile=none $TESTPOOL
53 zdb -e -p $DISKPATH -cudi $TESTPOOL >$zdbout 2>&1
54 zdbstat=$?
55 log_must zpool set cachefile= $TESTPOOL
56 if [[ $zdbstat != 0 ]]; then
57 log_note "Output: zdb -e -p $DISKPATH -cudi $TESTPOOL"
58 cat $zdbout
59 log_note "zdb detected errors with exist status $zdbstat."
60 fi
61 log_note "zdb -e -p $DISKPATH -cudi $TESTPOOL >zdbout 2>&1"
62 return 0
63 }
64
65 test_removal_with_operation callback
66
67 log_must zpool set cachefile=none $TESTPOOL
68 zdb -e -p $DISKPATH -cudi $TESTPOOL >$zdbout 2>&1
69 zdbstat=$?
70 log_must zpool set cachefile= $TESTPOOL
71 if [[ $zdbstat != 0 ]]; then
72 log_note "Output following removal: zdb -cudi $TESTPOOL"
73 cat $zdbout
74 log_fail "zdb detected errors with exit status " \
75 "$zdbstat following removal."
76 fi
77
78 log_pass "Can use zdb during removal"