1#!/usr/local/bin/ksh93 -p
2#
3# CDDL HEADER START
4#
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.
8#
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.
13#
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]
19#
20# CDDL HEADER END
21#
22
23#
24# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
25# Use is subject to license terms.
26#
27# ident	"@(#)zpool_create_019_pos.ksh	1.2	09/05/19 SMI"
28#
29
30. $STF_SUITE/include/libtest.kshlib
31. $STF_SUITE/tests/cli_root/zpool_create/zpool_create.kshlib
32
33################################################################################
34#
35# __stc_assertion_start
36#
37# ID: zpool_create_019_pos
38#
39# DESCRIPTION:
40#
41# zpool create cannot create pools specifying readonly properties
42#
43# STRATEGY:
44# 1. Attempt to create a pool, specifying each readonly property in turn
45# 2. Verify the pool was not created
46#
47# TESTABILITY: explicit
48#
49# TEST_AUTOMATION_LEVEL: automated
50#
51# CODING_STATUS: COMPLETED (2007-08-24)
52#
53# __stc_assertion_end
54#
55################################################################################
56
57function cleanup
58{
59	if poolexists $TESTPOOL ; then
60                destroy_pool $TESTPOOL
61        fi
62}
63
64log_onexit cleanup
65
66log_assert "zpool create cannot create pools specifying readonly properties"
67
68if [[ -n $DISK ]]; then
69	disk=$DISK
70else
71	disk=$DISK0
72fi
73
74set -A props "available" "capacity" "guid"  "health"  "size" "used"
75set -A vals  "100"       "10"       "12345" "HEALTHY" "10"   "10"
76
77typeset -i i=0;
78while [ $i -lt "${#props[@]}" ]
79do
80        # try to set each property in the prop list with it's corresponding val
81        log_mustnot $ZPOOL create -o ${props[$i]}=${vals[$i]} $TESTPOOL $disk
82	if poolexists $TESTPOOL
83	then
84		log_fail "$TESTPOOL was created when setting ${props[$i]}!"
85	fi
86        i=$(( $i + 1))
87done
88
89log_pass "zpool create cannot create pools specifying readonly properties"
90