]>
git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/cli_root/zpool_offline/zpool_offline_001_pos.ksh
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.
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.
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]
24 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
27 .
$STF_SUITE/include
/libtest.shlib
31 # Executing 'zpool offline' with valid parameters succeeds.
34 # 1. Create an array of correctly formed 'zpool offline' options
35 # 2. Execute each element of the array.
36 # 3. Verify use of each option is successful.
39 verify_runnable
"global"
41 DISKLIST
=$
(get_disklist
$TESTPOOL)
42 set -A disks
$DISKLIST
43 typeset
-i num
=${#disks[*]}
50 # Ensure we don't leave disks in the offline state
52 for disk
in $DISKLIST; do
53 log_must
$ZPOOL online
$TESTPOOL $disk
54 check_state
$TESTPOOL $disk "online"
55 if [[ $?
!= 0 ]]; then
56 log_fail
"Unable to online $disk"
62 log_assert
"Executing 'zpool offline' with correct options succeeds"
66 if [[ -z $DISKLIST ]]; then
67 log_fail
"DISKLIST is empty."
73 for disk
in $DISKLIST; do
75 while [[ $i -lt ${#args[*]} ]]; do
76 if (( j
< num
)) ; then
77 log_must
$ZPOOL offline
${args[$i]} $TESTPOOL $disk
78 check_state
$TESTPOOL $disk "offline"
79 if [[ $?
!= 0 ]]; then
80 log_fail
"$disk of $TESTPOOL did not match offline state"
83 log_mustnot
$ZPOOL offline
${args[$i]} $TESTPOOL $disk
84 check_state
$TESTPOOL $disk "online"
85 if [[ $?
!= 0 ]]; then
86 log_fail
"$disk of $TESTPOOL did not match online state"
95 log_note
"Issuing repeated 'zpool offline' commands succeeds."
100 for disk
in $DISKLIST; do
102 while [[ $i -lt $iters ]]; do
103 index
=`expr $RANDOM % ${#args[*]}`
104 log_must
$ZPOOL offline
${args[$index]} $TESTPOOL $disk
105 check_state
$TESTPOOL $disk "offline"
106 if [[ $?
!= 0 ]]; then
107 log_fail
"$disk of $TESTPOOL is not offline."
113 log_must
$ZPOOL online
$TESTPOOL $disk
114 check_state
$TESTPOOL $disk "online"
115 if [[ $?
!= 0 ]]; then
116 log_fail
"$disk of $TESTPOOL did not match online state"
120 log_pass
"'zpool offline' with correct options succeeded"