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