]> git.proxmox.com Git - mirror_zfs.git/blobdiff - tests/zfs-tests/tests/functional/fault/auto_replace_001_pos.ksh
Various ZED fixes
[mirror_zfs.git] / tests / zfs-tests / tests / functional / fault / auto_replace_001_pos.ksh
index 40a680a9bb024c1e7582176f1f11c5666352f625..8e48b2ab4371a9f1338c02746ee43aee84aa8b71 100755 (executable)
@@ -57,27 +57,23 @@ fi
 
 function setup
 {
-       lsmod | egrep scsi_debug > /dev/null
-       if (($? == 1)); then
-               load_scsi_debug $SDSIZE $SDHOSTS $SDTGTS $SDLUNS
-       fi
+       load_scsi_debug $SDSIZE $SDHOSTS $SDTGTS $SDLUNS '512b'
+       SD=$(get_debug_device)
+       SDDEVICE_ID=$(get_persistent_disk_name $SD)
        # Register vdev_id alias rule for scsi_debug device to create a
        # persistent path
-       SD=$(lsscsi | nawk '/scsi_debug/ {print $6; exit}' \
-           | nawk -F / '{print $3}')
-       SDDEVICE_ID=$(get_persistent_disk_name $SD)
        log_must eval "echo "alias scsidebug /dev/disk/by-id/$SDDEVICE_ID" \
            >> $VDEVID_CONF"
        block_device_wait
-
-       SDDEVICE=$(udevadm info -q all -n $DEV_DSKDIR/$SD | egrep ID_VDEV \
-           | nawk '{print $2; exit}' | nawk -F = '{print $2; exit}')
+       SDDEVICE=$(udevadm info -q all -n $DEV_DSKDIR/$SD \
+           | awk -F'=' '/ID_VDEV=/{print $2; exit}')
        [[ -z $SDDEVICE ]] && log_fail "vdev rule was not registered properly"
 }
 
 function cleanup
 {
-       poolexists $TESTPOOL && destroy_pool $TESTPOOL
+       destroy_pool $TESTPOOL
+       unload_scsi_debug
 }
 
 log_assert "Testing automated auto-replace FMA test"
@@ -112,7 +108,7 @@ log_must zpool export -F $TESTPOOL
 # Offline disk
 remove_disk $SD
 block_device_wait
-log_must modprobe -r scsi_debug
+unload_scsi_debug
 
 # Reimport pool with drive missing
 log_must zpool import $TESTPOOL