]>
git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - zfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_all_001_pos.ksh
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.
27 .
$STF_SUITE/include
/libtest.shlib
28 .
$STF_SUITE/tests
/functional
/cli_root
/zfs_mount
/zfs_mount.kshlib
31 # Verify that 'zfs mount -a' succeeds as root.
34 # 1. Create a group of pools with specified vdev.
35 # 2. Create zfs filesystems within the given pools.
36 # 3. Unmount all the filesystems.
37 # 4. Verify that 'zfs mount -a' command succeed,
38 # and all available ZFS filesystems are mounted.
39 # 5. Verify that 'zfs mount' is identical with 'df -F zfs'
42 verify_runnable
"both"
44 set -A fs
"$TESTFS" "$TESTFS1"
45 set -A ctr
"" "$TESTCTR" "$TESTCTR/$TESTCTR1" "$TESTCTR1"
46 set -A vol
"$TESTVOL" "$TESTVOL1"
54 while (( i
< ${#ctr[*]} )); do
56 path
=${TEST_BASE_DIR%%/}/testroot$$
/$TESTPOOL
57 if [[ -n ${ctr[i]} ]]; then
60 setup_filesystem
"$DISKS" "$TESTPOOL" \
65 if is_global_zone
; then
67 while (( j
< ${#vol[*]} )); do
68 setup_filesystem
"$DISKS" "$TESTPOOL" \
69 "${ctr[i]}/${vol[j]}" \
77 while (( j
< ${#fs[*]} )); do
78 setup_filesystem
"$DISKS" "$TESTPOOL" \
79 "${ctr[i]}/${fs[j]}" \
96 ((i
= ${#ctr[*]} - 1))
98 while (( i
>= 0 )); do
99 if is_global_zone
; then
101 while (( j
< ${#vol[*]} )); do
102 cleanup_filesystem
"$TESTPOOL" \
103 "${ctr[i]}/${vol[j]}"
109 while (( j
< ${#fs[*]} )); do
110 cleanup_filesystem
"$TESTPOOL" \
115 [[ -n ${ctr[i]} ]] && \
116 cleanup_filesystem
"$TESTPOOL" "${ctr[i]}"
121 [[ -d ${TEST_BASE_DIR%%/}/testroot$$
]] && \
122 $RM -rf ${TEST_BASE_DIR%%/}/testroot$$
126 # This function takes a single true/false argument. If true it will verify that
127 # all file systems are mounted. If false it will verify that they are not
143 while (( i
< ${#ctr[*]} )); do
146 [[ -n ${ctr[i]} ]] && \
149 if is_global_zone
; then
151 while (( j
< ${#vol[*]} )); do
152 log_mustnot mounted
"$path/${vol[j]}"
158 while (( j
< ${#fs[*]} )); do
159 $logfunc mounted
"$path/${fs[j]}"
163 $logfunc mounted
"$path"
172 log_assert
"Verify that 'zfs $mountall' succeeds as root, " \
173 "and all available ZFS filesystems are mounted."
175 log_onexit cleanup_all
179 export __ZFS_POOL_RESTRICT
="$TESTPOOL"
180 log_must
$ZFS $unmountall
181 unset __ZFS_POOL_RESTRICT
185 export __ZFS_POOL_RESTRICT
="$TESTPOOL"
186 log_must
$ZFS $mountall
187 unset __ZFS_POOL_RESTRICT
191 log_note
"Verify that 'zfs $mountcmd' will display " \
192 "all ZFS filesystems currently mounted."
196 log_pass
"'zfs $mountall' succeeds as root, " \
197 "and all available ZFS filesystems are mounted."