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/include/libtest.shlib
36 # Verify canmount=noauto work fine when setting sharenfs or sharesmb.
39 # 1. Create a fs canmount=noauto.
40 # 2. Set sharenfs or sharesmb.
41 # 3. Verify the fs is umounted.
44 verify_runnable "global"
47 set -A sharenfs_prop "off" "on" "ro"
48 set -A sharesmb_prop "off" "on"
52 log_must zfs destroy -rR $CS_FS
55 function assert_unmounted
57 mnted=$(get_prop mounted $CS_FS)
58 if [[ "$mnted" == "yes" ]]; then
59 canmnt=$(get_prop canmount $CS_FS)
60 shnfs=$(get_prop sharenfs $CS_FS)
61 shsmb=$(get_prop sharesmb $CS_FS)
62 mntpt=$(get_prop mountpoint $CS_FS)
63 log_fail "$CS_FS should be unmounted" \
64 "[canmount=$canmnt,sharenfs=$shnfs,sharesmb=$shsmb,mountpoint=$mntpt]."
68 log_assert "Verify canmount=noauto work fine when setting sharenfs or sharesmb."
71 CS_FS=$TESTPOOL/$TESTFS/cs_fs.$$
72 oldmpt=$TESTDIR/old_cs_fs.$$
73 newmpt=$TESTDIR/new_cs_fs.$$
75 log_must zfs create -o canmount=noauto -o mountpoint=$oldmpt $CS_FS
78 for n in ${sharenfs_prop[@]}; do
79 log_must zfs set sharenfs="$n" $CS_FS
81 for s in ${sharesmb_prop[@]}; do
82 log_must zfs set sharesmb="$s" $CS_FS
85 mntpt=$(get_prop mountpoint $CS_FS)
86 if [[ "$mntpt" == "$oldmpt" ]]; then
87 log_must zfs set mountpoint="$newmpt" $CS_FS
89 log_must zfs set mountpoint="$oldmpt" $CS_FS
95 log_pass "Verify canmount=noauto work fine when setting sharenfs or sharesmb."