9166 zfs storage pool checkpoint
[unleashed.git] / usr / src / test / zfs-tests / tests / functional / pool_checkpoint / checkpoint_zhack_feat.ksh
blob43177d81a18e5de771074c963d49ddf59355f691
1 #!/usr/bin/ksh -p
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.
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.
15 # Copyright (c) 2017 by Delphix. All rights reserved.
18 . $STF_SUITE/tests/functional/pool_checkpoint/pool_checkpoint.kshlib
21 # DESCRIPTION:
22 # Ensure that we can rewind to a checkpointed state that was
23 # before a readonly-compatible feature was introduced.
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.
39 verify_runnable "global"
42 # Clear all labels from all vdevs so zhack
43 # doesn't get confused
45 for disk in ${DISKS[@]}; do
46 zpool labelclear -f $disk
47 done
49 setup_test_pool
50 log_onexit cleanup_test_pool
52 populate_test_pool
53 log_must zpool checkpoint $TESTPOOL
54 test_change_state_after_checkpoint
56 log_must zpool export $TESTPOOL
58 log_must zhack feature enable -r $TESTPOOL 'com.company:future_feature'
59 log_must zhack feature ref $TESTPOOL 'com.company:future_feature'
61 log_mustnot zpool import $TESTPOOL
62 log_must zpool import --rewind-to-checkpoint $TESTPOOL
64 test_verify_pre_checkpoint_state
66 log_pass "Rewind to checkpoint from unsupported pool feature."