1#!/usr/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 39verify_runnable "global" 40 41# 42# Clear all labels from all vdevs so zhack 43# doesn't get confused 44# 45for disk in ${DISKS[@]}; do 46 zpool labelclear -f $disk 47done 48 49setup_test_pool 50log_onexit cleanup_test_pool 51 52populate_test_pool 53log_must zpool checkpoint $TESTPOOL 54test_change_state_after_checkpoint 55 56log_must zpool export $TESTPOOL 57 58log_must zhack feature enable -r $TESTPOOL 'com.company:future_feature' 59log_must zhack feature ref $TESTPOOL 'com.company:future_feature' 60 61log_mustnot zpool import $TESTPOOL 62log_must zpool import --rewind-to-checkpoint $TESTPOOL 63 64test_verify_pre_checkpoint_state 65 66log_pass "Rewind to checkpoint from unsupported pool feature." 67