ZTS: redundancy_draid_spare1

Preserve the 'zpool status' output used to calculate the number of
checksum errors so it can be logged on failure.  Several instances have
been observed in the CI where cksum was set to a non-zero value, yet a
subsequent run of 'zpool status' on failure showed no checksum errors.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #18500
This commit is contained in:
Brian Behlendorf
2026-05-07 15:57:07 -07:00
committed by GitHub
parent a2d053329c
commit 6a25950e72
@@ -435,32 +435,38 @@ function verify_draid_pool
log_note "verify_draid_pool $pool $replace_mode"
log_must zpool scrub -w $pool
sync_pool $pool true
typeset -i cksum=$(cksum_pool $pool)
typeset status=$(zpool status -p $pool)
typeset -i cksum=$(echo "$status" | awk '
!NF { isvdev = 0 }
isvdev { errors += $NF }
/CKSUM$/ { isvdev = 1 }
END { print errors }')
if [[ "$replace_mode" = "healing" ]]; then
if [[ $cksum -gt 0 ]]; then
log_must zpool status -v $pool
log_note "$status"
log_fail "Unexpected CKSUM errors found for $pool ($cksum)"
fi
if ! check_pool_status $pool "scan" "repaired 0B"; then
log_must zpool status -v $pool
log_note "$status"
log_fail "Unexpected repair IO found for $pool ($cksum)"
fi
elif [[ "$replace_mode" = "sequential" ]]; then
if [[ $cksum -gt 0 ]]; then
log_must zpool status -v $pool
log_note "$status"
log_fail "Unexpected CKSUM errors found for $pool ($cksum)"
fi
elif [[ "$replace_mode" = "damaged" ]]; then
if [[ $cksum -lt 1 ]]; then
log_must zpool status -v $pool
log_note "$status"
log_fail "Expected CKSUM errors missing for $pool ($cksum)"
fi
if check_pool_status $pool "scan" "repaired 0B"; then
log_must zpool status -v $pool
log_note "$status"
log_fail "Expected repair IO missing for $pool ($cksum)"
fi
else
@@ -468,12 +474,12 @@ function verify_draid_pool
fi
if ! check_pool_status $pool "scan" "with 0 errors"; then
log_must zpool status -v $pool
log_note "$status"
log_fail "Unexpected repair errors found for $pool"
fi
if ! check_pool_status $pool "errors" "No known data errors"; then
log_must zpool status -v $pool
log_note "$status"
log_fail "Unexpected data errors found for $pool"
fi
}