1# 2# This file and its contents are supplied under the terms of the 3# Common Development and Distribution License ("CDDL"), version 1.0. 4# You may only use this file in accordance with the terms of version 5# 1.0 of the CDDL. 6# 7# A full copy of the text of the CDDL should have accompanied this 8# source. A copy of the CDDL is also available via the Internet at 9# http://www.illumos.org/license/CDDL. 10# 11 12# 13# Copyright (c) 2017, Intel Corporation. 14# Copyright (c) 2018 by Delphix. All rights reserved. 15# 16 17. $STF_SUITE/include/libtest.shlib 18. $STF_SUITE/tests/functional/alloc_class/alloc_class.cfg 19 20function disk_setup 21{ 22 truncate -s $ZPOOL_DEVSIZE $ZPOOL_DISKS 23 truncate -s $CLASS_DEVSIZE $CLASS_DISKS 24} 25 26function disk_cleanup 27{ 28 rm -f $ZPOOL_DEVSIZE $ZPOOL_DISKS 2> /dev/null 29 rm -f $CLASS_DEVSIZE $CLASS_DISKS 2> /dev/null 30} 31 32function cleanup 33{ 34 if datasetexists $TESTPOOL ; then 35 zpool destroy -f $TESTPOOL 2> /dev/null 36 fi 37 38 disk_cleanup 39} 40 41# 42# Try zpool status/iostat for given pool 43# 44# $1 pool 45# 46function display_status 47{ 48 typeset pool=$1 49 50 typeset -i ret=0 51 zpool status -xv $pool > /dev/null 2>&1 52 ret=$? 53 54 zpool iostat > /dev/null 2>&1 55 ((ret |= $?)) 56 57 typeset mntpnt=$(get_prop mountpoint $pool) 58 dd if=/dev/random of=$mntpnt/testfile.$$ & 59 typeset pid=$! 60 61 zpool iostat -v 1 3 > /dev/null 62 ((ret |= $?)) 63 64 kill -9 $pid 65 66 return $ret 67} 68