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