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) 2014, 2018 by Delphix. All rights reserved. 19# 20 21. $STF_SUITE/include/libtest.shlib 22. $STF_SUITE/tests/functional/removal/removal.kshlib 23 24TMPDIR=${TMPDIR:-$TEST_BASE_DIR} 25 26DISK1="$TMPDIR/dsk1" 27DISK2="$TMPDIR/dsk2" 28DISK3="$TMPDIR/dsk3" 29DISK4="$TMPDIR/dsk4" 30DISKS="$DISK1 $DISK2 $DISK3 $DISK4" 31 32log_must mkfile $(($MINVDEVSIZE * 2)) $DISK1 33log_must mkfile $(($MINVDEVSIZE * 2)) $DISK2 34log_must mkfile $(($MINVDEVSIZE * 2)) $DISK3 35log_must mkfile $(($MINVDEVSIZE * 2)) $DISK4 36 37function cleanup 38{ 39 default_cleanup_noexit 40 log_must rm -f $DISKS 41} 42 43# Build a zpool with 2 mirror vdevs 44log_must default_setup_noexit "mirror $DISK1 $DISK2 mirror $DISK3 $DISK4" 45log_onexit cleanup 46 47# Remove one of the mirrors 48log_must zpool remove $TESTPOOL mirror-1 49log_must wait_for_removal $TESTPOOL 50 51# Attempt to add a single-device vdev, shouldn't work 52log_mustnot zpool add $TESTPOOL $DISK3 53 54# Force it, should work 55log_must zpool add -f $TESTPOOL $DISK3 56 57log_pass "Prevented from adding a non-mirror vdev on a mirrored zpool w/ indirect vdevs" 58