]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tests/zfs-tests/tests/functional/mmp/mmp_on_zdb.ksh
Vendor import of openzfs master @ 184df27eef0abdc7ab2105b21257f753834b936b
[FreeBSD/FreeBSD.git] / tests / zfs-tests / tests / functional / mmp / mmp_on_zdb.ksh
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 #
18
19 . $STF_SUITE/include/libtest.shlib
20 . $STF_SUITE/tests/functional/mmp/mmp.cfg
21 . $STF_SUITE/tests/functional/mmp/mmp.kshlib
22
23 #
24 # Description:
25 # zdb will work while multihost is enabled.
26 #
27 # Strategy:
28 # 1. Create a pool
29 # 2. Enable multihost
30 # 3. Run zdb -d with pool and dataset arguments.
31 # 4. Create a checkpoint
32 # 5. Run zdb -kd with pool and dataset arguments.
33 # 6. Discard the checkpoint
34 # 7. Export the pool
35 # 8. Run zdb -ed with pool and dataset arguments.
36 #
37
38 function cleanup
39 {
40         datasetexists $TESTPOOL && destroy_pool $TESTPOOL
41         for DISK in $DISKS; do
42                 zpool labelclear -f $DEV_RDSKDIR/$DISK
43         done
44         log_must mmp_clear_hostid
45 }
46
47 log_assert "Verify zdb -d works while multihost is enabled"
48 log_onexit cleanup
49
50 verify_runnable "global"
51 verify_disk_count "$DISKS" 2
52
53 default_mirror_setup_noexit $DISKS
54 log_must mmp_set_hostid $HOSTID1
55 log_must zpool set multihost=on $TESTPOOL
56 log_must zfs snap $TESTPOOL/$TESTFS@snap
57
58 log_must zdb -d $TESTPOOL
59 log_must zdb -d $TESTPOOL/
60 log_must zdb -d $TESTPOOL/$TESTFS
61 log_must zdb -d $TESTPOOL/$TESTFS@snap
62
63 log_must zpool checkpoint $TESTPOOL
64 log_must zdb -kd $TESTPOOL
65 log_must zdb -kd $TESTPOOL/
66 log_must zdb -kd $TESTPOOL/$TESTFS
67 log_must zdb -kd $TESTPOOL/$TESTFS@snap
68 log_must zpool checkpoint -d $TESTPOOL
69
70 log_must zpool export $TESTPOOL
71
72 log_must zdb -ed $TESTPOOL
73 log_must zdb -ed $TESTPOOL/
74 log_must zdb -ed $TESTPOOL/$TESTFS
75 log_must zdb -ed $TESTPOOL/$TESTFS@snap
76
77 log_must zpool import $TESTPOOL
78
79 cleanup
80
81 log_pass "zdb -d works while multihost is enabled"