summaryrefslogtreecommitdiff
path: root/usr/src/test/zfs-tests/tests/functional/pool_checkpoint/checkpoint_removal.ksh
blob: 32b4c080ea7714d198426a967a17247a4e6f63b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/ksh -p

#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source.  A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#

#
# Copyright (c) 2017 by Delphix. All rights reserved.
#

. $STF_SUITE/tests/functional/pool_checkpoint/pool_checkpoint.kshlib

#
# DESCRIPTION:
#	Attempt to take a checkpoint while a removal is
#	in progress. The attempt should fail.
#
# STRATEGY:
#	1. Create pool with one disk
#	2. Create a big file in the pool, so when the disk
#	   is later removed, it will give us enough of a
#	   time window to attempt the checkpoint while the
#	   removal takes place
#	3. Add a second disk where all the data will be moved
#	   to when the first disk will be removed.
#	4. Start removal of first disk
#	5. Attempt to checkpoint (attempt should fail)
#

verify_runnable "global"

function callback
{
	log_mustnot zpool checkpoint $TESTPOOL
	return 0
}

#
# Create pool
#
setup_test_pool
log_onexit cleanup_test_pool
populate_test_pool

#
# Create big empty file and do some writes at random
# offsets to ensure that it takes up space. Note that
# the implcitly created filesystem ($FS0) does not
# have compression enabled.
#
log_must mkfile $BIGFILESIZE $FS0FILE
log_must randwritecomp $FS0FILE 1000

#
# Add second disk
#
log_must zpool add $TESTPOOL $EXTRATESTDISK

#
# Remove disk and attempt to take checkpoint
#
log_must attempt_during_removal $TESTPOOL $TESTDISK callback
log_must zpool status $TESTPOOL

log_pass "Attempting to checkpoint during removal fails as expected."