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 2007 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
28 .
$STF_SUITE/include
/libtest.shlib
29 .
$STF_SUITE/tests
/functional
/cli_root
/zfs_set
/zfs_set_common.kshlib
33 # Verify that read-only properties are immutable.
36 # 1. Create pool, fs, vol, fs@snap & vol@snap.
37 # 2. Get the original property value and set value to those properties.
38 # 3. Check return value.
39 # 4. Compare the current property value with the original one.
42 verify_runnable
"both"
44 set -A values filesystem volume snapshot
-3 0 1 50K
10G
80G \
45 2005/06/17 30K
20x
yes no \
46 on off default pool
/fs@snap
$TESTDIR
47 set -A dataset
$TESTPOOL $TESTPOOL/$TESTFS $TESTPOOL/$TESTVOL \
48 $TESTPOOL/$TESTCTR/$TESTFS1 $TESTPOOL/$TESTFS@
$TESTSNAP \
49 $TESTPOOL/$TESTVOL@
$TESTSNAP
50 typeset ro_props
="type used available avail creation referenced refer compressratio \
52 typeset snap_ro_props
="volsize recordsize recsize quota reservation reserv mountpoint \
53 sharenfs checksum compression compress atime devices exec readonly rdonly \
56 $ZFS upgrade
-v > /dev
/null
2>&1
57 if [[ $?
-eq 0 ]]; then
58 snap_ro_props
="$snap_ro_props version"
63 datasetexists
$TESTPOOL/$TESTVOL@
$TESTSNAP && \
64 destroy_snapshot
$TESTPOOL/$TESTVOL@
$TESTSNAP
65 datasetexists
$TESTPOOL/$TESTFS@
$TESTSNAP && \
66 destroy_snapshot
$TESTPOOL/$TESTFS@
$TESTSNAP
69 log_assert
"Verify that read-only properties are immutable."
72 # Create filesystem and volume's snapshot
73 create_snapshot
$TESTPOOL/$TESTFS $TESTSNAP
74 create_snapshot
$TESTPOOL/$TESTVOL $TESTSNAP
81 while (( i
< ${#dataset[@]} )); do
84 dst_type
=$
(get_prop
type ${dataset[i]})
85 if [[ $dst_type == 'snapshot' ]]; then
86 props
="$ro_props $snap_ro_props"
89 for prop
in $props; do
90 cur_value
=$
(get_prop
$prop ${dataset[i]})
93 while (( j
< ${#values[@]} )); do
95 # If the current property value is equal to values[j],
96 # just expect it failed. Otherwise, set it to dataset,
97 # expecting it failed and the property value is not
100 if [[ $cur_value == ${values[j]} ]]; then
101 log_mustnot
$ZFS set $prop=${values[j]} \
104 set_n_check_prop
${values[j]} $prop \
113 log_pass
"Setting uneditable properties should failed. It passed."