1*eda14cbcSMatt Macy#!/bin/ksh -p 2*eda14cbcSMatt Macy 3*eda14cbcSMatt Macy# 4*eda14cbcSMatt Macy# This file and its contents are supplied under the terms of the 5*eda14cbcSMatt Macy# Common Development and Distribution License ("CDDL"), version 1.0. 6*eda14cbcSMatt Macy# You may only use this file in accordance with the terms of version 7*eda14cbcSMatt Macy# 1.0 of the CDDL. 8*eda14cbcSMatt Macy# 9*eda14cbcSMatt Macy# A full copy of the text of the CDDL should have accompanied this 10*eda14cbcSMatt Macy# source. A copy of the CDDL is also available via the Internet at 11*eda14cbcSMatt Macy# http://www.illumos.org/license/CDDL. 12*eda14cbcSMatt Macy# 13*eda14cbcSMatt Macy 14*eda14cbcSMatt Macy# 15*eda14cbcSMatt Macy# Copyright (c) 2017 by Delphix. All rights reserved. 16*eda14cbcSMatt Macy# 17*eda14cbcSMatt Macy 18*eda14cbcSMatt Macy. $STF_SUITE/tests/functional/pool_checkpoint/pool_checkpoint.kshlib 19*eda14cbcSMatt Macy 20*eda14cbcSMatt Macy# 21*eda14cbcSMatt Macy# DESCRIPTION: 22*eda14cbcSMatt Macy# Attempt to take a checkpoint while a removal is 23*eda14cbcSMatt Macy# in progress. The attempt should fail. 24*eda14cbcSMatt Macy# 25*eda14cbcSMatt Macy# STRATEGY: 26*eda14cbcSMatt Macy# 1. Create pool with one disk 27*eda14cbcSMatt Macy# 2. Create a big file in the pool, so when the disk 28*eda14cbcSMatt Macy# is later removed, it will give us enough of a 29*eda14cbcSMatt Macy# time window to attempt the checkpoint while the 30*eda14cbcSMatt Macy# removal takes place 31*eda14cbcSMatt Macy# 3. Add a second disk where all the data will be moved 32*eda14cbcSMatt Macy# to when the first disk will be removed. 33*eda14cbcSMatt Macy# 4. Start removal of first disk 34*eda14cbcSMatt Macy# 5. Attempt to checkpoint (attempt should fail) 35*eda14cbcSMatt Macy# 36*eda14cbcSMatt Macy 37*eda14cbcSMatt Macyverify_runnable "global" 38*eda14cbcSMatt Macy 39*eda14cbcSMatt Macyfunction callback 40*eda14cbcSMatt Macy{ 41*eda14cbcSMatt Macy log_mustnot zpool checkpoint $TESTPOOL 42*eda14cbcSMatt Macy return 0 43*eda14cbcSMatt Macy} 44*eda14cbcSMatt Macy 45*eda14cbcSMatt Macy# 46*eda14cbcSMatt Macy# Create pool 47*eda14cbcSMatt Macy# 48*eda14cbcSMatt Macysetup_test_pool 49*eda14cbcSMatt Macylog_onexit cleanup_test_pool 50*eda14cbcSMatt Macypopulate_test_pool 51*eda14cbcSMatt Macy 52*eda14cbcSMatt Macy# 53*eda14cbcSMatt Macy# Create big empty file and do some writes at random 54*eda14cbcSMatt Macy# offsets to ensure that it takes up space. Note that 55*eda14cbcSMatt Macy# the implicitly created filesystem ($FS0) does not 56*eda14cbcSMatt Macy# have compression enabled. 57*eda14cbcSMatt Macy# 58*eda14cbcSMatt Macylog_must mkfile $BIGFILESIZE $FS0FILE 59*eda14cbcSMatt Macylog_must randwritecomp $FS0FILE 1000 60*eda14cbcSMatt Macy 61*eda14cbcSMatt Macy# 62*eda14cbcSMatt Macy# Add second disk 63*eda14cbcSMatt Macy# 64*eda14cbcSMatt Macylog_must zpool add $TESTPOOL $EXTRATESTDISK 65*eda14cbcSMatt Macy 66*eda14cbcSMatt Macy# 67*eda14cbcSMatt Macy# Remove disk and attempt to take checkpoint 68*eda14cbcSMatt Macy# 69*eda14cbcSMatt Macylog_must attempt_during_removal $TESTPOOL $TESTDISK callback 70*eda14cbcSMatt Macylog_must zpool status $TESTPOOL 71*eda14cbcSMatt Macy 72*eda14cbcSMatt Macylog_pass "Attempting to checkpoint during removal fails as expected." 73