Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_010_pos.ksh =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_010_pos.ksh (revision 329033) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_010_pos.ksh (nonexistent) @@ -1,120 +0,0 @@ -#!/usr/local/bin/ksh93 -p -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "@(#)hotplug_010_pos.ksh 1.1 07/07/31 SMI" -# - -. $STF_SUITE/tests/hotplug/hotplug.kshlib - -################################################################################# -# -# __stc_assertion_start -# -# ID: hotplug_010_pos -# -# DESCRIPTION: -# Removing device offlined and reinsert onlined, verify device status is -# 'ONLINE'. -# -# STRATEGY: -# 1. Create mirror/raidz/raidz2 pool w/a hot spare device. -# 2. Synchronise with device in the background. -# 3. Set or unset autoreplace -# 4. Unmount all filesystems and disable syseventd and fmd. -# 5. Unload ZFS module and remove a device. -# 6. Load ZFS module and insert the device again. -# 7. Verify device's status is 'ONLINE'. No FMA fault is generated. -# -# TESTABILITY: explicit -# -# TEST_AUTOMATION_LEVEL: automated -# -# CODING_STATUS: COMPLETED (2007-06-01) -# -# __stc_assertion_end -# -################################################################################ - -verify_runnable "global" - -fstype=$(get_fstype '/') -if [[ $fstype == 'zfs' ]]; then - log_unsupported "This test cases is not supported on ZFS root system." -fi - -function cleanup -{ - typeset fmri - for fmri in 'sysevent' 'fmd'; do - typeset stat=$($SVCS -H -o STATE $fmri) - if [[ $stat != 'online' ]]; then - log_must $SVCADM enable $fmri - fi - $SLEEP 5 - done - - cleanup_testenv $TESTPOOL -} - -log_assert "Removing device offlined and reinserting onlined, " \ - "verify the device status ONLINE." -log_onexit cleanup - -for type in "mirror" "raidz" "raidz2"; do - setup_testenv $TESTPOOL $type - typeset val=$(random_get 'off' 'on') - log_must $ZPOOL set autoreplace=$val $TESTPOOL - - # - # Piror to unmount, stop background writing to avoid mount failed - # due to mountpoint is not empty - # - log_must kill_bg_write - - # - # unloading ZFS module to simulate system powered off - # - log_must unload_zfs - - typeset file=$(random_get $DEV_FILES) - typeset device=$(convert_lofi $file) - log_must remove_device $device - - # Reload ZFS module and check device status - log_must load_zfs - - # After mount, restart background writing process - log_must start_bg_write $TESTPOOL - - log_must insert_device $file $device - log_must verify_device_status $TESTPOOL $device 'ONLINE' - log_must fma_faulty 'FALSE' - - cleanup_testenv $TESTPOOL -done - -log_pass "Removing device offlined and reinserting onlined, " \ - "verify thhe device status ONLINE." Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_003_pos.ksh =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_003_pos.ksh (revision 329033) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_003_pos.ksh (nonexistent) @@ -1,107 +0,0 @@ -#!/usr/local/bin/ksh93 -p -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "@(#)hotplug_003_pos.ksh 1.2 08/02/27 SMI" -# - -. $STF_SUITE/tests/hotplug/hotplug.kshlib - -################################################################################# -# -# __stc_assertion_start -# -# ID: hotplug_003_pos -# -# DESCRIPTION: -# Set/Unset autoreplace, remove device from redundant pool and insert new -# device, this new device state will be indicated as 'ONLINE/UNAVAIL'. -# No FMA faulty message. -# -# STRATEGY: -# 1. Create mirror/raidz/raidz2 pool. -# 2. Synchronise with device in the background. -# 3. Set autoreplace=on -# 4. Remove device from pool and insert a new device. -# 5. Verify the new devices status is 'ONLINE'. -# 6. Verify that no FMA faults have been generated. -# 7. Set autoreplace=off, redo steps 4 - 6, verify the new device's -# status is 'UNAVAIL'. There are FMA faulty. -# -# TESTABILITY: explicit -# -# TEST_AUTOMATION_LEVEL: automated -# -# CODING_STATUS: COMPLETED (2007-06-01) -# -# __stc_assertion_end -# -################################################################################ - -verify_runnable "global" - -function cleanup -{ - cleanup_testenv $TESTPOOL - log_must destroy_lofi_device $NEWFILE -} - -log_assert "Having removed a device from a redundant pool and inserted a new " \ - "device, the new device state will be 'ONLINE' when autoreplace is on,"\ - "and 'UNAVAIL' when autoreplace is off" -log_onexit cleanup - -for type in "mirror" "raidz" "raidz2"; do - for tab in "off UNAVAIL TRUE" "on ONLINE FALSE"; do - typeset val=$($ECHO $tab | $AWK '{print $1}') - typeset status=$($ECHO $tab | $AWK '{print $2}') - typeset expect=$($ECHO $tab | $AWK '{print $3}') - - log_note "Start $type autoreplace($val) + expect_stat($status)" - setup_testenv $TESTPOOL $type - - log_must $ZPOOL set autoreplace=$val $TESTPOOL - - # Remove and insert new device $NEWFILE - typeset file=$(random_get $DEV_FILES) - typeset device=$(convert_lofi $file) - log_must remove_device $device - log_must $ZPOOL clear $TESTPOOL - - # Recreate again to avoid dirty data on device - log_must create_file 100M $NEWFILE - log_must insert_device $NEWFILE $device - - log_must verify_device_status $TESTPOOL $device $status - log_must fma_faulty $expect - - cleanup_testenv $TESTPOOL - log_must remove_device $NEWFILE - done -done - -log_pass "Having removed a device from a redundant pool and inserted a new " \ - "device, the new device state will be 'ONLINE' when autoreplace is on,"\ - "and 'UNAVAIL' when autoreplace is off" Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_002_pos.ksh =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_002_pos.ksh (revision 329033) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_002_pos.ksh (nonexistent) @@ -1,92 +0,0 @@ -#!/usr/local/bin/ksh93 -p -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "@(#)hotplug_002_pos.ksh 1.2 08/02/27 SMI" -# - -. $STF_SUITE/tests/hotplug/hotplug.kshlib - -################################################################################# -# -# __stc_assertion_start -# -# ID: hotplug_002_pos -# -# DESCRIPTION: -# When removing a device from a redundant pool, then reinserting it -# again, this device's state will be indicated as 'ONLINE' regardless of -# autoreplace was set or unset. No FMA faulty message. -# -# STRATEGY: -# 1. Create mirror/raidz/raidz2 pool. -# 2. Synchronise with device in the background. -# 3. Set autoreplace is on or off -# 4. Remove device from pool and reinsert again. -# 5. Detect removed devices status is 'ONLINE'. -# 6. Detect no FMA faulty message. -# -# TESTABILITY: explicit -# -# TEST_AUTOMATION_LEVEL: automated -# -# CODING_STATUS: COMPLETED (2007-06-01) -# -# __stc_assertion_end -# -################################################################################ - -verify_runnable "global" - -function cleanup -{ - cleanup_testenv $TESTPOOL -} - -log_assert "When removing and reinserting a device, the device status is " \ - "ONLINE with no FMA errors." -log_onexit cleanup - -for type in "mirror" "raidz" "raidz2"; do - setup_testenv $TESTPOOL $type - - typeset val=$(random_get "on" "off") - log_note "Start $type + autoreplace=$val testing ..." - log_must $ZPOOL set autoreplace=$val $TESTPOOL - - typeset file=$(random_get $DEV_FILES) - typeset device=$(convert_lofi $file) - log_must remove_device $device - log_must $ZPOOL clear $TESTPOOL - log_must insert_device $file $device - - log_must verify_device_status $TESTPOOL $device 'ONLINE' - log_must fma_faulty 'FALSE' - - cleanup_testenv $TESTPOOL -done - -log_pass "When removing and reinserting a device, the device status is " \ - "ONLINE with no FMA errors." Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_005_pos.ksh =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_005_pos.ksh (revision 329033) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_005_pos.ksh (nonexistent) @@ -1,91 +0,0 @@ -#!/usr/local/bin/ksh93 -p -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "@(#)hotplug_005_pos.ksh 1.2 08/02/27 SMI" -# - -. $STF_SUITE/tests/hotplug/hotplug.kshlib - -################################################################################# -# -# __stc_assertion_start -# -# ID: hotplug_005_pos -# -# DESCRIPTION: -# Regarding of autoreplace, when removing offline device and reinserting -# again. This device's status is 'ONLINE' . No FMA fault was generated. -# -# STRATEGY: -# 1. Create mirror/raidz/raidz2 pool. -# 2. Synchronise with device in the background. -# 3. Offline one of device, remove it and reinsert again. -# 4. Verify device status is 'ONLINE'. -# 5. Verify no FMA faultwas generated. -# -# TESTABILITY: explicit -# -# TEST_AUTOMATION_LEVEL: automated -# -# CODING_STATUS: COMPLETED (2007-06-01) -# -# __stc_assertion_end -# -################################################################################ - -verify_runnable "global" - -function cleanup -{ - cleanup_testenv $TESTPOOL -} - -log_assert "Regarding of autoreplace, when removing offline device and " \ - "reinserting again. This device's status is 'ONLINE'. " \ - "No FMA fault was generated." -log_onexit cleanup - -for type in "mirror" "raidz" "raidz2"; do - setup_testenv $TESTPOOL $type - typeset val=$(random_get "on" "off") - log_must $ZPOOL set autoreplace=$val $TESTPOOL - - typeset file=$(random_get $DEV_FILES) - typeset device=$(convert_lofi $file) - log_must $ZPOOL offline $TESTPOOL $device - log_must remove_device $device - log_must $ZPOOL clear $TESTPOOL - log_must insert_device $file $device - - log_must verify_device_status $TESTPOOL $device 'ONLINE' - log_must fma_faulty 'FALSE' - - cleanup_testenv $TESTPOOL -done - -log_pass "Regarding of autoreplace, when removing offline device and " \ - "reinserting again. This device's status is 'ONLINE'. " \ - "No FMA fault was generated." Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_004_pos.ksh =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_004_pos.ksh (revision 329033) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_004_pos.ksh (nonexistent) @@ -1,92 +0,0 @@ -#!/usr/local/bin/ksh93 -p -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "@(#)hotplug_004_pos.ksh 1.2 08/02/27 SMI" -# - -. $STF_SUITE/tests/hotplug/hotplug.kshlib - -################################################################################# -# -# __stc_assertion_start -# -# ID: hotplug_004_pos -# -# DESCRIPTION: -# When device replacement fails, the original device's state will be -# 'UNAVAIL' and an FMA fault will be generated. -# -# STRATEGY: -# 1. Create mirror/raidz/raidz2 pool. -# 2. Synchronise with device in the background. -# 3. Create a small device which is smaller than the minimal ZFS device. -# 4. Replace one device with the small device. -# 5. Verify the device replacement failed -# 6. Verify that an FMA fault was generated -# -# TESTABILITY: explicit -# -# TEST_AUTOMATION_LEVEL: automated -# -# CODING_STATUS: COMPLETED (2007-06-01) -# -# __stc_assertion_end -# -################################################################################ - -verify_runnable "global" - -function cleanup -{ - cleanup_testenv $TESTPOOL - log_must destroy_lofi_device $SMALLFILE -} - -log_assert "When device replacement fails, the original device's state will " \ - "be 'UNAVAIL' and an FMA fault will be generated." -log_onexit cleanup - -for type in "mirror" "raidz" "raidz2"; do - setup_testenv $TESTPOOL $type - - typeset file=$(random_get $DEV_FILES) - typeset device=$(convert_lofi $file) - log_must remove_device $device - log_must $ZPOOL clear $TESTPOOL - - # Recreate again to avoid dirty data on device. - log_must create_file 64M $SMALLFILE - log_must insert_device $SMALLFILE $device - - log_must verify_device_status $TESTPOOL $device 'UNAVAIL' - log_must fma_faulty 'TRUE' - - cleanup_testenv $TESTPOOL - log_must remove_device $SMALLFILE -done - -log_pass "When device replacement fails, the original device's state will be " \ - "'UNAVAIL' and an FMA fault will be generated." Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_006_pos.ksh =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_006_pos.ksh (revision 329033) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_006_pos.ksh (nonexistent) @@ -1,100 +0,0 @@ -#!/usr/local/bin/ksh93 -p -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "@(#)hotplug_006_pos.ksh 1.2 08/02/27 SMI" -# - -. $STF_SUITE/tests/hotplug/hotplug.kshlib - -################################################################################# -# -# __stc_assertion_start -# -# ID: hotplug_006_pos -# -# DESCRIPTION: -# When unsetting/setting autoreplace, then replacing offlined device, -# verify device's status is 'UNAVAIL/ONLINE'. No FMA fault is generated. -# -# STRATEGY: -# 1. Create mirror/raidz/raidz2 pool. -# 2. Unsetting/Setting autoreplace -# 3. Synchronise with device in the background. -# 4. Offline one of device, remove it and insert a new device. -# 5. Verify device status's is 'UNAVAIL/ONLINE' with/without FMA fault. -# -# TESTABILITY: explicit -# -# TEST_AUTOMATION_LEVEL: automated -# -# CODING_STATUS: COMPLETED (2007-06-01) -# -# __stc_assertion_end -# -################################################################################ - -verify_runnable "global" - -function cleanup -{ - cleanup_testenv $TESTPOOL - log_must destroy_lofi_device $NEWFILE -} - -log_assert "When unsetting/setting autoreplace, then replacing device, verify"\ - "the device's status is 'UNAVAIL/ONLINE'. No FMA fault is generated." -log_onexit cleanup - -for type in "mirror" "raidz" "raidz2"; do - for tab in "off UNAVAIL TRUE" "on ONLINE FALSE"; do - typeset val=$($ECHO $tab | $AWK '{print $1}') - typeset status=$($ECHO $tab | $AWK '{print $2}') - typeset expect=$($ECHO $tab | $AWK '{print $3}') - - log_note "Start $type autoreplace($val) + expect_stat($status)" - setup_testenv $TESTPOOL $type - log_must $ZPOOL set autoreplace=$val $TESTPOOL - - typeset file=$(random_get $DEV_FILES) - typeset device=$(convert_lofi $file) - log_must $ZPOOL offline $TESTPOOL $device - log_must remove_device $device - log_must $ZPOOL clear $TESTPOOL - - # Recreate NEWFILE to avoid dirty data on NEWFILE - log_must create_file 100M $NEWFILE - log_must insert_device $NEWFILE $device - - log_must verify_device_status $TESTPOOL $device $status - log_must fma_faulty $expect - - cleanup_testenv $TESTPOOL - log_must remove_device $NEWFILE - done -done - -log_pass "When unsetting/setting autoreplace, then replacing device, verify"\ - "the device's status is 'UNAVAIL/ONLINE'. No FMA fault is generated." Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_009_pos.ksh =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_009_pos.ksh (revision 329033) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_009_pos.ksh (nonexistent) @@ -1,130 +0,0 @@ -#!/usr/local/bin/ksh93 -p -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "@(#)hotplug_009_pos.ksh 1.1 07/07/31 SMI" -# - -. $STF_SUITE/tests/hotplug/hotplug.kshlib - -################################################################################# -# -# __stc_assertion_start -# -# ID: hotplug_009_pos -# -# DESCRIPTION: -# We unload ZFS module to simulate system is powered off. Replacing device -# and verify the device's status is 'ONLINE' when autoreplace is 'on', the -# status is 'OFFLINE' when autoreplace is 'off'. -# -# STRATEGY: -# 1. Create mirror/raidz/raidz2 pool with or without hot spare device. -# 2. Synchronise with device in the background. -# 3. Set autoreplace = off -# 4. Unmount all filesystems and disable syseventd and fmd. -# 5. Unload ZFS module and replace one of devices. -# 6. Load ZFS module and verify device status is 'UNAVAIL'. -# 7. Verify an FMA fault was generated. -# 8. Set autoreplace = on, redo steps 4 - 5. -# 9. Verify the device's status is 'ONLINE'. No FMA fault was generated. -# -# TESTABILITY: explicit -# -# TEST_AUTOMATION_LEVEL: automated -# -# CODING_STATUS: COMPLETED (2007-06-01) -# -# __stc_assertion_end -# -################################################################################ - -verify_runnable "global" - -fstype=$(get_fstype '/') -if [[ $fstype == 'zfs' ]]; then - log_unsupported "This test cases is not supported on ZFS root system." -fi - -function cleanup -{ - typeset fmri - for fmri in 'sysevent' 'fmd'; do - typeset stat=$($SVCS -H -o STATE $fmri) - if [[ $stat != 'online' ]]; then - log_must $SVCADM enable $fmri - fi - $SLEEP 5 - done - - cleanup_testenv $TESTPOOL - log_must destroy_lofi_device $NEWFILE -} - -log_assert "Power off machine and replacing device, verify device status is" \ - "ONLINE when autoreplace is on and UNAVAIL when autoreplace is off" -log_onexit cleanup - -for type in "mirror" "raidz" "raidz2"; do - for tab in "on ONLINE FALSE" "off UNAVAIL TRUE" ; do - typeset val=$($ECHO $tab | $AWK '{print $1}') - typeset status=$($ECHO $tab | $AWK '{print $2}') - typeset expect=$($ECHO $tab | $AWK '{print $3}') - - log_note "Start $type autoreplace($val) + expect_stat($status)" - setup_testenv $TESTPOOL $type - log_must $ZPOOL set autoreplace=$val $TESTPOOL - - # - # Piror to unmount, stop background writing to avoid mount failed - # due to mountpoint is not empty - # - log_must kill_bg_write - - # Unload zfs module to simulated system powered off - log_must unload_zfs - - # Remove one of devices and insert a new device - typeset file=$(random_get $DEV_FILES) - typeset device=$(convert_lofi $file) - log_must remove_device $device - log_must create_file 100M $NEWFILE - log_must insert_device $NEWFILE $device - - # Reload ZFS module and check device status - log_must load_zfs - - # After reloading zfs, restart background writing process - log_must start_bg_write $TESTPOOL - log_must verify_device_status $TESTPOOL $device $status - log_must fma_faulty $expect - - cleanup_testenv $TESTPOOL - log_must remove_device $NEWFILE - done -done - -log_pass "Power off machine and replacing device, verify device status is" \ - "ONLINE when autoreplace is on and UNAVAIL when autoreplace is off" Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/Makefile =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/Makefile (revision 329033) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/Makefile (revision 329034) @@ -1,26 +1,19 @@ # $FreeBSD$ .include PACKAGE=tests TESTSDIR=${TESTSBASE}/sys/cddl/zfs/tests/hotplug FILESDIR=${TESTSDIR} ATF_TESTS_KSH93+= hotplug_test -${PACKAGE}FILES+= hotplug.cfg -${PACKAGE}FILES+= hotplug_006_pos.ksh -${PACKAGE}FILES+= hotplug_002_pos.ksh ${PACKAGE}FILES+= cleanup.ksh -${PACKAGE}FILES+= hotplug_003_pos.ksh -${PACKAGE}FILES+= setup.ksh -${PACKAGE}FILES+= hotplug_005_pos.ksh -${PACKAGE}FILES+= hotplug_001_pos.ksh -${PACKAGE}FILES+= hotplug_009_pos.ksh -${PACKAGE}FILES+= hotplug_010_pos.ksh +${PACKAGE}FILES+= hotplug.cfg ${PACKAGE}FILES+= hotplug.kshlib -${PACKAGE}FILES+= hotplug_011_pos.ksh +${PACKAGE}FILES+= hotplug_001_pos.ksh ${PACKAGE}FILES+= hotplug_008_pos.ksh -${PACKAGE}FILES+= hotplug_004_pos.ksh +${PACKAGE}FILES+= hotplug_011_pos.ksh +${PACKAGE}FILES+= setup.ksh .include Index: projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_test.sh =================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_test.sh (revision 329033) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/hotplug/hotplug_test.sh (revision 329034) @@ -1,307 +1,109 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2012 Spectra Logic. All rights reserved. # Use is subject to license terms. # atf_test_case hotplug_001_pos cleanup hotplug_001_pos_head() { atf_set "descr" "When removing a device from a redundant pool, the device'sstate will be indicated as 'REMOVED'." atf_set "require.progs" zpool gnop } hotplug_001_pos_body() { . $(atf_get_srcdir)/../../include/default.cfg . $(atf_get_srcdir)/hotplug.kshlib . $(atf_get_srcdir)/hotplug.cfg verify_disk_count "$DISKS" 4 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/hotplug_001_pos.ksh || atf_fail "Testcase failed" } hotplug_001_pos_cleanup() { . $(atf_get_srcdir)/../../include/default.cfg . $(atf_get_srcdir)/hotplug.kshlib . $(atf_get_srcdir)/hotplug.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } - -atf_test_case hotplug_002_pos cleanup -hotplug_002_pos_head() -{ - atf_set "descr" "When removing and reinserting a device, the device status is ONLINE." - atf_set "require.progs" zpool gnop -} -hotplug_002_pos_body() -{ - . $(atf_get_srcdir)/../../include/default.cfg - . $(atf_get_srcdir)/hotplug.kshlib - . $(atf_get_srcdir)/hotplug.cfg - - atf_skip "redundant with zfsd_replace_001_pos" - verify_disk_count "$DISKS" 4 - ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" - ksh93 $(atf_get_srcdir)/hotplug_002_pos.ksh || atf_fail "Testcase failed" -} -hotplug_002_pos_cleanup() -{ - . $(atf_get_srcdir)/../../include/default.cfg - . $(atf_get_srcdir)/hotplug.kshlib - . $(atf_get_srcdir)/hotplug.cfg - - ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" -} - - -atf_test_case hotplug_003_pos cleanup -hotplug_003_pos_head() -{ - atf_set "descr" "Having removed a device from a redundant pool and inserted a newdevice, the new device state will be 'ONLINE' when autoreplace is on,\and 'UNAVAIL' when autoreplace is off" - atf_set "require.progs" zpool lofiadm - atf_set "timeout" 1800 -} -hotplug_003_pos_body() -{ - . $(atf_get_srcdir)/../../include/default.cfg - . $(atf_get_srcdir)/hotplug.kshlib - . $(atf_get_srcdir)/hotplug.cfg - - atf_skip "redundant with zfsd_autoreplace_00[12]*" - ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" - ksh93 $(atf_get_srcdir)/hotplug_003_pos.ksh || atf_fail "Testcase failed" -} -hotplug_003_pos_cleanup() -{ - . $(atf_get_srcdir)/../../include/default.cfg - . $(atf_get_srcdir)/hotplug.kshlib - . $(atf_get_srcdir)/hotplug.cfg - - ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" -} - - -atf_test_case hotplug_004_pos cleanup -hotplug_004_pos_head() -{ - atf_set "descr" "When device replacement fails, the original device's state willbe 'UNAVAIL' and an FMA fault will be generated." - atf_set "require.progs" zpool lofiadm - atf_set "timeout" 1800 -} -hotplug_004_pos_body() -{ - . $(atf_get_srcdir)/../../include/default.cfg - . $(atf_get_srcdir)/hotplug.kshlib - . $(atf_get_srcdir)/hotplug.cfg - - atf_skip "Does not apply to FreeBSD" - ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" - ksh93 $(atf_get_srcdir)/hotplug_004_pos.ksh || atf_fail "Testcase failed" -} -hotplug_004_pos_cleanup() -{ - . $(atf_get_srcdir)/../../include/default.cfg - . $(atf_get_srcdir)/hotplug.kshlib - . $(atf_get_srcdir)/hotplug.cfg - - ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" -} - - -atf_test_case hotplug_005_pos cleanup -hotplug_005_pos_head() -{ - atf_set "descr" "Regarding of autoreplace, when removing offline device andreinserting again. This device's status is 'ONLINE'. \No FMA fault was generated." - atf_set "require.progs" zpool lofiadm - atf_set "timeout" 1800 -} -hotplug_005_pos_body() -{ - . $(atf_get_srcdir)/../../include/default.cfg - . $(atf_get_srcdir)/hotplug.kshlib - . $(atf_get_srcdir)/hotplug.cfg - - atf_skip "TODO: move to the zfsd directory" - ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" - ksh93 $(atf_get_srcdir)/hotplug_005_pos.ksh || atf_fail "Testcase failed" -} -hotplug_005_pos_cleanup() -{ - . $(atf_get_srcdir)/../../include/default.cfg - . $(atf_get_srcdir)/hotplug.kshlib - . $(atf_get_srcdir)/hotplug.cfg - - ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" -} - - -atf_test_case hotplug_006_pos cleanup -hotplug_006_pos_head() -{ - atf_set "descr" "When unsetting/setting autoreplace, then replacing device, verifythe device's status is 'UNAVAIL/ONLINE'. No FMA fault is generated." - atf_set "require.progs" zpool lofiadm - atf_set "timeout" 1800 -} -hotplug_006_pos_body() -{ - . $(atf_get_srcdir)/../../include/default.cfg - . $(atf_get_srcdir)/hotplug.kshlib - . $(atf_get_srcdir)/hotplug.cfg - - atf_skip "redundant with hotplug_050_pos" - ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" - ksh93 $(atf_get_srcdir)/hotplug_006_pos.ksh || atf_fail "Testcase failed" -} -hotplug_006_pos_cleanup() -{ - . $(atf_get_srcdir)/../../include/default.cfg - . $(atf_get_srcdir)/hotplug.kshlib - . $(atf_get_srcdir)/hotplug.cfg - - ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" -} - - atf_test_case hotplug_008_pos cleanup hotplug_008_pos_head() { atf_set "descr" "When removing hotspare device, verify device status is 'REMOVED'." atf_set "require.progs" zpool gnop } hotplug_008_pos_body() { . $(atf_get_srcdir)/../../include/default.cfg . $(atf_get_srcdir)/hotplug.kshlib . $(atf_get_srcdir)/hotplug.cfg verify_disk_count "$DISKS" 4 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/hotplug_008_pos.ksh || atf_fail "Testcase failed" } hotplug_008_pos_cleanup() { . $(atf_get_srcdir)/../../include/default.cfg . $(atf_get_srcdir)/hotplug.kshlib . $(atf_get_srcdir)/hotplug.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } - -atf_test_case hotplug_009_pos cleanup -hotplug_009_pos_head() -{ - atf_set "descr" "Power off machine and replacing device, verify device status isONLINE when autoreplace is on and UNAVAIL when autoreplace is off" - atf_set "require.progs" zpool lofiadm svcadm svcs - atf_set "timeout" 1800 -} -hotplug_009_pos_body() -{ - . $(atf_get_srcdir)/../../include/default.cfg - . $(atf_get_srcdir)/hotplug.kshlib - . $(atf_get_srcdir)/hotplug.cfg - - atf_skip "redundant with zfsd_import_001_pos" - ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" - ksh93 $(atf_get_srcdir)/hotplug_009_pos.ksh || atf_fail "Testcase failed" -} -hotplug_009_pos_cleanup() -{ - . $(atf_get_srcdir)/../../include/default.cfg - . $(atf_get_srcdir)/hotplug.kshlib - . $(atf_get_srcdir)/hotplug.cfg - - ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" -} - - -atf_test_case hotplug_010_pos cleanup -hotplug_010_pos_head() -{ - atf_set "descr" "Removing device offlined and reinserting onlined,verify the device status ONLINE." - atf_set "require.progs" zpool lofiadm svcadm svcs - atf_set "timeout" 1800 -} -hotplug_010_pos_body() -{ - . $(atf_get_srcdir)/../../include/default.cfg - . $(atf_get_srcdir)/hotplug.kshlib - . $(atf_get_srcdir)/hotplug.cfg - - atf_skip "redundant with zfsd_replace_001_pos" - ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" - ksh93 $(atf_get_srcdir)/hotplug_010_pos.ksh || atf_fail "Testcase failed" -} -hotplug_010_pos_cleanup() -{ - . $(atf_get_srcdir)/../../include/default.cfg - . $(atf_get_srcdir)/hotplug.kshlib - . $(atf_get_srcdir)/hotplug.cfg - - ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" -} - - atf_test_case hotplug_011_pos cleanup hotplug_011_pos_head() { atf_set "descr" "Removing device offlined, verify device status is UNAVAIL,when the system is onlined." atf_set "require.progs" zpool gnop } hotplug_011_pos_body() { . $(atf_get_srcdir)/../../include/default.cfg . $(atf_get_srcdir)/hotplug.kshlib . $(atf_get_srcdir)/hotplug.cfg verify_disk_count "$DISKS" 4 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/hotplug_011_pos.ksh || atf_fail "Testcase failed" } hotplug_011_pos_cleanup() { . $(atf_get_srcdir)/../../include/default.cfg . $(atf_get_srcdir)/hotplug.kshlib . $(atf_get_srcdir)/hotplug.cfg ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" } atf_init_test_cases() { atf_add_test_case hotplug_001_pos - atf_add_test_case hotplug_002_pos - atf_add_test_case hotplug_003_pos - atf_add_test_case hotplug_004_pos - atf_add_test_case hotplug_005_pos - atf_add_test_case hotplug_006_pos atf_add_test_case hotplug_008_pos - atf_add_test_case hotplug_009_pos - atf_add_test_case hotplug_010_pos atf_add_test_case hotplug_011_pos }