1#!/usr/local/bin/ksh93 -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 2009 Sun Microsystems, Inc.  All rights reserved.
25# Use is subject to license terms.
26
27. $STF_SUITE/tests/slog/slog.kshlib
28
29#################################################################################
30#
31# __stc_assertion_start
32#
33# ID: slog_013_pos
34#
35# DESCRIPTION:
36#	Verify slog device can be disk, file, lofi device or any device that
37#	presents a block interface.
38#
39# STRATEGY:
40#	1. Create a pool
41#	2. Loop to add different object as slog
42#	3. Verify it passes
43#
44# TESTABILITY: explicit
45#
46# TEST_AUTOMATION_LEVEL: automated
47#
48# CODING_STATUS: COMPLETED (2007-06-20)
49#
50# __stc_assertion_end
51#
52################################################################################
53
54verify_runnable "global"
55
56function cleanup_testenv
57{
58	cleanup
59	if datasetexists $TESTPOOL2 ; then
60		log_must $ZPOOL destroy -f $TESTPOOL2
61	fi
62	if [[ -n $lofidev ]]; then
63		$LOFIADM -d $lofidev
64	fi
65}
66
67log_assert "Verify slog device can be disk, file, lofi device or any device " \
68	"that presents a block interface."
69log_onexit cleanup_testenv
70
71dsk1=${DISKS%% *}
72log_must $ZPOOL create $TESTPOOL ${DISKS#$dsk1}
73
74# Add nomal disk
75log_must $ZPOOL add $TESTPOOL log $dsk1
76log_must verify_slog_device $TESTPOOL $dsk1 'ONLINE'
77# Add nomal file
78log_must $ZPOOL add $TESTPOOL log $LDEV
79ldev=$(random_get $LDEV)
80log_must verify_slog_device $TESTPOOL $ldev 'ONLINE'
81
82# Add lofi device
83lofidev=${LDEV2%% *}
84log_must $LOFIADM -a $lofidev
85lofidev=$($LOFIADM $lofidev)
86log_must $ZPOOL add $TESTPOOL log $lofidev
87log_must verify_slog_device $TESTPOOL $lofidev 'ONLINE'
88
89log_pass "Verify slog device can be disk, file, lofi device or any device " \
90	"that presents a block interface."
91
92# Temp disable fore bug 6569095
93# Add file which reside in the itself
94mntpnt=$(get_prop mountpoint $TESTPOOL)
95log_must create_vdevs $mntpnt/vdev
96log_must $ZPOOL add $TESTPOOL $mntpnt/vdev
97
98# Temp disable fore bug 6569072
99# Add ZFS volume
100vol=$TESTPOOL/vol
101log_must $ZPOOL create -V 64M $vol
102log_must $ZPOOL add $TESTPOOL /dev/zvol/$vol
103