Whamcloud - gitweb
LU-7988 hsm: run HSM coordinator once per second at most
[fs/lustre-release.git] / lustre / tests / sanity-hsm.sh
index a69302a..25c9cf8 100755 (executable)
@@ -3198,6 +3198,12 @@ multi_archive() {
        echo "$count archive requests submitted"
 }
 
+cleanup_test_40() {
+       trap 0
+       set_hsm_param max_requests $max_requests
+       copytool_cleanup
+}
+
 test_40() {
        local stream_count=4
        local file_count=100
@@ -3206,6 +3212,17 @@ test_40() {
        local i=""
        local p=""
        local fid=""
+       local max_requests=$(get_hsm_param max_requests)
+
+       # Increase the number of HSM request that can be performed in
+       # parallel. With the coordinator running once per second, this
+       # also limits the number of requests per seconds that can be
+       # performed, so we pick a decent number. But we also need to keep
+       # that number low because the copytool has no rate limit and will
+       # fail some requests if if gets too many at once.
+       set_hsm_param max_requests 300
+
+       trap cleanup_test_40 EXIT
 
        for i in $(seq 1 $file_count); do
                for p in $(seq 1 $stream_count); do
@@ -3232,7 +3249,8 @@ test_40() {
        wait ${pids[*]}
        echo OK
        wait_all_done 100
-       copytool_cleanup
+
+       cleanup_test_40
 }
 run_test 40 "Parallel archive requests"
 
@@ -3907,8 +3925,6 @@ run_test 103 "Purge all requests"
 DATA=CEA
 DATAHEX='[434541]'
 test_104() {
-       # test needs a running copytool
-       copytool_setup
 
        mkdir -p $DIR/$tdir
        local f=$DIR/$tdir/$tfile
@@ -3916,25 +3932,38 @@ test_104() {
        fid=$(make_custom_file_for_progress $f 39 1000000)
        [ $? != 0 ] && skip "not enough free space" && return
 
-       # if cdt is on, it can serve too quickly the request
-       cdt_disable
        $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER --data $DATA $f
        local data1=$(do_facet $SINGLEMDS "$LCTL get_param -n\
                        $HSM_PARAM.actions |\
                        grep $fid | cut -f16 -d=")
-       cdt_enable
 
        [[ "$data1" == "$DATAHEX" ]] ||
                error "Data field in records is ($data1) and not ($DATAHEX)"
 
+       # archive the file
+       copytool_setup
+
+       wait_request_state $fid ARCHIVE SUCCEED
+
        copytool_cleanup
 }
 run_test 104 "Copy tool data field"
 
+cleanup_test_105() {
+       trap 0
+       set_hsm_param max_requests $max_requests
+       copytool_cleanup
+}
+
 test_105() {
+       local max_requests=$(get_hsm_param max_requests)
        mkdir -p $DIR/$tdir
        local i=""
 
+       set_hsm_param max_requests 300
+
+       trap cleanup_test_105 EXIT
+
        cdt_disable
        for i in $(seq -w 1 10); do
                cp /etc/passwd $DIR/$tdir/$i
@@ -3944,6 +3973,7 @@ test_105() {
                        $HSM_PARAM.actions |\
                        grep WAITING | wc -l")
        cdt_restart
+
        cdt_disable
        local reqcnt2=$(do_facet $SINGLEMDS "$LCTL get_param -n\
                        $HSM_PARAM.actions |\
@@ -3953,6 +3983,8 @@ test_105() {
        [[ "$reqcnt1" == "$reqcnt2" ]] ||
                error "Requests count after shutdown $reqcnt2 != "\
                      "before shutdown $reqcnt1"
+
+       cleanup_test_105
 }
 run_test 105 "Restart of coordinator"
 
@@ -4288,6 +4320,9 @@ test_220a() {
 
        $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
 
+       # wait request to reach CT
+       wait_request_state $fid ARCHIVE STARTED
+
        rm -f $f
 
        copytool_continue
@@ -4402,6 +4437,10 @@ test_222c() {
        copytool_suspend
 
        $LFS hsm_restore $f
+
+       # wait request to reach CT
+       wait_request_state $fid RESTORE STARTED
+
        rm -f $f
 
        copytool_continue
@@ -4553,6 +4592,10 @@ test_224a() {
        copytool_suspend
 
        $LFS hsm_remove $f
+
+       # wait for request to reach CT
+       wait_request_state $fid REMOVE STARTED
+
        rm -f $f
 
        copytool_continue