9166 zfs storage pool checkpoint
[unleashed.git] / usr / src / test / zfs-tests / tests / functional / pool_checkpoint / checkpoint_removal.ksh
blob32b4c080ea7714d198426a967a17247a4e6f63b9
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 # Attempt to take a checkpoint while a removal is
23 # in progress. The attempt should fail.
25 # STRATEGY:
26 # 1. Create pool with one disk
27 # 2. Create a big file in the pool, so when the disk
28 # is later removed, it will give us enough of a
29 # time window to attempt the checkpoint while the
30 # removal takes place
31 # 3. Add a second disk where all the data will be moved
32 # to when the first disk will be removed.
33 # 4. Start removal of first disk
34 # 5. Attempt to checkpoint (attempt should fail)
37 verify_runnable "global"
39 function callback
41 log_mustnot zpool checkpoint $TESTPOOL
42 return 0
46 # Create pool
48 setup_test_pool
49 log_onexit cleanup_test_pool
50 populate_test_pool
53 # Create big empty file and do some writes at random
54 # offsets to ensure that it takes up space. Note that
55 # the implcitly created filesystem ($FS0) does not
56 # have compression enabled.
58 log_must mkfile $BIGFILESIZE $FS0FILE
59 log_must randwritecomp $FS0FILE 1000
62 # Add second disk
64 log_must zpool add $TESTPOOL $EXTRATESTDISK
67 # Remove disk and attempt to take checkpoint
69 log_must attempt_during_removal $TESTPOOL $TESTDISK callback
70 log_must zpool status $TESTPOOL
72 log_pass "Attempting to checkpoint during removal fails as expected."