]>
Commit | Line | Data |
---|---|---|
2f71caf2 | 1 | #!/bin/ksh -p |
2 | # | |
3 | # CDDL HEADER START | |
4 | # | |
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. | |
8 | # | |
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. | |
13 | # | |
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] | |
19 | # | |
20 | # CDDL HEADER END | |
21 | # | |
22 | ||
23 | # | |
24 | # Copyright 2016, loli10K. All rights reserved. | |
25 | # | |
26 | ||
27 | . $STF_SUITE/include/libtest.shlib | |
28 | ||
29 | # | |
30 | # DESCRIPTION: | |
31 | # Verify that 'zfs unshare [nfs|smb] -a' unshares only filesystems shared by the | |
32 | # specified protocol. | |
33 | # | |
34 | # STRATEGY: | |
35 | # 1. Share filesystems with different protocols. | |
36 | # 2. Invoke 'zfs unshare nfs -a' to unshare filesystems. | |
37 | # 3. Verify that only nfs filesystems are unshared. | |
38 | # 4. Share all filesystems again. | |
39 | # 5. Invoke 'zfs unshare smb -a' and verify only smb filesystems are unshared. | |
40 | # | |
41 | ||
42 | verify_runnable "global" | |
43 | ||
95401cb6 BB |
44 | if is_linux; then |
45 | log_unsupported "some distros come with Samba "user shares" disabled" | |
46 | fi | |
47 | ||
2f71caf2 | 48 | function cleanup |
49 | { | |
c1d9abf9 JWK |
50 | log_must zfs unshare -a |
51 | log_must zfs destroy -f $TESTPOOL/$TESTFS/shared1 | |
52 | log_must zfs destroy -f $TESTPOOL/$TESTFS/shared2 | |
53 | log_must zfs destroy -f $TESTPOOL/$TESTFS/shared3 | |
2f71caf2 | 54 | } |
55 | ||
c1d9abf9 | 56 | log_assert "Verify 'zfs unshare [nfs|smb] -a' only works on the specified "\ |
2f71caf2 | 57 | "protocol." |
58 | log_onexit cleanup | |
59 | ||
60 | # 1. Share filesystems with different protocols. | |
c1d9abf9 JWK |
61 | log_must zfs create $TESTPOOL/$TESTFS/shared1 |
62 | log_must zfs create $TESTPOOL/$TESTFS/shared2 | |
63 | log_must zfs create $TESTPOOL/$TESTFS/shared3 | |
64 | log_must zfs set mountpoint=$TESTDIR/1 $TESTPOOL/$TESTFS/shared1 | |
65 | log_must zfs set mountpoint=$TESTDIR/2 $TESTPOOL/$TESTFS/shared2 | |
66 | log_must zfs set mountpoint=$TESTDIR/3 $TESTPOOL/$TESTFS/shared3 | |
67 | log_must zfs set sharenfs=on $TESTPOOL/$TESTFS/shared1 | |
68 | log_must zfs set sharenfs=on $TESTPOOL/$TESTFS/shared2 | |
69 | log_must zfs set sharesmb=on $TESTPOOL/$TESTFS/shared2 | |
70 | log_must zfs set sharesmb=on $TESTPOOL/$TESTFS/shared3 | |
71 | log_must zfs share -a | |
2f71caf2 | 72 | |
73 | # 2. Invoke 'zfs unshare nfs -a' to unshare filesystems. | |
c1d9abf9 | 74 | log_must zfs unshare nfs -a |
2f71caf2 | 75 | |
76 | # 3. Verify that only nfs filesystems are unshared. | |
77 | log_must eval "not_shared $TESTPOOL/$TESTFS/shared1" | |
78 | log_must eval "not_shared $TESTPOOL/$TESTFS/shared2" | |
79 | log_must eval "is_shared_smb $TESTPOOL/$TESTFS/shared2" | |
80 | log_must eval "is_shared_smb $TESTPOOL/$TESTFS/shared3" | |
81 | ||
82 | # 4. Share all filesystems again. | |
c1d9abf9 | 83 | log_must zfs share -a |
2f71caf2 | 84 | |
85 | # 5. Invoke 'zfs unshare smb -a' and verify only smb filesystems are unshared. | |
c1d9abf9 | 86 | log_must zfs unshare smb -a |
2f71caf2 | 87 | log_must eval "is_shared $TESTPOOL/$TESTFS/shared1" |
88 | log_must eval "is_shared $TESTPOOL/$TESTFS/shared2" | |
89 | log_must eval "not_shared_smb $TESTPOOL/$TESTFS/shared2" | |
90 | log_must eval "not_shared_smb $TESTPOOL/$TESTFS/shared3" | |
91 | ||
c1d9abf9 | 92 | log_pass "'zfs unshare [nfs|smb] -a' only works on the specified protocol." |