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