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 2009 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 property has no effect to snapshot until 'Snapshot properties' supported.
39 # 1. Verify user properties could be transformed by 'zfs snapshot'
40 # 2. Verify user properties could be set upon snapshot.
43 verify_runnable "both"
47 for fs in $TESTPOOL/$TESTFS $TESTPOOL/$TESTVOL $TESTPOOL ; do
48 typeset fssnap=$fs@snap
49 if datasetexists $fssnap ; then
50 log_must zfs destroy -f $fssnap
53 cleanup_user_prop $TESTPOOL
56 function nonexist_user_prop
61 typeset source=$(get_source $user_prop $dtst)
62 typeset value=$(get_prop $user_prop $dtst)
63 if [[ $source == '-' && $value == '-' ]]; then
70 log_assert "User property has no effect to snapshot until 'Snapshot properties' supported."
73 typeset snap_property=
75 zpool upgrade -v | grep "Snapshot properties" > /dev/null 2>&1
76 if (( $? == 0 )) ; then
80 for fs in $TESTPOOL/$TESTFS $TESTPOOL/$TESTVOL $TESTPOOL ; do
81 typeset fssnap=$fs@snap
82 prop_name=$(valid_user_property 10)
83 value=$(user_property_value 16)
84 log_must eval "zfs set $prop_name='$value' $fs"
85 log_must eval "check_user_prop $fs $prop_name '$value'"
87 log_must zfs snapshot $fssnap
89 if [[ -n $snap_property ]] ; then
90 log_mustnot nonexist_user_prop $prop_name $fssnap
92 log_must eval "zfs set $prop_name='$value' $fssnap"
93 log_mustnot nonexist_user_prop $prop_name $fssnap
95 log_must nonexist_user_prop $prop_name $fssnap
96 log_mustnot eval "zfs set $prop_name='$value' $fssnap"
97 log_must nonexist_user_prop $prop_name $fssnap
101 log_pass "User properties has effect upon snapshot."