]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_zhack_feat.ksh
Vendor import of openzfs master @ 184df27eef0abdc7ab2105b21257f753834b936b
[FreeBSD/FreeBSD.git] / tests / zfs-tests / tests / functional / pool_checkpoint / checkpoint_zhack_feat.ksh
1 #!/bin/ksh -p
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) 2017 by Delphix. All rights reserved.
16 #
17
18 . $STF_SUITE/tests/functional/pool_checkpoint/pool_checkpoint.kshlib
19
20 #
21 # DESCRIPTION:
22 #       Ensure that we can rewind to a checkpointed state that was
23 #       before a readonly-compatible feature was introduced.
24 #
25 # STRATEGY:
26 #       1. Create pool
27 #       2. Populate it
28 #       3. Take checkpoint
29 #       4. Modify data (include at least one destructive change) 
30 #       5. Export pool
31 #       6. Introduce a new feature in the pool which is unsupported
32 #          but readonly-compatible and increment its reference
33 #          number so it is marked active.
34 #       7. Verify that the pool can't be opened writeable, but we
35 #          can rewind to the checkpoint (before the feature was 
36 #          introduced) if we want to.
37 #
38
39 verify_runnable "global"
40
41 #
42 # Clear all labels from all vdevs so zhack
43 # doesn't get confused
44 #
45 for disk in ${DISKS[@]}; do
46         zpool labelclear -f $disk
47 done
48
49 setup_test_pool
50 log_onexit cleanup_test_pool
51
52 populate_test_pool
53 log_must zpool checkpoint $TESTPOOL
54 test_change_state_after_checkpoint
55
56 log_must zpool export $TESTPOOL
57
58 log_must zhack feature enable -r $TESTPOOL 'com.company:future_feature'
59 log_must zhack feature ref $TESTPOOL 'com.company:future_feature'
60
61 log_mustnot zpool import $TESTPOOL
62 log_must zpool import --rewind-to-checkpoint $TESTPOOL
63
64 test_verify_pre_checkpoint_state
65
66 log_pass "Rewind to checkpoint from unsupported pool feature."