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 # Setting a valid snapdir on a dataset, it should be successful.
39 # 1. Create pool, then create filesystem and volume within it.
40 # 2. Create a snapshot for each dataset.
41 # 3. Setting different valid snapdir to each dataset.
42 # 4. Check the return value and make sure it is 0.
43 # 5. Verify .zfs directory is hidden|visible according to the snapdir setting.
46 verify_runnable "both"
50 for dataset in $all_datasets; do
51 snapexists ${dataset}@snap && \
52 log_must zfs destroy ${dataset}@snap
56 function verify_snapdir_visible # $1 dataset, $2 hidden|visible
60 typeset mtpt=$(get_prop mountpoint $dataset)
63 for name in `ls -a $mtpt`; do
64 if [[ $name == ".zfs" ]]; then
65 if [[ $value == "visible" ]]; then
73 if [[ $value == "visible" ]]; then
83 if is_global_zone ; then
84 all_datasets="$TESTPOOL $TESTPOOL/$TESTFS $TESTPOOL/$TESTVOL"
86 all_datasets="$TESTPOOL $TESTPOOL/$TESTFS"
91 for dataset in $all_datasets; do
92 log_must zfs snapshot ${dataset}@snap
95 log_assert "Setting a valid snapdir property on a dataset succeeds."
97 for dataset in $all_datasets; do
98 for value in hidden visible; do
99 if [[ $dataset == "$TESTPOOL/$TESTVOL" ]] ; then
100 set_n_check_prop "$value" "snapdir" \
103 set_n_check_prop "$value" "snapdir" \
105 verify_snapdir_visible $dataset $value
107 log_fail "$dataset/.zfs is not $value as expect."
112 log_pass "Setting a valid snapdir property on a dataset succeeds."