cleanup() {
copytool_cleanup
changelog_cleanup
+ cdt_set_sanity_policy
}
search_and_kill_copytool() {
}
cdt_set_sanity_policy() {
- # clear all
- do_facet $SINGLEMDS $LCTL set_param $HSM_PARAM.policy=-nra
- do_facet $SINGLEMDS $LCTL set_param $HSM_PARAM.policy=-nbr
- do_facet $SINGLEMDS $LCTL set_param $HSM_PARAM.policy=-gc
+ if [[ "$CDT_POLICY_HAD_CHANGED" ]]
+ then
+ # clear all
+ do_facet $SINGLEMDS $LCTL set_param $HSM_PARAM.policy=+NRA
+ do_facet $SINGLEMDS $LCTL set_param $HSM_PARAM.policy=-NBR
+ CDT_POLICY_HAD_CHANGED=
+ fi
}
cdt_set_no_retry() {
- do_facet $SINGLEMDS $LCTL set_param $HSM_PARAM.policy=+nra
+ do_facet $SINGLEMDS $LCTL set_param $HSM_PARAM.policy=+NRA
+ CDT_POLICY_HAD_CHANGED=true
}
cdt_clear_no_retry() {
- do_facet $SINGLEMDS $LCTL set_param $HSM_PARAM.policy=-nra
+ do_facet $SINGLEMDS $LCTL set_param $HSM_PARAM.policy=-NRA
+ CDT_POLICY_HAD_CHANGED=true
}
-cdt_set_no_blocking_restore() {
- do_facet $SINGLEMDS $LCTL set_param $HSM_PARAM.policy=+nbr
+cdt_set_non_blocking_restore() {
+ do_facet $SINGLEMDS $LCTL set_param $HSM_PARAM.policy=+NBR
+ CDT_POLICY_HAD_CHANGED=true
}
-cdt_clear_no_blocking_restore() {
- do_facet $SINGLEMDS $LCTL set_param $HSM_PARAM.policy=-nbr
+cdt_clear_non_blocking_restore() {
+ do_facet $SINGLEMDS $LCTL set_param $HSM_PARAM.policy=-NBR
+ CDT_POLICY_HAD_CHANGED=true
}
cdt_clear_mount_state() {
cdt_set_sanity_policy
}
-need2clients() {
- if [[ $CLIENTCOUNT -lt 2 ]]; then
- skip "Need two or more clients, have $CLIENTCOUNT"
+needclients() {
+ local clnt_count=$1
+ if [[ $CLIENTCOUNT -lt $clnt_count ]]; then
+ skip "Need $clnt_count or more clients, have $CLIENTCOUNT"
return 1
fi
return 0
echo "Start copytool"
copytool_setup
+echo "Set sanity-hsm HSM policy"
+cdt_set_sanity_policy
+
# finished requests are quickly removed from list
set_hsm_param grace_delay 10
run_test 9 "Use of explict archive number, with dedicated copytool"
test_9a() {
- [[ $CLIENTCOUNT -ge 3 ]] ||
- { skip "Need three or more clients"; return 0; }
+ needclients 3 || return 0
local n
local file
$LFS hsm_archive $file || error "could not archive file $file"
wait_request_state $fid ARCHIVE SUCCEED
- check_hsm_flags $file "0x00000001"
+ check_hsm_flags $file "0x00000009"
done
trap - EXIT
run_test 12g "Restore a released file implicitly"
test_12h() {
- need2clients || return 0
+ needclients 2 || return 0
# test needs a running copytool
copytool_setup
test_30a() {
# restore at exec cannot work on agent node (because of Linux kernel
# protection of executables)
- need2clients || return 0
+ needclients 2 || return 0
# test needs a running copytool
copytool_setup
test_30b() {
# restore at exec cannot work on agent node (because of Linux kernel
# protection of executables)
- need2clients || return 0
+ needclients 2 || return 0
# test needs a running copytool
copytool_setup
test_57() {
# Need one client for I/O, one for request
- need2clients || return 0
+ needclients 2 || return 0
# test needs a running copytool
copytool_setup
}
run_test 107 "Copytool re-register after MDS restart"
+policy_set_and_test()
+{
+ local change="$1"
+ local target="$2"
+ do_facet $SINGLEMDS $LCTL set_param "$HSM_PARAM.policy=\\\"$change\\\""
+ local policy=$(do_facet $SINGLEMDS $LCTL get_param -n $HSM_PARAM.policy)
+ [[ "$policy" == "$target" ]] ||
+ error "Wrong policy after '$change': '$policy' != '$target'"
+}
+
+test_109() {
+ # to force default policy setting if error
+ CDT_POLICY_HAD_CHANGED=true
+
+ local policy=$(do_facet $SINGLEMDS $LCTL get_param -n $HSM_PARAM.policy)
+ local default="NonBlockingRestore [NoRetryAction]"
+ [[ "$policy" == "$default" ]] ||
+ error "default policy has changed,"\
+ " '$policy' != '$default' update the test"
+ policy_set_and_test "+NBR" "[NonBlockingRestore] [NoRetryAction]"
+ policy_set_and_test "+NRA" "[NonBlockingRestore] [NoRetryAction]"
+ policy_set_and_test "-NBR" "NonBlockingRestore [NoRetryAction]"
+ policy_set_and_test "-NRA" "NonBlockingRestore NoRetryAction"
+ policy_set_and_test "NRA NBR" "[NonBlockingRestore] [NoRetryAction]"
+ # useless bacause we know but safer for futur changes to use real value
+ local policy=$(do_facet $SINGLEMDS $LCTL get_param -n $HSM_PARAM.policy)
+ echo "Next set_param must failed"
+ policy_set_and_test "wrong" "$policy"
+
+ # return to default
+ echo "Back to default policy"
+ cdt_set_sanity_policy
+}
+run_test 109 "Policy display/change"
+
test_110a() {
# test needs a running copytool
copytool_setup
import_file $tdir/$tfile $f
local fid=$(path2fid $f)
- cdt_set_no_blocking_restore
+ cdt_set_non_blocking_restore
md5sum $f
local st=$?
# cleanup
wait_request_state $fid RESTORE SUCCEED
- cdt_clear_no_blocking_restore
+ cdt_clear_non_blocking_restore
# Test result
[[ $st == 1 ]] ||
wait_request_state $fid ARCHIVE SUCCEED
$LFS hsm_release $f
- cdt_set_no_blocking_restore
+ cdt_set_non_blocking_restore
md5sum $f
local st=$?
# cleanup
wait_request_state $fid RESTORE SUCCEED
- cdt_clear_no_blocking_restore
+ cdt_clear_non_blocking_restore
# Test result
[[ $st == 1 ]] ||