]>
git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_005_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.
29 # Copyright (c) 2012, 2016 by Delphix. All rights reserved.
32 .
$STF_SUITE/include
/libtest.shlib
33 .
$STF_SUITE/tests
/functional
/cli_root
/zpool_add
/zpool_add.kshlib
37 # 'zpool add' should return fail if
38 # 1. vdev is part of an active pool
39 # 2. vdev is currently mounted
40 # 3. vdev is in /etc/vfstab
41 # 3. vdev is specified as the dedicated dump device
44 # 1. Create case scenarios
45 # 2. For each scenario, try to add the device to the pool
46 # 3. Verify the add operation get failed
49 verify_runnable
"global"
53 poolexists
"$TESTPOOL" && \
54 destroy_pool
"$TESTPOOL"
55 poolexists
"$TESTPOOL1" && \
56 destroy_pool
"$TESTPOOL1"
58 if [[ -n $saved_dump_dev ]]; then
59 log_must
eval "dumpadm -u -d $saved_dump_dev > /dev/null"
65 log_assert
"'zpool add' should fail with inapplicable scenarios."
69 mnttab_dev
=$
(find_mnttab_dev
)
70 vfstab_dev
=$
(find_vfstab_dev
)
71 saved_dump_dev
=$
(save_dump_dev
)
72 dump_dev
=${disk}${SLICE_PREFIX}${SLICE3}
74 create_pool
"$TESTPOOL" "${disk}${SLICE_PREFIX}${SLICE0}"
75 log_must poolexists
"$TESTPOOL"
77 create_pool
"$TESTPOOL1" "${disk}${SLICE_PREFIX}${SLICE1}"
78 log_must poolexists
"$TESTPOOL1"
81 log_mustnot zpool add
-f "$TESTPOOL" ${disk}s
${SLICE1}
82 log_mustnot zpool add
-f "$TESTPOOL" $mnttab_dev
83 log_mustnot zpool add
-f "$TESTPOOL" $vfstab_dev
85 log_must
echo "y" | newfs
${DEV_DSKDIR}/$dump_dev > /dev
/null
2>&1
86 log_must dumpadm
-u -d ${DEV_DSKDIR}/$dump_dev > /dev
/null
87 log_mustnot zpool add
-f "$TESTPOOL" $dump_dev
89 log_pass
"'zpool add' should fail with inapplicable scenarios."