1#!/bin/ksh -p 2# 3# CDDL HEADER START 4# 5# This file and its contents are supplied under the terms of the 6# Common Development and Distribution License ("CDDL"), version 1.0. 7# You may only use this file in accordance with the terms of version 8# 1.0 of the CDDL. 9# 10# A full copy of the text of the CDDL should have accompanied this 11# source. A copy of the CDDL is also available via the Internet at 12# http://www.illumos.org/license/CDDL. 13# 14# CDDL HEADER END 15# 16 17# 18# Copyright (c) 2020, George Amanakis. All rights reserved. 19# Copyright (c) 2020 by Delphix. All rights reserved. 20# 21 22. $STF_SUITE/include/libtest.shlib 23. $STF_SUITE/tests/functional/removal/removal.kshlib 24 25# 26# DESCRIPTION: 27# 'zpool split' should succeed on pools with indirect vdevs. 28# 29# STRATEGY: 30# Create a mirrored pool, add a single device, remove it. `zpool split` 31# should succeed. 32# 33 34verify_runnable "global" 35 36log_assert "'zpool split' works on pools with indirect VDEVs." 37 38function cleanup 39{ 40 if poolexists $TESTPOOL ; then 41 destroy_pool $TESTPOOL 42 fi 43 if poolexists $TESTPOOL2 ; then 44 destroy_pool $TESTPOOL2 45 fi 46 rm -fd $VDEV_TEMP $VDEV_M1 $VDEV_M2 $altroot 47} 48log_onexit cleanup 49 50typeset vdev_m12_mb=400 51typeset vdev_temp_mb=$(( floor($vdev_m12_mb / 2) )) 52typeset VDEV_TEMP="$TEST_BASE_DIR/vdev_temp" 53typeset VDEV_M1="$TEST_BASE_DIR/vdev_m1" 54typeset VDEV_M2="$TEST_BASE_DIR/vdev_m2" 55typeset altroot="$TESTDIR/altroot-$TESTPOOL2" 56 57log_must truncate -s ${vdev_temp_mb}M $VDEV_TEMP 58log_must truncate -s ${vdev_m12_mb}M $VDEV_M1 59log_must truncate -s ${vdev_m12_mb}M $VDEV_M2 60 61log_must zpool create -f $TESTPOOL $VDEV_TEMP 62log_must zpool add -f $TESTPOOL mirror $VDEV_M1 $VDEV_M2 63log_must zpool remove $TESTPOOL $VDEV_TEMP 64log_must wait_for_removal $TESTPOOL 65log_must zpool split -R $altroot $TESTPOOL $TESTPOOL2 66log_must poolexists $TESTPOOL2 67log_must test "$(get_pool_prop 'altroot' $TESTPOOL2)" = "$altroot" 68 69log_pass "'zpool split' works on pools with indirect VDEVs." 70