Print this page
8115 parallel zfs mount
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/test/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount.kshlib
+++ new/usr/src/test/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount.kshlib
1 1 #
2 2 # CDDL HEADER START
3 3 #
4 4 # The contents of this file are subject to the terms of the
5 5 # Common Development and Distribution License (the "License").
6 6 # You may not use this file except in compliance with the License.
7 7 #
8 8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 # or http://www.opensolaris.org/os/licensing.
10 10 # See the License for the specific language governing permissions
11 11 # and limitations under the License.
12 12 #
13 13 # When distributing Covered Code, include this CDDL HEADER in each
14 14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 # If applicable, add the following below this CDDL HEADER, with the
16 16 # fields enclosed by brackets "[]" replaced with your own identifying
17 17 # information: Portions Copyright [yyyy] [name of copyright owner]
↓ open down ↓ |
17 lines elided |
↑ open up ↑ |
18 18 #
19 19 # CDDL HEADER END
20 20 #
21 21
22 22 #
23 23 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 24 # Use is subject to license terms.
25 25 #
26 26
27 27 #
28 -# Copyright (c) 2016 by Delphix. All rights reserved.
28 +# Copyright (c) 2017 by Delphix. All rights reserved.
29 29 #
30 30
31 31 . $STF_SUITE/include/libtest.shlib
32 32 . $STF_SUITE/tests/functional/cli_root/zfs_mount/zfs_mount.cfg
33 33
34 34 function force_unmount #dev
35 35 {
36 36 typeset dev=$1
37 37
38 38 ismounted $dev
39 39 if (( $? == 0 )); then
40 40 log_must zfs $unmountforce $dev
41 41 fi
42 42 return 0
43 43 }
44 44
45 45 # Create pool and ( fs | container | vol ) with the given parameters,
46 46 # it'll destroy prior exist one that has the same name.
47 47
48 48 function setup_filesystem #disklist #pool #fs #mntpoint #type #vdev
49 49 {
50 50 typeset disklist=$1
51 51 typeset pool=$2
52 52 typeset fs=${3##/}
53 53 typeset mntpoint=$4
54 54 typeset type=$5
55 55 typeset vdev=$6
56 56
57 57 if [[ -z $pool || -z $fs || -z $mntpoint ]]; then
58 58 log_note "Missing parameter: (\"$pool\", \"$fs\", \"$mntpoint\")"
59 59 return 1
60 60 fi
61 61
62 62 if is_global_zone && [[ -z $disklist ]] ; then
63 63 log_note "Missing disklist."
64 64 return 1
65 65 fi
66 66
67 67 if [[ $vdev != "" && \
68 68 $vdev != "mirror" && \
69 69 $vdev != "raidz" ]] ; then
70 70
71 71 log_note "Wrong vdev: (\"$vdev\")"
72 72 return 1
73 73 fi
74 74
75 75 poolexists $pool || \
76 76 create_pool $pool $vdev $disklist
↓ open down ↓ |
38 lines elided |
↑ open up ↑ |
77 77
78 78 datasetexists $pool/$fs && \
79 79 log_must cleanup_filesystem $pool $fs
80 80
81 81 rmdir $mntpoint > /dev/null 2>&1
82 82 if [[ ! -d $mntpoint ]]; then
83 83 log_must mkdir -p $mntpoint
84 84 fi
85 85
86 86 case "$type" in
87 - 'ctr') log_must zfs create $pool/$fs
88 - log_must zfs set mountpoint=$mntpoint $pool/$fs
87 + 'ctr') log_must zfs create -o mountpoint=$mntpoint $pool/$fs
89 88 ;;
90 89 'vol') log_must zfs create -V $VOLSIZE $pool/$fs
91 90 ;;
92 - *) log_must zfs create $pool/$fs
93 - log_must zfs set mountpoint=$mntpoint $pool/$fs
91 + *) log_must zfs create -o mountpoint=$mntpoint $pool/$fs
94 92 ;;
95 93 esac
96 94
97 95 return 0
98 96 }
99 97
100 98 # Destroy ( fs | container | vol ) with the given parameters.
101 99 function cleanup_filesystem #pool #fs
102 100 {
103 101 typeset pool=$1
104 102 typeset fs=${2##/}
105 103 typeset mtpt=""
106 104
107 105 if [[ -z $pool || -z $fs ]]; then
108 106 log_note "Missing parameter: (\"$pool\", \"$fs\")"
109 107 return 1
110 108 fi
111 109
112 110 if datasetexists "$pool/$fs" ; then
113 111 mtpt=$(get_prop mountpoint "$pool/$fs")
114 112 log_must zfs destroy -r $pool/$fs
115 113
116 114 [[ -d $mtpt ]] && \
117 115 log_must rm -rf $mtpt
118 116 else
119 117 return 1
120 118 fi
121 119
122 120 return 0
123 121 }
124 122
125 123 # Make sure 'zfs mount' should display all ZFS filesystems currently mounted.
126 124 # The results of 'zfs mount' and 'df -F zfs' should be identical.
127 125 function verify_mount_display
128 126 {
129 127 typeset fs
130 128
131 129 for fs in $(zfs $mountcmd | awk '{print $1}') ; do
132 130 log_must mounted $fs
133 131 done
134 132 return 0
135 133 }
↓ open down ↓ |
32 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX