+ # 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