1# vim: filetype=sh 2# Common routines used by zpool_import*. 3 4# $FreeBSD$ 5 6function setup_missing_test_pool # <tvd_type> 7{ 8 typeset tvd_type=$1 9 10 setup_filesystem "$DEVICE_FILES" $TESTPOOL1 $TESTFS $TESTDIR1 \ 11 "" $tvd_type 12 log_must $CP $MYTESTFILE $TESTDIR1/$TESTFILE0 13 log_must $ZPOOL export $TESTPOOL1 14} 15 16function recreate_missing_files 17{ 18 destroy_pool $TESTPOOL1 19 log_must $RM -rf $DEVICE_DIR/* 20 for (( devnum=0 ; $devnum < $MAX_NUM ; devnum += 1 )); do 21 log_must create_vdevs ${DEVICE_DIR}/${DEVICE_FILE}$devnum 22 done 23} 24 25function cleanup_missing 26{ 27 log_note "State of pools at the end of the test:" 28 poolexists $TESTPOOL1 && log_must $ZPOOL status $TESTPOOL1 29 log_note "State of $DEVICE_DIR at the end of the test:" 30 log_cmd $ZPOOL import -d $DEVICE_DIR 31 destroy_pool $TESTPOOL1 32 log_must $RM -rf $DEVICE_DIR/* 33 [[ -d $ALTER_ROOT ]] && log_must $RM -rf $ALTER_ROOT 34 [[ -d $BACKUP_DEVICE_DIR ]] && log_must $RM -rf $BACKUP_DEVICE_DIR 35} 36