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 2019 Joyent, Inc. 25# 26 27. $STF_SUITE/include/libtest.shlib 28 29# 30# DESCRIPTION: 31# 32# zpool replace returns an error when spare device is faulted. 33# 34# STRATEGY: 35# 1. Add hot spare to pool 36# 2. Fault the hot spare device 37# 3. Attempt to replace a device in a pool with the faulted spare 38# 4. Verify the 'zpool replace' command fails 39# 40 41SPARE=${DISKS##* } 42DISK=${DISKS%% *} 43 44verify_runnable "global" 45log_must zpool add $TESTPOOL spare $SPARE 46log_assert "zpool replace returns an error when the hot spare is faulted" 47 48log_must zinject -d $SPARE -A fault $TESTPOOL 49log_mustnot zpool replace $TESTPOOL $DISK $SPARE 50 51log_pass "zpool replace returns an error when the hot spare is faulted" 52