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
33 .
$STF_SUITE/tests
/functional
/cli_root
/zfs_mount
/zfs_mount.kshlib
36 # Verify that 'zfs mount -a' succeeds as root.
39 # 1. Create a group of pools with specified vdev.
40 # 2. Create zfs filesystems within the given pools.
41 # 3. Unmount all the filesystems.
42 # 4. Verify that 'zfs mount -a' command succeed,
43 # and all available ZFS filesystems are mounted.
44 # 5. Verify that 'zfs mount' is identical with 'df -F zfs'
47 verify_runnable
"both"
49 set -A fs
"$TESTFS" "$TESTFS1"
50 set -A ctr
"" "$TESTCTR" "$TESTCTR/$TESTCTR1" "$TESTCTR1"
51 set -A vol
"$TESTVOL" "$TESTVOL1"
59 while (( i
< ${#ctr[*]} )); do
61 path
=${TEST_BASE_DIR%%/}/testroot$$
/$TESTPOOL
62 if [[ -n ${ctr[i]} ]]; then
65 setup_filesystem
"$DISKS" "$TESTPOOL" \
70 if is_global_zone
; then
72 while (( j
< ${#vol[*]} )); do
73 setup_filesystem
"$DISKS" "$TESTPOOL" \
74 "${ctr[i]}/${vol[j]}" \
82 while (( j
< ${#fs[*]} )); do
83 setup_filesystem
"$DISKS" "$TESTPOOL" \
84 "${ctr[i]}/${fs[j]}" \
101 ((i
= ${#ctr[*]} - 1))
103 while (( i
>= 0 )); do
104 if is_global_zone
; then
106 while (( j
< ${#vol[*]} )); do
107 cleanup_filesystem
"$TESTPOOL" \
108 "${ctr[i]}/${vol[j]}"
114 while (( j
< ${#fs[*]} )); do
115 cleanup_filesystem
"$TESTPOOL" \
120 [[ -n ${ctr[i]} ]] && \
121 cleanup_filesystem
"$TESTPOOL" "${ctr[i]}"
126 [[ -d ${TEST_BASE_DIR%%/}/testroot$$
]] && \
127 rm -rf ${TEST_BASE_DIR%%/}/testroot$$
131 # This function takes a single true/false argument. If true it will verify that
132 # all file systems are mounted. If false it will verify that they are not
148 while (( i
< ${#ctr[*]} )); do
151 [[ -n ${ctr[i]} ]] && \
154 if is_global_zone
; then
156 while (( j
< ${#vol[*]} )); do
157 log_mustnot mounted
"$path/${vol[j]}"
163 while (( j
< ${#fs[*]} )); do
164 $logfunc mounted
"$path/${fs[j]}"
168 $logfunc mounted
"$path"
177 log_assert
"Verify that 'zfs $mountall' succeeds as root, " \
178 "and all available ZFS filesystems are mounted."
180 log_onexit cleanup_all
184 export __ZFS_POOL_RESTRICT
="$TESTPOOL"
185 log_must zfs
$unmountall
186 unset __ZFS_POOL_RESTRICT
190 export __ZFS_POOL_RESTRICT
="$TESTPOOL"
191 log_must zfs
$mountall
192 unset __ZFS_POOL_RESTRICT
196 log_note
"Verify that 'zfs $mountcmd' will display " \
197 "all ZFS filesystems currently mounted."
201 log_pass
"'zfs $mountall' succeeds as root, " \
202 "and all available ZFS filesystems are mounted."