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/include
/libtest.shlib
36 # Invoking "zfs share <file system>" with a file system
37 # whose sharenfs property is 'off' , will fail with a
38 # return code of 1 and issue an error message.
41 # 1. Make sure that the ZFS file system is unshared.
42 # 2. Mount the file system using the various combinations
43 # - zfs set sharenfs=off <file system>
44 # - zfs set sharenfs=none <file system>
45 # 3. Verify that share failed with return code of 1.
48 verify_runnable
"both"
51 "$TESTDIR" "$TESTPOOL/$TESTFS" \
52 "$TESTDIR1" "$TESTPOOL/$TESTCTR/$TESTFS1"
57 while (( i
< ${#fs[*]} )); do
58 log_must zfs inherit
-r sharenfs
${fs[((i + 1))]}
59 log_must unshare_fs
${fs[i]}
69 # Given a mountpoint and file system this routine will attempt
70 # to share a legacy mountpoint and then verify the share fails as
73 function test_legacy_share
# mntp filesystem
79 log_fail
"File system $filesystem is already shared."
81 if is_global_zone
; then
82 log_must zfs
set sharenfs
=off
$filesystem
84 log_fail
"File system $filesystem is still shared (set sharenfs)."
90 log_fail
"'zfs share $filesystem' " \
91 "unexpected return code of $ret."
94 log_fail
"file system $filesystem is shared (zfs share)."
97 log_assert
"Verify that 'zfs share' with a file system " \
98 "whose sharenfs property is 'off' " \
99 "will fail with return code 1."
103 while (( i
< ${#fs[*]} )); do
104 test_legacy_share
${fs[i]} ${fs[((i + 1))]}
109 log_pass
"Verify that 'zfs share' with a file system " \
110 "whose sharenfs property is 'off' fails."