12fae26bdSAlan Somers#!/usr/local/bin/ksh93 -p
22fae26bdSAlan Somers#
32fae26bdSAlan Somers# CDDL HEADER START
42fae26bdSAlan Somers#
52fae26bdSAlan Somers# The contents of this file are subject to the terms of the
62fae26bdSAlan Somers# Common Development and Distribution License (the "License").
72fae26bdSAlan Somers# You may not use this file except in compliance with the License.
82fae26bdSAlan Somers#
92fae26bdSAlan Somers# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
102fae26bdSAlan Somers# or http://www.opensolaris.org/os/licensing.
112fae26bdSAlan Somers# See the License for the specific language governing permissions
122fae26bdSAlan Somers# and limitations under the License.
132fae26bdSAlan Somers#
142fae26bdSAlan Somers# When distributing Covered Code, include this CDDL HEADER in each
152fae26bdSAlan Somers# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
162fae26bdSAlan Somers# If applicable, add the following below this CDDL HEADER, with the
172fae26bdSAlan Somers# fields enclosed by brackets "[]" replaced with your own identifying
182fae26bdSAlan Somers# information: Portions Copyright [yyyy] [name of copyright owner]
192fae26bdSAlan Somers#
202fae26bdSAlan Somers# CDDL HEADER END
212fae26bdSAlan Somers#
222fae26bdSAlan Somers
232fae26bdSAlan Somers#
242fae26bdSAlan Somers# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
252fae26bdSAlan Somers# Use is subject to license terms.
262fae26bdSAlan Somers
272fae26bdSAlan Somers. $STF_SUITE/tests/slog/slog.kshlib
282fae26bdSAlan Somers
292fae26bdSAlan Somers#################################################################################
302fae26bdSAlan Somers#
312fae26bdSAlan Somers# __stc_assertion_start
322fae26bdSAlan Somers#
332fae26bdSAlan Somers# ID: slog_010_neg
342fae26bdSAlan Somers#
352fae26bdSAlan Somers# DESCRIPTION:
362fae26bdSAlan Somers#	Slog device can not be replaced with spare device
372fae26bdSAlan Somers#
382fae26bdSAlan Somers# STRATEGY:
392fae26bdSAlan Somers#	1. Create a pool with hotspare and log devices.
402fae26bdSAlan Somers#	2. Verify slog device can not be replaced with hotspare device.
412fae26bdSAlan Somers#	3. Create pool2 with hotspare
422fae26bdSAlan Somers#	4. Verify slog device can not be replaced with hotspare device in pool2.
432fae26bdSAlan Somers#
442fae26bdSAlan Somers# TESTABILITY: explicit
452fae26bdSAlan Somers#
462fae26bdSAlan Somers# TEST_AUTOMATION_LEVEL: automated
472fae26bdSAlan Somers#
482fae26bdSAlan Somers# CODING_STATUS: COMPLETED (2007-06-20)
492fae26bdSAlan Somers#
502fae26bdSAlan Somers# __stc_assertion_end
512fae26bdSAlan Somers#
522fae26bdSAlan Somers################################################################################
532fae26bdSAlan Somers
542fae26bdSAlan Somersverify_runnable "global"
552fae26bdSAlan Somers
562fae26bdSAlan Somerslog_assert "Slog device can not be replaced with spare device."
572fae26bdSAlan Somerslog_onexit cleanup
582fae26bdSAlan Somers
592fae26bdSAlan Somerslog_must $ZPOOL create $TESTPOOL $VDEV spare $SDEV log $LDEV
602fae26bdSAlan Somerssdev=$(random_get $SDEV)
612fae26bdSAlan Somersldev=$(random_get $LDEV)
622fae26bdSAlan Somerslog_mustnot $ZPOOL replace $TESTPOOL $ldev $sdev
632fae26bdSAlan Somerslog_mustnot verify_slog_device $TESTPOOL $sdev 'ONLINE'
642fae26bdSAlan Somerslog_must verify_slog_device $TESTPOOL $ldev 'ONLINE'
652fae26bdSAlan Somers
662fae26bdSAlan Somerslog_must $ZPOOL create $TESTPOOL2 $VDEV2 spare $SDEV2
672fae26bdSAlan Somerssdev2=$(random_get $SDEV2)
682fae26bdSAlan Somerslog_mustnot $ZPOOL replace $TESTPOOL $ldev $sdev2
692fae26bdSAlan Somerslog_mustnot $ZPOOL replace -f $TESTPOOL $ldev $sdev2
702fae26bdSAlan Somerslog_mustnot verify_slog_device $TESTPOOL $sdev2 'ONLINE'
712fae26bdSAlan Somerslog_must verify_slog_device $TESTPOOL $ldev 'ONLINE'
722fae26bdSAlan Somers
732fae26bdSAlan Somerslog_pass "Slog device can not be replaced with spare device."
74