1#
2# CDDL HEADER START
3#
4# This file and its contents are supplied under the terms of the
5# Common Development and Distribution License ("CDDL"), version 1.0.
6# You may only use this file in accordance with the terms of version
7# 1.0 of the CDDL.
8#
9# A full copy of the text of the CDDL should have accompanied this
10# source.  A copy of the CDDL is also available via the Internet at
11# http://www.illumos.org/license/CDDL.
12#
13# CDDL HEADER END
14#
15
16#
17# Copyright (c) 2016 by Delphix. All rights reserved.
18# Copyright (c) 2019 by Lawrence Livermore National Security, LLC.
19#
20
21function trim_prog_line # pool disk
22{
23	typeset pool="$1"
24	typeset disk="$2"
25	zpool status -t "$pool" | grep "$disk" | grep "[[:digit:]]* trimmed"
26}
27
28function trim_progress # pool disk
29{
30	trim_prog_line "$1" "$2" | sed 's/.*(\([0-9]\{1,\}\)% trimmed.*/\1/g'
31}
32
33function cleanup
34{
35	if poolexists $TESTPOOL; then
36		destroy_pool $TESTPOOL
37	fi
38
39	if poolexists $TESTPOOL1; then
40		destroy_pool $TESTPOOL1
41	fi
42}
43log_onexit cleanup
44