1#!/usr/local/bin/ksh93 -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# Copyright 2012-2018 Spectra Logic Corporation. All rights reserved. 28# Use is subject to license terms. 29# 30# Portions taken from: 31# ident "@(#)replacement_001_pos.ksh 1.4 08/02/27 SMI" 32# 33# $FreeBSD$ 34 35. $STF_SUITE/include/libtest.kshlib 36. $STF_SUITE/include/libgnop.kshlib 37 38function is_pool_unavail # pool 39{ 40 is_pool_state "$1" "UNAVAIL" 41} 42 43log_assert "zfsd will reactivate a pool after all disks are failed and reappeared" 44 45log_unsupported "This feature has not yet been implemented in zfsd" 46 47ensure_zfsd_running 48set_disks 49typeset ALLDISKS="${DISK0} ${DISK1} ${DISK2}" 50typeset ALLNOPS=${ALLDISKS//~(E)([[:space:]]+|$)/.nop\1} 51 52log_must create_gnops $ALLDISKS 53for type in "raidz" "mirror"; do 54 # Create a pool on the supplied disks 55 create_pool $TESTPOOL $type $ALLNOPS 56 log_must $ZFS create $TESTPOOL/$TESTFS 57 log_must $ZFS set mountpoint=$TESTDIR $TESTPOOL/$TESTFS 58 59 # Disable all vdevs. The pool should become UNAVAIL 60 log_must destroy_gnop $DISK0 61 log_must destroy_gnop $DISK1 62 log_must destroy_gnop $DISK2 63 wait_for 5 1 is_pool_unavail $TESTPOOL 64 65 # Renable all vdevs. The pool should become healthy again 66 log_must create_gnop $DISK0 67 log_must create_gnop $DISK1 68 log_must create_gnop $DISK2 69 70 wait_for 5 1 is_pool_healthy $TESTPOOL 71 72 destroy_pool $TESTPOOL 73 log_must $RM -rf /$TESTPOOL 74done 75 76log_pass 77