]>
git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/cli_root/zpool_remove/zpool_remove_001_neg.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 2008 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
29 # Copyright (c) 2012 by Delphix. All rights reserved.
32 .
$STF_SUITE/include
/libtest.shlib
33 .
$STF_SUITE/tests
/functional
/cli_root
/zpool_remove
/zpool_remove.cfg
37 # Verify that 'zpool can not remove device except inactive hot spares from pool'
40 # 1. Create all kinds of pool (strip, mirror, raidz, hotspare)
41 # 2. Try to remove device from the pool
42 # 3. Verify that the remove failed.
46 typeset vdev_devs
="${disk}${SLICE_PREFIX}${SLICE0}"
47 typeset mirror_devs
="${disk}${SLICE_PREFIX}${SLICE0} ${disk}${SLICE_PREFIX}${SLICE1}"
48 typeset raidz_devs
=${mirror_devs}
49 typeset raidz1_devs
=${mirror_devs}
50 typeset raidz2_devs
="${mirror_devs} ${disk}${SLICE_PREFIX}${SLICE3}"
51 typeset spare_devs1
="${disk}${SLICE_PREFIX}${SLICE0}"
52 typeset spare_devs2
="${disk}${SLICE_PREFIX}${SLICE1}"
61 log_mustnot
$ZPOOL remove
$dev
70 if poolexists
$TESTPOOL; then
71 destroy_pool
$TESTPOOL
75 set -A create_args
"$vdev_devs" "mirror $mirror_devs" \
76 "raidz $raidz_devs" "raidz $raidz1_devs" \
77 "raidz2 $raidz2_devs" \
78 "$spare_devs1 spare $spare_devs2"
80 set -A verify_disks
"$vdev_devs" "$mirror_devs" "$raidz_devs" \
81 "$raidz1_devs" "$raidz2_devs" "$spare_devs1"
84 log_assert
"Check zpool remove <pool> <device> can not remove " \
85 "active device from pool"
90 while [[ $i -lt ${#create_args[*]} ]]; do
91 log_must
$ZPOOL create
$TESTPOOL ${create_args[i]}
92 check_remove
$TESTPOOL "${verify_disks[i]}"
96 log_pass
"'zpool remove <pool> <device> fail as expected .'"