1d583b39bSJohn Wren Kennedy#!/usr/bin/ksh -p 2d583b39bSJohn Wren Kennedy# 3d583b39bSJohn Wren Kennedy# CDDL HEADER START 4d583b39bSJohn Wren Kennedy# 5d583b39bSJohn Wren Kennedy# The contents of this file are subject to the terms of the 6d583b39bSJohn Wren Kennedy# Common Development and Distribution License (the "License"). 7d583b39bSJohn Wren Kennedy# You may not use this file except in compliance with the License. 8d583b39bSJohn Wren Kennedy# 9d583b39bSJohn Wren Kennedy# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10d583b39bSJohn Wren Kennedy# or http://www.opensolaris.org/os/licensing. 11d583b39bSJohn Wren Kennedy# See the License for the specific language governing permissions 12d583b39bSJohn Wren Kennedy# and limitations under the License. 13d583b39bSJohn Wren Kennedy# 14d583b39bSJohn Wren Kennedy# When distributing Covered Code, include this CDDL HEADER in each 15d583b39bSJohn Wren Kennedy# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16d583b39bSJohn Wren Kennedy# If applicable, add the following below this CDDL HEADER, with the 17d583b39bSJohn Wren Kennedy# fields enclosed by brackets "[]" replaced with your own identifying 18d583b39bSJohn Wren Kennedy# information: Portions Copyright [yyyy] [name of copyright owner] 19d583b39bSJohn Wren Kennedy# 20d583b39bSJohn Wren Kennedy# CDDL HEADER END 21d583b39bSJohn Wren Kennedy# 22d583b39bSJohn Wren Kennedy 23d583b39bSJohn Wren Kennedy# 24d583b39bSJohn Wren Kennedy# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 25d583b39bSJohn Wren Kennedy# Use is subject to license terms. 26d583b39bSJohn Wren Kennedy# 27d583b39bSJohn Wren Kennedy 28d583b39bSJohn Wren Kennedy# 291d32ba66SJohn Wren Kennedy# Copyright (c) 2012, 2016 by Delphix. All rights reserved. 30d583b39bSJohn Wren Kennedy# 31d583b39bSJohn Wren Kennedy 32d583b39bSJohn Wren Kennedy. $STF_SUITE/include/libtest.shlib 33d583b39bSJohn Wren Kennedy. $STF_SUITE/tests/functional/cli_root/zpool_import/zpool_import.cfg 34d583b39bSJohn Wren Kennedy 35d583b39bSJohn Wren Kennedyverify_runnable "global" 36d583b39bSJohn Wren Kennedy 37*e4c795beSTom Caputilog_must set_tunable32 zfs_scan_suspend_progress 0 38*e4c795beSTom Caputi 39d583b39bSJohn Wren Kennedyfor pool in "$TESTPOOL" "$TESTPOOL1"; do 40d583b39bSJohn Wren Kennedy datasetexists $pool/$TESTFS && \ 411d32ba66SJohn Wren Kennedy log_must zfs destroy -Rf $pool/$TESTFS 42d583b39bSJohn Wren Kennedy destroy_pool "$pool" 43d583b39bSJohn Wren Kennedydone 44d583b39bSJohn Wren Kennedy 45d583b39bSJohn Wren Kennedyismounted $DEVICE_DIR ufs 461d32ba66SJohn Wren Kennedy(( $? == 0 )) && log_must umount -f $DEVICE_DIR 47d583b39bSJohn Wren Kennedy 48d583b39bSJohn Wren Kennedyfor dir in "$TESTDIR" "$TESTDIR1" "$DEVICE_DIR" ; do 49d583b39bSJohn Wren Kennedy [[ -d $dir ]] && \ 501d32ba66SJohn Wren Kennedy log_must rm -rf $dir 51d583b39bSJohn Wren Kennedydone 52d583b39bSJohn Wren Kennedy 53d583b39bSJohn Wren Kennedy# recreate and destroy a zpool over the disks to restore the partitions to 54d583b39bSJohn Wren Kennedy# normal 55d583b39bSJohn Wren Kennedycase $DISK_COUNT in 56d583b39bSJohn Wren Kennedy0|1) 57d583b39bSJohn Wren Kennedy log_note "No disk devices to restore" 58d583b39bSJohn Wren Kennedy ;; 59d583b39bSJohn Wren Kennedy*) 60d583b39bSJohn Wren Kennedy log_must cleanup_devices $ZFS_DISK1 61d583b39bSJohn Wren Kennedy log_must cleanup_devices $ZFS_DISK2 62d583b39bSJohn Wren Kennedy ;; 63d583b39bSJohn Wren Kennedyesac 64d583b39bSJohn Wren Kennedy 65d583b39bSJohn Wren Kennedylog_pass 66