From: Bruno Faccini Date: Wed, 12 Mar 2014 13:12:33 +0000 (+0100) Subject: LU-4086 tests: strengthen sanity-hsm/test_33 X-Git-Tag: 2.5.58~50 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=adc6a5e76348d9bb1c8355103f419405a14decca LU-4086 tests: strengthen sanity-hsm/test_33 Instead of waiting+checking both Restore and Cancel HSM operations sequentially, wait for both to be finished and then check each results. This will allow to handle conditions where Restore terminates before the Cancel is started. Also added to wait_all_done() the capability to only work on requests for a specific fid. Signed-off-by: Bruno Faccini Change-Id: I480ce074513d6829ecb3078c273bac1fdffa6256 Reviewed-on: http://review.whamcloud.com/9600 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Jian Yu Reviewed-by: Aurelien Degremont Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/sanity-hsm.sh b/lustre/tests/sanity-hsm.sh index 80401fa..54c5e20 100755 --- a/lustre/tests/sanity-hsm.sh +++ b/lustre/tests/sanity-hsm.sh @@ -658,8 +658,10 @@ get_request_count() { wait_all_done() { local timeout=$1 + local fid=$2 local cmd="$LCTL get_param -n $HSM_PARAM.actions" + [[ -n $fid ]] && cmd+=" | grep '$fid'" cmd+=" | egrep 'WAITING|STARTED'" wait_result $SINGLEMDS "$cmd" "" $timeout || @@ -2225,6 +2227,15 @@ test_33() { wait_request_state $fid ARCHIVE SUCCEED $LFS hsm_release $f + # to be sure wait_all_done will not be mislead by previous tests + # and ops. + cdt_purge + wait_for_grace_delay + # Also raise grace_delay significantly so the Canceled + # Restore action will stay enough long avail. + local old_grace=$(get_hsm_param grace_delay) + set_hsm_param grace_delay 100 + md5sum $f >/dev/null & local pid=$! wait_request_state $fid RESTORE STARTED @@ -2237,8 +2248,29 @@ test_33() { $LFS hsm_cancel $f - wait_request_state $fid RESTORE CANCELED - wait_request_state $fid CANCEL SUCCEED + # instead of waiting+checking both Restore and Cancel ops + # sequentially, wait for both to be finished and then check + # each results. + wait_all_done 100 $fid + local rstate=$(get_request_state $fid RESTORE) + local cstate=$(get_request_state $fid CANCEL) + + # restore orig grace_delay. + set_hsm_param grace_delay $old_grace + + if [[ "$rstate" == "CANCELED" ]] ; then + [[ "$cstate" == "SUCCEED" ]] || + error "Restore state is CANCELED and Cancel state " \ + "is not SUCCEED but $cstate" + echo "Restore state is CANCELED, Cancel state is SUCCEED" + elif [[ "$rstate" == "SUCCEED" ]] ; then + [[ "$cstate" == "FAILED" ]] || + error "Restore state is SUCCEED and Cancel state " \ + "is not FAILED but $cstate" + echo "Restore state is SUCCEED, Cancel state is FAILED" + else + error "Restore state is $rstate and Cancel state is $cstate" + fi [ -z $killed ] || error "Cannot kill process waiting for restore ($killed)"