]>
Commit | Line | Data |
---|---|---|
b4555c77 | 1 | #!/bin/ksh -p |
2 | # | |
3 | # This file and its contents are supplied under the terms of the | |
4 | # Common Development and Distribution License ("CDDL"), version 1.0. | |
5 | # You may only use this file in accordance with the terms of version | |
6 | # 1.0 of the CDDL. | |
7 | # | |
8 | # A full copy of the text of the CDDL should have accompanied this | |
9 | # source. A copy of the CDDL is also available via the Internet at | |
10 | # http://www.illumos.org/license/CDDL. | |
11 | # | |
12 | ||
13 | # | |
14 | # Copyright 2018, loli10K <ezomori.nozomu@gmail.com>. All rights reserved. | |
15 | # | |
16 | ||
17 | . $STF_SUITE/include/libtest.shlib | |
18 | . $STF_SUITE/tests/functional/removal/removal.kshlib | |
19 | ||
20 | # | |
21 | # DESCRIPTION: | |
22 | # 'zfs remap' depends on 'feature@obsolete_counts' being active | |
23 | # | |
24 | # STRATEGY: | |
25 | # 1. Prepare a pool where a top-level VDEV has been removed and with | |
26 | # feature@obsolete_counts disabled | |
27 | # 2. Verify any 'zfs remap' command cannot be executed | |
28 | # 3. Verify the same commands complete successfully when | |
29 | # feature@obsolete_counts is enabled | |
30 | # | |
31 | ||
32 | verify_runnable "both" | |
33 | ||
34 | function cleanup | |
35 | { | |
36 | destroy_pool $TESTPOOL | |
37 | rm -f $DISK1 $DISK2 | |
38 | } | |
39 | ||
40 | log_assert "'zfs remap' depends on feature@obsolete_counts being active" | |
41 | log_onexit cleanup | |
42 | ||
43 | f="$TESTPOOL/fs" | |
44 | v="$TESTPOOL/vol" | |
45 | s="$TESTPOOL/fs@snap" | |
46 | c="$TESTPOOL/clone" | |
47 | ||
48 | DISK1="$TEST_BASE_DIR/zfs_remap-1" | |
49 | DISK2="$TEST_BASE_DIR/zfs_remap-2" | |
50 | ||
51 | # 1. Prepare a pool where a top-level VDEV has been removed with | |
52 | # feature@obsolete_counts disabled | |
53 | log_must truncate -s $(($MINVDEVSIZE * 2)) $DISK1 | |
54 | log_must zpool create -o feature@obsolete_counts=disabled $TESTPOOL $DISK1 | |
55 | log_must zfs create $f | |
56 | log_must zfs create -V 1M -s $v | |
57 | log_must zfs snap $s | |
58 | log_must zfs clone $s $c | |
59 | log_must truncate -s $(($MINVDEVSIZE * 2)) $DISK2 | |
60 | log_must zpool add $TESTPOOL $DISK2 | |
61 | log_must zpool remove $TESTPOOL $DISK1 | |
62 | log_must wait_for_removal $TESTPOOL | |
63 | ||
64 | # 2. Verify any 'zfs remap' command cannot be executed | |
65 | log_mustnot zfs remap $f | |
66 | log_mustnot zfs remap $v | |
67 | log_mustnot zfs remap $c | |
68 | ||
69 | # 3. Verify the same commands complete successfully when | |
70 | # feature@obsolete_counts is enabled | |
71 | log_must zpool set feature@obsolete_counts=enabled $TESTPOOL | |
72 | log_must zfs remap $f | |
73 | log_must zfs remap $v | |
74 | log_must zfs remap $c | |
75 | ||
76 | log_pass "'zfs remap' correctly depends on feature@obsolete_counts being active" |