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 # Verify that a dataset could not be shared but filesystems are shared.
39 # 1. Create a dataset and file system
40 # 2. Set the sharenfs property on the dataset
41 # 3. Verify that the dataset is unable be shared.
42 # 4. Add a new file system to the dataset.
43 # 5. Verify that the newly added file system be shared.
46 verify_runnable
"global"
50 log_must zfs
set sharenfs
=off
$TESTPOOL/$TESTCTR
51 if mounted
$TESTDIR2; then
52 log_must zfs unmount
$TESTDIR2
55 datasetexists
$TESTPOOL/$TESTCTR/$TESTFS2 && \
56 log_must zfs destroy
$TESTPOOL/$TESTCTR/$TESTFS2
59 for fs
in $mntp $TESTDIR1 $TESTDIR2
61 log_must unshare_fs
$fs
68 # Given a mountpoint and a dataset, this routine will set the
69 # sharenfs property on the dataset and verify that dataset
70 # is unable to be shared but the existing contained file systems
73 function test_ctr_share
# mntp ctr
79 log_fail
"Mountpoint: $mntp is already shared."
81 log_must zfs
set sharenfs
=on
$ctr
84 log_fail
"File system $mntp is shared (set sharenfs)."
87 # Add a new file system to the dataset and verify it is shared.
89 typeset mntp2
=$TESTDIR2
90 log_must zfs create
$ctr/$TESTFS2
91 log_must zfs
set mountpoint
=$mntp2 $ctr/$TESTFS2
94 log_fail
"File system $mntp2 was not shared (set sharenfs)."
97 log_assert
"Verify that a dataset could not be shared, " \
98 "but its sub-filesystems could be shared."
101 typeset mntp
=$
(get_prop mountpoint
$TESTPOOL/$TESTCTR)
102 test_ctr_share
$mntp $TESTPOOL/$TESTCTR
104 log_pass
"A dataset could not be shared, " \
105 "but its sub-filesystems could be shared as expect."