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.
29 # Copyright (c) 2016 by Delphix. All rights reserved.
32 . $STF_SUITE/tests/functional/cli_root/zfs_set/zfs_set_common.kshlib
36 # User defined property are always inherited from its parent dataset
40 # 1. Create pool, fs, volume, fsclone & volclone.
41 # 2. Get random user property name and set to the pool
42 # 3. Verify all dataset user property inherit from pool.
43 # 4. Set intermediate dataset and verify its children will inherit user
44 # property from it directly.
47 verify_runnable "both"
51 datasetexists $new_vol && log_must zfs rename $new_vol $vol
54 for dtst in $new_fsclone $new_volclone $fsclone $volclone \
56 if datasetexists $dtst; then
57 log_must zfs destroy -f $dtst
61 cleanup_user_prop $pool
65 # Verify options datasets (3-n) inherit from the inherited dataset $2.
68 # $2 inherited dataset
71 function inherit_check
74 typeset inherited_dtst=$2
76 [[ -z $@ ]] && return 1
78 typeset inherited_value=$(get_prop $prop $inherited_dtst)
80 typeset value=$(get_prop $prop $dtst)
81 typeset source=$(get_source $prop $dtst)
82 if [[ "$value" != "$inherited_value" || \
83 "$source" != "inherited from $inherited_dtst" ]]
94 log_assert "User defined property inherited from its parent."
97 pool=$TESTPOOL; fs=$pool/$TESTFS; vol=$pool/$TESTVOL
98 fssnap=$fs@snap; volsnap=$vol@snap;
99 log_must zfs snapshot $fssnap
100 log_must zfs snapshot $volsnap
101 fsclone=$pool/fsclone; volclone=$pool/volclone
102 log_must zfs clone $fssnap $fsclone
103 log_must zfs clone $volsnap $volclone
105 prop_name=$(valid_user_property 10)
106 value=$(user_property_value 16)
107 log_must eval "zfs set $prop_name='$value' $pool"
108 log_must eval "check_user_prop $pool $prop_name '$value'"
109 log_must inherit_check $prop_name $pool $fs $vol $fsclone $volclone
111 new_fsclone=$fs/fsclone; new_volclone=$fs/volclone
112 log_must zfs rename $fsclone $new_fsclone
113 log_must zfs rename $volclone $new_volclone
114 log_must inherit_check $prop_name $pool $fs $new_fsclone $new_volclone
116 log_note "Set intermediate dataset will change the inherited relationship."
117 new_value=$(user_property_value 16)
118 log_must eval "zfs set $prop_name='$new_value' $fs"
119 log_must eval "check_user_prop $fs $prop_name '$new_value'"
120 log_must inherit_check $prop_name $fs $new_fsclone $new_volclone
122 log_pass "User defined property inherited from its parent passed."