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 2007 Sun Microsystems, Inc. All rights reserved. 25# Use is subject to license terms. 26# 27# ident "@(#)interop_001_pos.ksh 1.2 07/01/09 SMI" 28# 29 30. $STF_SUITE/include/libtest.kshlib 31 32################################################################################ 33# 34# __stc_assertion_start 35# 36# ID: interop_001_pos 37# 38# DESCRIPTION: 39# Create a SVM device and add this to an existing ZFS pool 40# 41# STRATEGY: 42# 1. Create a SVM metadevice 43# 2. Create a ZFS file system 44# 3. Add SVM metadevice to the ZFS pool 45# 4. Create files and fill the pool. 46# 47# TESTABILITY: explicit 48# 49# TEST_AUTOMATION_LEVEL: automated 50# 51# CODING_STATUS: COMPLETED (2005-07-04) 52# 53# __stc_assertion_end 54# 55################################################################################ 56 57 58function cleanup 59{ 60 $RM -rf $TESTDIR/* 61} 62 63log_assert "Create a SVM device and add this to an existing ZFS pool" 64 65log_onexit cleanup 66 67# the current size of the test pool 68typeset -i oldsize=`$ZFS get -pH -o value available $TESTPOOL` 69 70log_must $ZPOOL add $TESTPOOL $META_DEVICE_PATH 71log_must $ZPOOL iostat -v | $GREP $META_DEVICE_ID 72 73# the size of the test pool after adding the extra device 74typeset -i newsize=`$ZFS get -pH -o value available $TESTPOOL` 75 76(( $oldsize >= $newsize )) && \ 77 log_fail "Pool space available ($oldsize) before adding a new device was "\ 78 "larger than the space available ($newsize) afterwards." 79 80log_note "Pool space available was ($oldsize), it's now ($newsize)" 81 82typeset -i odirnum=1 83typeset -i idirnum=0 84typeset -i filenum=0 85typeset -i retval=0 86typeset bg=$TESTDIR/bigdirectory 87 88fill_fs $bg 20 25 $FILE_SIZE $FILE_COUNT 89retval=$? 90 91afterwritepoolavail=`$ZFS get -pH -o value available $TESTPOOL` 92readonly ENOSPC=28 93 94(( $retval == $ENOSPC && $afterwritepoolavail < $oldsize)) && \ 95 log_pass "Successfully used ($(( $newsize - $oldsize )) bytes) in "\ 96 "pool provided by SVM metadevice" 97 98log_fail "Failed to use space in pool ($(( $newsize - $oldsize ))bytes) "\ 99 "provided by SVM metadevice" 100