7260 disable libdiskmgmt in zfstest unless it's required
[unleashed.git] / usr / src / test / zfs-tests / tests / functional / inuse / inuse_001_pos.ksh
blob0317d6d0b296271d2931f9e5c5dc4edb556f7afa
1 #!/usr/bin/ksh -p
3 # CDDL HEADER START
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]
20 # CDDL HEADER END
24 # Copyright 2008 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
29 # Copyright (c) 2013, 2015 by Delphix. All rights reserved.
32 . $STF_SUITE/include/libtest.shlib
33 . $STF_SUITE/tests/functional/inuse/inuse.cfg
36 # DESCRIPTION:
37 # ZFS will not interfere with devices that are in use by dumpadm.
39 # STRATEGY:
40 # 1. Create crash dump device using 'dumpadm'
41 # 2. Try to create a ZFS pool using the 'dumpadm' crash dump device.
44 verify_runnable "global"
46 function cleanup
49 # Remove dump device.
51 if [[ -n $PREVDUMPDEV ]]; then
52 log_must $DUMPADM -u -d $PREVDUMPDEV > /dev/null
55 destroy_pool $TESTPOOL
58 log_assert "Ensure ZFS cannot use a device designated as a dump device"
60 log_onexit cleanup
62 typeset dumpdev=""
63 typeset diskslice=""
65 PREVDUMPDEV=`$DUMPADM | $GREP "Dump device" | $AWK '{print $3}'`
67 log_note "Zero $FS_DISK0 and place free space in to slice 0"
68 log_must cleanup_devices $FS_DISK0
70 diskslice="/dev/dsk/${FS_DISK0}s0"
71 log_note "Configuring $diskslice as dump device"
72 log_must $DUMPADM -d $diskslice > /dev/null
74 log_note "Confirm that dump device has been setup"
75 dumpdev=`$DUMPADM | $GREP "Dump device" | $AWK '{print $3}'`
76 [[ -z "$dumpdev" ]] && log_untested "No dump device has been configured"
78 [[ "$dumpdev" != "$diskslice" ]] && \
79 log_untested "Dump device has not been been configured to $diskslice"
81 log_note "Attempt to zpool the dump device"
82 unset NOINUSE_CHECK
83 log_mustnot $ZPOOL create $TESTPOOL "$diskslice"
84 log_mustnot poolexists $TESTPOOL
86 log_pass "Unable to zpool a device in use by dumpadm"