1 #!/usr/local/bin/ksh93 -p
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]
26 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
27 # Use is subject to license terms.
29 # ident "@(#)zpool_add_005_pos.ksh 1.4 09/06/22 SMI"
31 . $STF_SUITE/include/libtest.kshlib
32 . $STF_SUITE/tests/cli_root/zpool_add/zpool_add.kshlib
34 ################################################################################
36 # __stc_assertion_start
38 # ID: zpool_add_005_pos
41 # 'zpool add' should return fail if
42 # 1. vdev is part of an active pool
43 # 2. vdev is currently mounted
44 # 3. vdev is in /etc/vfstab
45 # 3. vdev is specified as the dedicated dump device
48 # 1. Create case scenarios
49 # 2. For each scenario, try to add the device to the pool
50 # 3. Verify the add operation get failed
52 # TESTABILITY: explicit
54 # TEST_AUTOMATION_LEVEL: automated
56 # CODING_STATUS: COMPLETED (2005-09-29)
60 ###############################################################################
62 verify_runnable "global"
68 poolexists "$TESTPOOL" && \
69 destroy_pool "$TESTPOOL"
70 poolexists "$TESTPOOL1" && \
71 destroy_pool "$TESTPOOL1"
76 log_assert "'zpool add' should fail with inapplicable scenarios."
80 mnttab_dev=$(find_mnttab_dev)
81 vfstab_dev=$(find_vfstab_dev)
84 create_pool "$TESTPOOL" "${DISK0}"
85 log_must poolexists "$TESTPOOL"
87 create_pool "$TESTPOOL1" "${DISK1}"
88 log_must poolexists "$TESTPOOL1"
89 log_mustnot $ZPOOL add -f "$TESTPOOL" ${DISK1}
91 log_mustnot $ZPOOL add -f "$TESTPOOL" $mnttab_dev
93 log_mustnot $ZPOOL add -f "$TESTPOOL" $vfstab_dev
95 log_must $DUMPON $dump_dev
96 log_mustnot $ZPOOL add -f "$TESTPOOL" $dump_dev
98 log_pass "'zpool add' should fail with inapplicable scenarios."