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