1#!/usr/bin/ksh -p 2# 3# CDDL HEADER START 4# 5# The contents of this file are subject to the terms of the 6# Common Development and Distribution License (the "License"). 7# You may not use this file except in compliance with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or http://www.opensolaris.org/os/licensing. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22 23# 24# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 25# Use is subject to license terms. 26# 27 28# 29# Copyright (c) 2013, 2016 by Delphix. All rights reserved. 30# 31 32. $STF_SUITE/include/libtest.shlib 33 34# 35# DESCRIPTION: 36# Offlining disks in a non-redundant pool should fail. 37# 38# STRATEGY: 39# 1. Create a multidisk stripe and start some random I/O 40# 2. zpool offline should fail on each disk. 41# 42 43verify_runnable "global" 44 45function cleanup 46{ 47 if poolexists $TESTPOOL1; then 48 destroy_pool $TESTPOOL1 49 fi 50 51 kill $killpid >/dev/null 2>&1 52 [[ -e $TESTDIR ]] && log_must rm -rf $TESTDIR/* 53} 54 55log_assert "Offlining disks in a non-redundant pool should fail." 56 57log_onexit cleanup 58 59specials_list="" 60for i in 0 1 2; do 61 mkfile $MINVDEVSIZE $TESTDIR/$TESTFILE1.$i 62 specials_list="$specials_list $TESTDIR/$TESTFILE1.$i" 63done 64disk=($specials_list) 65 66create_pool $TESTPOOL1 $specials_list 67log_must zfs create $TESTPOOL1/$TESTFS1 68log_must zfs set mountpoint=$TESTDIR1 $TESTPOOL1/$TESTFS1 69 70file_trunc -f $((64 * 1024 * 1024)) -b 8192 -c 0 -r $TESTDIR/$TESTFILE1 & 71typeset killpid="$! " 72 73for i in 0 1 2; do 74 log_mustnot zpool offline $TESTPOOL1 ${disk[$i]} 75 check_state $TESTPOOL1 ${disk[$i]} "online" 76done 77 78log_must kill $killpid 79sync 80 81log_pass 82