3 # Run select tests by setting ONLY, or as arguments to the script.
4 # Skip specific tests by setting EXCEPT.
11 export PATH=$PWD/$SRCDIR:$SRCDIR:$PWD/$SRCDIR/utils:$PATH:/sbin:/usr/sbin
14 # bug number for skipped test:
15 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
16 # skip test cases failed before landing - Jinshan
17 ALWAYS_EXCEPT="$SANITY_HSM_EXCEPT 12a 12b 12n 13 24 30a 31a 34 35 36 58 59"
18 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 110a 200 201 221 222a 223a 223b 225"
20 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
22 . $LUSTRE/tests/test-framework.sh
24 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
27 MULTIOP=${MULTIOP:-multiop}
28 OPENFILE=${OPENFILE:-openfile}
29 MCREATE=${MCREATE:-mcreate}
30 MOUNT_2=${MOUNT_2:-"yes"}
33 if [[ $MDSCOUNT -ge 2 ]]; then
34 skip_env "Only run with single MDT for now" && exit
37 check_and_setup_lustre
39 if [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.4.53) ]]; then
40 skip_env "Need MDS version at least 2.4.53" && exit
43 # $RUNAS_ID may get set incorrectly somewhere else
44 if [[ $UID -eq 0 && $RUNAS_ID -eq 0 ]]; then
45 skip_env "\$RUNAS_ID set to 0, but \$UID is also 0!" && exit
47 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS
52 # In order to test multiple remote HSM agents, a new facet type named "AGT" and
53 # the following associated variables are added:
55 # AGTCOUNT: number of agents
56 # AGTDEV{N}: target HSM mount point (root path of the backend)
57 # agt{N}_HOST: hostname of the agent agt{N}
58 # SINGLEAGT: facet of the single agent
60 # The number of agents is initialized as the number of remote client nodes.
61 # By default, only single copytool is started on a remote client/agent. If there
62 # was no remote client, then the copytool will be started on the local client.
68 export AGTCOUNT=${AGTCOUNT:-$((CLIENTCOUNT - 1))}
69 [[ $AGTCOUNT -gt 0 ]] || AGTCOUNT=1
71 export SHARED_DIRECTORY=${SHARED_DIRECTORY:-$TMP}
72 if [[ $CLIENTCOUNT -gt 1 ]] &&
73 ! check_shared_dir $SHARED_DIRECTORY $CLIENTS; then
74 skip_env "SHARED_DIRECTORY should be accessible"\
79 for n in $(seq $AGTCOUNT); do
80 eval export AGTDEV$n=\$\{AGTDEV$n:-"$SHARED_DIRECTORY/arc$n"\}
81 agent=CLIENT$((n + 1))
82 if [[ -z "${!agent}" ]]; then
83 [[ $CLIENTCOUNT -eq 1 ]] && agent=CLIENT1 ||
86 eval export agt${n}_HOST=\$\{agt${n}_HOST:-${!agent}\}
89 export SINGLEAGT=${SINGLEAGT:-agt1}
91 export HSMTOOL=${HSMTOOL:-"lhsmtool_posix"}
92 export HSMTOOL_VERBOSE=${HSMTOOL_VERBOSE:-""}
93 export HSMTOOL_BASE=$(basename "$HSMTOOL" | cut -f1 -d" ")
94 HSM_ARCHIVE=$(copytool_device $SINGLEAGT)
97 MDT_PARAM="mdt.$FSNAME-MDT0000"
98 HSM_PARAM="$MDT_PARAM.hsm"
100 # archive is purged at copytool setup
101 HSM_ARCHIVE_PURGE=true
104 # Get the backend root path for the given agent facet.
107 local dev=AGTDEV$(facet_number $facet)
112 # Stop copytool and unregister an existing changelog user.
118 search_and_kill_copytool() {
119 local agents=${1:-$(facet_active_host $SINGLEAGT)}
121 echo "Killing existing copytools on $agents"
122 do_nodesv $agents "killall -q $HSMTOOL_BASE" || true
126 local facet=${1:-$SINGLEAGT}
127 local lustre_mntpnt=${2:-$MOUNT}
129 local hsm_root=$(copytool_device $facet)
130 local agent=$(facet_active_host $facet)
132 if [[ -z "$arc_id" ]] &&
133 do_facet $facet "pkill -CONT -x $HSMTOOL_BASE"; then
134 echo "Wakeup copytool $facet on $agent"
138 if $HSM_ARCHIVE_PURGE; then
139 echo "Purging archive on $agent"
140 do_facet $facet "rm -rf $hsm_root/*"
143 echo "Starting copytool $facet on $agent"
144 do_facet $facet "mkdir -p $hsm_root" || error "mkdir '$hsm_root' failed"
145 # bandwidth is limited to 1MB/s so the copy time is known and
146 # independent of hardware
147 local cmd="$HSMTOOL $HSMTOOL_VERBOSE --daemon --hsm-root $hsm_root"
148 [[ -z "$arc_id" ]] || cmd+=" --archive $arc_id"
149 cmd+=" --bandwidth 1 $lustre_mntpnt"
151 # Redirect the standard output and error to a log file which
152 # can be uploaded to Maloo.
153 local prefix=$TESTLOG_PREFIX
154 [[ -z "$TESTNAME" ]] || prefix=$prefix.$TESTNAME
155 local copytool_log=$prefix.copytool${arc_id}_log.$agent.log
157 do_facet $facet "$cmd < /dev/null > $copytool_log 2>&1" ||
158 error "start copytool $facet on $agent failed"
164 local agents=${1:-$(facet_active_host $SINGLEAGT)}
166 do_nodesv $agents "pkill -INT -x $HSMTOOL_BASE" || return 0
168 echo "Copytool is stopped on $agents"
172 local agents=${1:-$(facet_active_host $SINGLEAGT)}
174 do_nodesv $agents "pkill -STOP -x $HSMTOOL_BASE" || return 0
175 echo "Copytool is suspended on $agents"
178 copytool_remove_backend() {
180 local be=$(find $HSM_ARCHIVE -name $fid)
181 echo "Remove from backend: $fid = $be"
186 do_facet $SINGLEAGT \
187 "$HSMTOOL --archive $HSM_ARCHIVE_NUMBER --hsm-root $HSM_ARCHIVE\
188 --import $1 $2 $MOUNT" ||
189 error "import of $1 to $2 failed"
193 local file=$HSM_ARCHIVE/$1
194 mkdir -p $(dirname $file)
195 dd if=/dev/urandom of=$file count=32 bs=1000000 ||
196 error "cannot create $file"
200 CL_USER=$(do_facet $SINGLEMDS $LCTL --device $MDT0\
201 changelog_register -n)
202 do_facet $SINGLEMDS lctl set_param mdd.$MDT0.changelog_mask="+hsm"
203 $LFS changelog_clear $MDT0 $CL_USER 0
206 changelog_cleanup() {
207 # $LFS changelog $MDT0
208 [[ -n "$CL_USER" ]] || return 0
210 $LFS changelog_clear $MDT0 $CL_USER 0
211 do_facet $SINGLEMDS lctl --device $MDT0 changelog_deregister $CL_USER
215 changelog_get_flags() {
220 $LFS changelog $mdt | awk "/$cltype/ && /t=\[$fid\]/ {print \$5}"
225 local val=$(do_facet $SINGLEMDS $LCTL get_param -n $HSM_PARAM.$param)
232 do_facet $SINGLEMDS $LCTL set_param -n $HSM_PARAM.$param=$value
239 do_facet $SINGLEMDS $LCTL set_param $MDT_PARAM.hsm_control=$cmd
240 wait_result $SINGLEMDS "$LCTL get_param -n $MDT_PARAM.hsm_control"\
241 $target 10 || error "cdt state is not $target"
244 cdt_set_sanity_policy() {
246 do_facet $SINGLEMDS $LCTL set_param $HSM_PARAM.policy=-nra
247 do_facet $SINGLEMDS $LCTL set_param $HSM_PARAM.policy=-nbr
248 do_facet $SINGLEMDS $LCTL set_param $HSM_PARAM.policy=-gc
252 do_facet $SINGLEMDS $LCTL set_param $HSM_PARAM.policy=+nra
255 cdt_clear_no_retry() {
256 do_facet $SINGLEMDS $LCTL set_param $HSM_PARAM.policy=-nra
259 cdt_set_no_blocking_restore() {
260 do_facet $SINGLEMDS $LCTL set_param $HSM_PARAM.policy=+nbr
263 cdt_clear_no_blocking_restore() {
264 do_facet $SINGLEMDS $LCTL set_param $HSM_PARAM.policy=-nbr
267 cdt_clear_mount_state() {
268 # /!\ conf_param and set_param syntax differ +> we cannot use
270 do_facet $SINGLEMDS $LCTL conf_param -d $FSNAME-MDT0000.mdt.hsm_control
273 cdt_set_mount_state() {
274 # /!\ conf_param and set_param syntax differ +> we cannot use
276 do_facet $SINGLEMDS $LCTL conf_param $FSNAME-MDT0000.mdt.hsm_control=$1
281 wait_result $SINGLEMDS\
282 "$LCTL get_param -n $MDT_PARAM.hsm_control" "$target" 20 ||
283 error "cdt state is not $target"
287 set_test_state disabled disabled
291 set_test_state enabled enabled
295 set_test_state shutdown stopped
299 set_test_state purge enabled
305 cdt_set_sanity_policy
309 if [[ $CLIENTCOUNT -lt 2 ]]; then
310 skip "Need two or more clients, have $CLIENTCOUNT"
317 $LFS path2fid $1 | tr -d '[]'
324 if [[ $u == "user" ]]
326 local st=$($RUNAS $LFS hsm_state $f)
328 local st=$($LFS hsm_state $f)
332 [[ $? == 0 ]] || error "$LFS hsm_state $f failed (run as $u)"
334 st=$(echo $st | cut -f 2 -d" " | tr -d "()," )
338 get_hsm_archive_id() {
340 local st=$($LFS hsm_state $f)
341 [[ $? == 0 ]] || error "$LFS hsm_state $f failed"
343 local ar=$(echo $st | grep "archive_id" | cut -f5 -d" " |
352 local st=$(get_hsm_flags $f)
353 [[ $st == $fl ]] || error "hsm flags on $f are $st != $fl"
356 check_hsm_flags_user() {
360 local st=$(get_hsm_flags $f user)
361 [[ $st == $fl ]] || error "hsm flags on $f are $st != $fl"
379 cp $1 $f || error "cannot copy $1 to $f"
380 path2fid $f || error "cannot get fid on $f"
384 local file2=${1/$DIR/$DIR2}
385 dd if=/dev/urandom of=$file2 count=2 bs=1M conv=fsync ||
386 error "cannot create $file2"
387 path2fid $1 || error "cannot get fid on $1"
390 make_large_for_striping() {
391 local file2=${1/$DIR/$DIR2}
392 local sz=$($LCTL get_param -n lov.*-clilov-*.stripesize | head -1)
393 dd if=/dev/urandom of=$file2 count=5 bs=$sz conv=fsync ||
394 error "cannot create $file2"
395 path2fid $1 || error "cannot get fid on $1"
398 make_large_for_progress() {
399 local file2=${1/$DIR/$DIR2}
400 # big file is large enough, so copy time is > 30s
401 # so copytool make 1 progress
402 # size is not a multiple of 1M to avoid stripe
404 dd if=/dev/urandom of=$file2 count=39 bs=1000000 conv=fsync ||
405 error "cannot create $file2"
406 path2fid $1 || error "cannot get fid on $1"
409 make_large_for_progress_aligned() {
410 local file2=${1/$DIR/$DIR2}
411 # big file is large enough, so copy time is > 30s
412 # so copytool make 1 progress
413 # size is a multiple of 1M to have stripe
415 dd if=/dev/urandom of=$file2 count=33 bs=1M conv=fsync ||
416 error "cannot create $file2"
417 path2fid $1 || error "cannot get fid on $1"
420 make_large_for_cancel() {
421 local file2=${1/$DIR/$DIR2}
422 # Copy timeout is 100s. 105MB => 105s
423 dd if=/dev/urandom of=$file2 count=103 bs=1M conv=fsync ||
424 error "cannot create $file2"
425 path2fid $1 || error "cannot get fid on $1"
431 wait_update --verbose $(facet_active_host $facet) "$@"
434 wait_request_state() {
439 local cmd="$LCTL get_param -n $HSM_PARAM.agent_actions"
440 cmd+=" | awk '/'$fid'.*action='$request'/ {print \\\$13}' | cut -f2 -d="
442 wait_result $SINGLEMDS "$cmd" $state 100 ||
443 error "request on $fid is not $state"
446 get_request_state() {
450 do_facet $SINGLEMDS "$LCTL get_param -n $HSM_PARAM.agent_actions |"\
451 "awk '/'$fid'.*action='$request'/ {print \\\$13}' | cut -f2 -d="
454 get_request_count() {
458 do_facet $SINGLEMDS "$LCTL get_param -n $HSM_PARAM.agent_actions |"\
459 "awk -vn=0 '/'$fid'.*action='$request'/ {n++}; END {print n}'"
465 local cmd="$LCTL get_param -n $HSM_PARAM.agent_actions"
466 cmd+=" | egrep 'WAITING|STARTED'"
468 wait_result $SINGLEMDS "$cmd" "" $timeout ||
469 error "requests did not complete"
472 wait_for_grace_delay() {
473 local val=$(get_hsm_param grace_delay)
477 MDT0=$($LCTL get_param -n mdc.*.mds_server_uuid |
478 awk '{gsub(/_UUID/,""); print $1}' | head -1)
483 # cleanup from previous bad setup
484 search_and_kill_copytool
486 # for recovery tests, coordinator needs to be started at mount
488 # the lustre conf must be without hsm on (like for sanity.sh)
489 echo "Set HSM on and start"
490 cdt_set_mount_state enabled
491 cdt_check_state enabled
493 echo "Start copytool"
496 # finished requests are quickly removed from list
497 set_hsm_param grace_delay 10
503 local f=$DIR/$tdir/$tfile
507 check_hsm_flags_user $f "0x00000000"
509 $RUNAS $LFS hsm_set --norelease $f ||
510 error "user could not change hsm flags"
511 check_hsm_flags_user $f "0x00000010"
513 $RUNAS $LFS hsm_clear --norelease $f ||
514 error "user could not clear hsm flags"
515 check_hsm_flags_user $f "0x00000000"
517 # User could not change those flags...
518 $RUNAS $LFS hsm_set --exists $f &&
519 error "user should not set this flag"
520 check_hsm_flags_user $f "0x00000000"
523 $LFS hsm_set --exists $f ||
524 error "root could not change hsm flags"
525 check_hsm_flags_user $f "0x00000001"
527 $LFS hsm_clear --exists $f ||
528 error "root could not clear hsm state"
529 check_hsm_flags_user $f "0x00000000"
532 run_test 1 "lfs hsm flags root/non-root access"
536 local f=$DIR/$tdir/$tfile
538 # New files are not dirty
539 check_hsm_flags $f "0x00000000"
541 # For test, we simulate an archived file.
542 $LFS hsm_set --exists $f || error "user could not change hsm flags"
543 check_hsm_flags $f "0x00000001"
545 # chmod do not put the file dirty
546 chmod 600 $f || error "could not chmod test file"
547 check_hsm_flags $f "0x00000001"
549 # chown do not put the file dirty
550 chown $RUNAS_ID $f || error "could not chown test file"
551 check_hsm_flags $f "0x00000001"
553 # truncate put the file dirty
554 $TRUNCATE $f 1 || error "could not truncate test file"
555 check_hsm_flags $f "0x00000003"
557 $LFS hsm_clear --dirty $f || error "could not clear hsm flags"
558 check_hsm_flags $f "0x00000001"
560 run_test 2 "Check file dirtyness when doing setattr"
566 # New files are not dirty
568 check_hsm_flags $f "0x00000000"
570 # For test, we simulate an archived file.
571 $LFS hsm_set --exists $f ||
572 error "user could not change hsm flags"
573 check_hsm_flags $f "0x00000001"
575 # Reading a file, does not set dirty
576 cat $f > /dev/null || error "could not read file"
577 check_hsm_flags $f "0x00000001"
579 # Open for write without modifying data, does not set dirty
580 openfile -f O_WRONLY $f || error "could not open test file"
581 check_hsm_flags $f "0x00000001"
583 # Append to a file sets it dirty
584 cp -p /etc/passwd $f.append || error "could not create file"
585 $LFS hsm_set --exists $f.append ||
586 error "user could not change hsm flags"
587 dd if=/etc/passwd of=$f.append bs=1 count=3\
588 conv=notrunc oflag=append status=noxfer ||
589 error "could not append to test file"
590 check_hsm_flags $f.append "0x00000003"
592 # Modify a file sets it dirty
593 cp -p /etc/passwd $f.modify || error "could not create file"
594 $LFS hsm_set --exists $f.modify ||
595 error "user could not change hsm flags"
596 dd if=/dev/zero of=$f.modify bs=1 count=3\
597 conv=notrunc status=noxfer ||
598 error "could not modify test file"
599 check_hsm_flags $f.modify "0x00000003"
601 # Open O_TRUNC sets dirty
602 cp -p /etc/passwd $f.trunc || error "could not create file"
603 $LFS hsm_set --exists $f.trunc ||
604 error "user could not change hsm flags"
605 cp /etc/group $f.trunc || error "could not override a file"
606 check_hsm_flags $f.trunc "0x00000003"
608 # Mmapped a file sets dirty
609 cp -p /etc/passwd $f.mmap || error "could not create file"
610 $LFS hsm_set --exists $f.mmap ||
611 error "user could not change hsm flags"
612 multiop $f.mmap OSMWUc || error "could not mmap a file"
613 check_hsm_flags $f.mmap "0x00000003"
615 run_test 3 "Check file dirtyness when opening for write"
619 local f=$DIR/$tdir/$tfile
620 local fid=$(make_small $f)
623 local st=$(get_request_state $fid CANCEL)
624 [[ -z "$st" ]] || error "hsm_cancel must not be registered (state=$st)"
626 run_test 4 "Useless cancel must not be registered"
629 # test needs a running copytool
633 local f=$DIR/$tdir/$tfile
634 local fid=$(copy_file /etc/passwd $f)
636 wait_request_state $fid ARCHIVE SUCCEED
638 check_hsm_flags $f "0x00000009"
642 run_test 8 "Test default archive number"
646 local f=$DIR/$tdir/$tfile
647 local fid=$(copy_file /etc/passwd $f)
648 # we do not use the default one to be sure
649 local new_an=$((HSM_ARCHIVE_NUMBER + 1))
651 copytool_setup $SINGLEAGT $MOUNT $new_an
652 $LFS hsm_archive --archive $new_an $f
653 wait_request_state $fid ARCHIVE SUCCEED
655 check_hsm_flags $f "0x00000009"
659 run_test 9 "Use of explict archive number, with dedicated copytool"
662 [[ $CLIENTCOUNT -ge 3 ]] ||
663 { skip "Need three or more clients"; return 0; }
669 copytool_cleanup $(comma_list $(agts_nodes))
671 # start all of the copytools
672 for n in $(seq $AGTCOUNT); do
676 trap "copytool_cleanup $(comma_list $(agts_nodes))" EXIT
679 for n in $(seq $AGTCOUNT); do
680 file=$DIR/$tdir/$tfile.$n
681 fid=$(make_small $file)
683 $LFS hsm_archive $file || error "could not archive file $file"
684 wait_request_state $fid ARCHIVE SUCCEED
685 check_hsm_flags $file "0x00000001"
689 copytool_cleanup $(comma_list $(agts_nodes))
691 run_test 9a "Multiple remote agents"
694 # test needs a running copytool
697 mkdir -p $DIR/$tdir/d1
698 local f=$DIR/$tdir/$tfile
699 local fid=$(copy_file /etc/hosts $f)
700 $LFS hsm_archive -a $HSM_ARCHIVE_NUMBER $f ||
701 error "hsm_archive failed"
702 wait_request_state $fid ARCHIVE SUCCEED
704 local AFILE=$(ls $HSM_ARCHIVE/*/*/*/*/*/*/$fid) ||
705 error "fid $fid not in archive $HSM_ARCHIVE"
706 echo "Verifying content"
707 diff $f $AFILE || error "archived file differs"
708 echo "Verifying hsm state "
709 check_hsm_flags $f "0x00000009"
711 echo "Verifying archive number is $HSM_ARCHIVE_NUMBER"
712 local st=$(get_hsm_archive_id $f)
713 [[ $st == $HSM_ARCHIVE_NUMBER ]] ||
714 error "Wrong archive number, $st != $HSM_ARCHIVE_NUMBER"
719 run_test 10a "Archive a file"
722 # test needs a running copytool
725 mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir
726 local f=$DIR/$tdir/$tfile
727 local fid=$(copy_file /etc/hosts $f)
728 $LFS hsm_archive $f || error "archive request failed"
729 wait_request_state $fid ARCHIVE SUCCEED
731 $LFS hsm_archive $f || error "archive of non dirty file failed"
732 local cnt=$(get_request_count $fid ARCHIVE)
733 [[ "$cnt" == "1" ]] ||
734 error "archive of non dirty file must not make a request"
738 run_test 10b "Archive of non dirty file must work without doing request"
741 # test needs a running copytool
744 mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir
745 local f=$DIR/$tdir/$tfile
746 local fid=$(copy_file /etc/hosts $f)
747 $LFS hsm_set --noarchive $f
748 $LFS hsm_archive $f && error "archive a noarchive file must fail"
752 run_test 10c "Check forbidden archive"
755 mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir
756 cp /etc/hosts $HSM_ARCHIVE/$tdir/$tfile
757 local f=$DIR/$tdir/$tfile
759 import_file $tdir/$tfile $f
760 echo -n "Verifying released state: "
761 check_hsm_flags $f "0x0000000d"
763 local LSZ=$(stat -c "%s" $f)
764 local ASZ=$(stat -c "%s" $HSM_ARCHIVE/$tdir/$tfile)
766 echo "Verifying imported size $LSZ=$ASZ"
767 [[ $LSZ -eq $ASZ ]] || error "Incorrect size $LSZ != $ASZ"
768 echo -n "Verifying released pattern: "
769 local PTRN=$($GETSTRIPE -L $f)
771 [[ $PTRN == 80000001 ]] || error "Is not released"
772 local fid=$(path2fid $f)
773 echo "Verifying new fid $fid in archive"
775 local AFILE=$(ls $HSM_ARCHIVE/*/*/*/*/*/*/$fid) ||
776 error "fid $fid not in archive $HSM_ARCHIVE"
778 run_test 11 "Import a file"
781 # test needs a running copytool
784 mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir
785 cp /etc/hosts $HSM_ARCHIVE/$tdir/$tfile
786 local f=$DIR/$tdir/$tfile
787 import_file $tdir/$tfile $f
788 local f=$DIR2/$tdir/$tfile
789 echo "Verifying released state: "
790 check_hsm_flags $f "0x0000000d"
792 local fid=$(path2fid $f)
794 wait_request_state $fid RESTORE SUCCEED
796 echo "Verifying file state: "
797 check_hsm_flags $f "0x00000009"
799 diff -q $HSM_ARCHIVE/$tdir/$tfile $f
801 [[ $? -eq 0 ]] || error "Restored file differs"
805 run_test 12a "Restore an imported file explicitly"
808 # test needs a running copytool
811 mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir
812 cp /etc/hosts $HSM_ARCHIVE/$tdir/$tfile
813 local f=$DIR/$tdir/$tfile
814 import_file $tdir/$tfile $f
815 echo "Verifying released state: "
816 check_hsm_flags $f "0x0000000d"
818 cat $f > /dev/null || error "File read failed"
820 echo "Verifying file state after restore: "
821 check_hsm_flags $f "0x00000009"
823 diff -q $HSM_ARCHIVE/$tdir/$tfile $f
825 [[ $? -eq 0 ]] || error "Restored file differs"
829 run_test 12b "Restore an imported file implicitly"
832 [ "$OSTCOUNT" -lt "2" ] && skip_env "skipping 2-stripe test" && return
834 # test needs a running copytool
838 local f=$DIR/$tdir/$tfile
839 $LFS setstripe -c 2 $f
840 local fid=$(make_large_for_striping $f)
841 local FILE_CRC=$(md5sum $f)
843 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
844 wait_request_state $fid ARCHIVE SUCCEED
845 $LFS hsm_release $f || error "release $f failed"
847 echo "$FILE_CRC" | md5sum -c
849 [[ $? -eq 0 ]] || error "Restored file differs"
853 run_test 12c "Restore a file with stripe of 2"
856 # test needs a running copytool
859 mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir
860 local f=$DIR/$tdir/$tfile
861 local fid=$(copy_file /etc/hosts $f)
862 $LFS hsm_restore $f || error "restore of non archived file failed"
863 local cnt=$(get_request_count $fid RESTORE)
864 [[ "$cnt" == "0" ]] ||
865 error "restore non archived must not make a request"
866 $LFS hsm_archive $f ||
867 error "archive request failed"
868 wait_request_state $fid ARCHIVE SUCCEED
869 $LFS hsm_restore $f ||
870 error "restore of non released file failed"
871 local cnt=$(get_request_count $fid RESTORE)
872 [[ "$cnt" == "0" ]] ||
873 error "restore a non dirty file must not make a request"
877 run_test 12d "Restore of a non archived, non released file must work"\
878 " without doing request"
881 # test needs a running copytool
884 mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir
885 local f=$DIR/$tdir/$tfile
886 local fid=$(copy_file /etc/hosts $f)
887 $LFS hsm_archive $f || error "archive request failed"
888 wait_request_state $fid ARCHIVE SUCCEED
895 $LFS hsm_restore $f && error "restore a dirty file must fail"
899 run_test 12e "Check forbidden restore"
902 # test needs a running copytool
906 local f=$DIR/$tdir/$tfile
907 local fid=$(copy_file /etc/hosts $f)
909 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
910 wait_request_state $fid ARCHIVE SUCCEED
911 $LFS hsm_release $f || error "release of $f failed"
913 wait_request_state $fid RESTORE SUCCEED
915 echo -n "Verifying file state: "
916 check_hsm_flags $f "0x00000009"
918 diff -q /etc/hosts $f
920 [[ $? -eq 0 ]] || error "Restored file differs"
924 run_test 12f "Restore a released file explicitly"
927 # test needs a running copytool
931 local f=$DIR/$tdir/$tfile
932 local fid=$(copy_file /etc/hosts $f)
934 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
935 wait_request_state $fid ARCHIVE SUCCEED
936 $LFS hsm_release $f || error "release of $f failed"
938 diff -q /etc/hosts $f
941 # we check we had a restore done
942 wait_request_state $fid RESTORE SUCCEED
944 [[ $st -eq 0 ]] || error "Restored file differs"
948 run_test 12g "Restore a released file implicitly"
951 need2clients || return 0
953 # test needs a running copytool
957 local f=$DIR/$tdir/$tfile
958 local fid=$(copy_file /etc/hosts $f)
960 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
961 wait_request_state $fid ARCHIVE SUCCEED
962 $LFS hsm_release $f || error "release of $f failed"
964 do_node $CLIENT2 diff -q /etc/hosts $f
967 # we check we had a restore done
968 wait_request_state $fid RESTORE SUCCEED
970 [[ $st -eq 0 ]] || error "Restored file differs"
974 run_test 12h "Restore a released file implicitly from a second node"
977 # test needs a running copytool
981 local f=$DIR/$tdir/$tfile
982 local fid=$(copy_file /etc/passwd $f)
983 $LFS hsm_archive $f || error "archive of $f failed"
984 wait_request_state $fid ARCHIVE SUCCEED
986 $LFS hsm_release $f || error "release of $f failed"
990 [[ $? -eq 0 ]] || error "Restored file differs"
994 run_test 12m "Archive/release/implicit restore"
997 # test needs a running copytool
1000 mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir
1001 cp /etc/hosts $HSM_ARCHIVE/$tdir/$tfile
1002 local f=$DIR/$tdir/$tfile
1003 import_file $tdir/$tfile $f
1005 cmp /etc/hosts $f || error "Restored file differs"
1007 $LFS hsm_release $f || error "release of $f failed"
1011 run_test 12n "Import/implicit restore/release"
1014 # test needs a running copytool
1017 local ARC_SUBDIR="import.orig"
1021 # populate directory to be imported
1022 for d in $(seq 1 10); do
1023 local CURR_DIR="$HSM_ARCHIVE/$ARC_SUBDIR/dir.$d"
1024 mkdir -p "$CURR_DIR"
1025 for f in $(seq 1 10); do
1026 CURR_FILE="$CURR_DIR/$tfile.$f"
1027 # write file-specific data
1028 echo "d=$d, f=$f, dir=$CURR_DIR, file=$CURR_FILE"\
1033 import_file "$ARC_SUBDIR" $DIR/$tdir
1034 # diff lustre content and origin (triggers file restoration)
1035 # there must be 10x10 identical files, and no difference
1036 local cnt_ok=$(diff -rs $HSM_ARCHIVE/$ARC_SUBDIR \
1037 $DIR/$tdir/$ARC_SUBDIR |
1038 grep identical | wc -l)
1039 local cnt_diff=$(diff -r $HSM_ARCHIVE/$ARC_SUBDIR \
1040 $DIR/$tdir/$ARC_SUBDIR |
1043 [ $cnt_diff -eq 0 ] ||
1044 error "$cnt_diff imported files differ from read data"
1045 [ $cnt_ok -eq 100 ] ||
1046 error "not enough identical files ($cnt_ok != 100)"
1050 run_test 13 "Recursively import and restore a directory"
1053 # test needs a running copytool
1058 local f=$DIR/$tdir/$tfile
1059 local fid=$(make_small $f)
1060 local sum=$(md5sum $f | awk '{print $1}')
1061 $LFS hsm_archive $f || error "could not archive file"
1062 wait_request_state $fid ARCHIVE SUCCEED
1066 # create released file (simulate llapi_hsm_import call)
1068 local fid2=$(path2fid $f)
1069 $LFS hsm_set --archived --exists $f || error "could not force hsm flags"
1070 $LFS hsm_release $f || error "could not release file"
1072 # rebind the archive to the newly created file
1073 echo "rebind $fid to $fid2"
1075 do_facet $SINGLEAGT \
1076 "$HSMTOOL --archive $HSM_ARCHIVE_NUMBER --hsm-root $HSM_ARCHIVE\
1077 --rebind $fid $fid2 $DIR" || error "could not rebind file"
1079 # restore file and compare md5sum
1080 local sum2=$(md5sum $f | awk '{print $1}')
1082 [[ $sum == $sum2 ]] || error "md5sum mismatch after restore"
1086 run_test 14 "Rebind archived file to a new fid"
1089 # test needs a running copytool
1094 local f=$DIR/$tdir/$tfile
1096 local tmpfile=$SHARED_DIRECTORY/tmp.$$
1100 for i in $(seq 1 $count); do
1101 fids[$i]=$(make_small $f.$i)
1102 sums[$i]=$(md5sum $f.$i | awk '{print $1}')
1103 $LFS hsm_archive $f.$i || error "could not archive file"
1105 wait_all_done $(($count*60))
1109 for i in $(seq 1 $count); do
1112 local fid2=$(path2fid $f.$i)
1113 # add the rebind operation to the list
1114 echo ${fids[$i]} $fid2 >> $tmpfile
1116 # set it released (simulate llapi_hsm_import call)
1117 $LFS hsm_set --archived --exists $f.$i ||
1118 error "could not force hsm flags"
1119 $LFS hsm_release $f.$i || error "could not release file"
1121 nl=$(wc -l < $tmpfile)
1122 [[ $nl == $count ]] || error "$nl files in list, $count expected"
1124 echo "rebind list of files"
1125 do_facet $SINGLEAGT \
1126 "$HSMTOOL --archive $HSM_ARCHIVE_NUMBER --hsm-root $HSM_ARCHIVE\
1127 --rebind $tmpfile $DIR" || error "could not rebind file list"
1129 # restore files and compare md5sum
1130 for i in $(seq 1 $count); do
1131 local sum2=$(md5sum $f.$i | awk '{print $1}')
1132 [[ $sum2 == ${sums[$i]} ]] ||
1133 error "md5sum mismatch after restore ($sum2 != ${sums[$i]})"
1139 run_test 15 "Rebind a list of files"
1142 # test needs a running copytool
1146 # create a known size file so we can verify transfer speed
1149 dd if=/dev/zero of=$ref bs=1M count=20
1152 local f=$DIR/$tdir/$tfile
1153 local fid=$(copy_file $ref $f)
1155 local start=$(date +%s)
1157 wait_request_state $fid ARCHIVE SUCCEED
1158 local end=$(date +%s)
1159 local duration=$((end - start))
1161 [[ $duration -ge $goal ]] ||
1162 error "Transfer is too fast $duration < $goal"
1166 run_test 16 "Test CT bandwith control option"
1171 local f=$DIR/$tdir/$tfile
1172 touch $f || error "touch $f failed"
1174 # Could not release a non-archived file
1175 $LFS hsm_release $f && error "release should not succeed"
1177 # For following tests, we must test them with HS_ARCHIVED set
1178 $LFS hsm_set --exists --archived $f || error "could not add flag"
1180 # Could not release a file if no-release is set
1181 $LFS hsm_set --norelease $f || error "could not add flag"
1182 $LFS hsm_release $f && error "release should not succeed"
1183 $LFS hsm_clear --norelease $f || error "could not remove flag"
1185 # Could not release a file if lost
1186 $LFS hsm_set --lost $f || error "could not add flag"
1187 $LFS hsm_release $f && error "release should not succeed"
1188 $LFS hsm_clear --lost $f || error "could not remove flag"
1190 # Could not release a file if dirty
1191 $LFS hsm_set --dirty $f || error "could not add flag"
1192 $LFS hsm_release $f && error "release should not succeed"
1193 $LFS hsm_clear --dirty $f || error "could not remove flag"
1195 run_test 20 "Release is not permitted"
1198 # test needs a running copytool
1202 local f=$DIR/$tdir/test_release
1204 # Create a file and check its states
1205 local fid=$(make_small $f)
1206 check_hsm_flags $f "0x00000000"
1208 $LFS hsm_archive $f || error "could not archive file"
1209 wait_request_state $fid ARCHIVE SUCCEED
1211 [ $(stat -c "%b" $f) -ne "0" ] || error "wrong block number"
1212 local sz=$(stat -c "%s" $f)
1213 [ $sz -ne "0" ] || error "file size should not be zero"
1215 # Release and check states
1216 $LFS hsm_release $f || error "could not release file"
1217 check_hsm_flags $f "0x0000000d"
1219 [ $(stat -c "%b" $f) -eq "0" ] || error "wrong block number"
1220 [ $(stat -c "%s" $f) -eq $sz ] || error "wrong file size"
1222 # Check we can release an file without stripe info
1226 check_hsm_flags $f "0x00000000"
1227 $LFS hsm_archive $f || error "could not archive file"
1228 wait_request_state $fid ARCHIVE SUCCEED
1230 # Release and check states
1231 $LFS hsm_release $f || error "could not release file"
1232 check_hsm_flags $f "0x0000000d"
1234 # Release again a file that is already released is OK
1235 $LFS hsm_release $f || fail "second release should succeed"
1236 check_hsm_flags $f "0x0000000d"
1240 run_test 21 "Simple release tests"
1243 # test needs a running copytool
1248 local f=$DIR/$tdir/test_release
1249 local swap=$DIR/$tdir/test_swap
1251 # Create a file and check its states
1252 local fid=$(make_small $f)
1253 check_hsm_flags $f "0x00000000"
1255 $LFS hsm_archive $f || error "could not archive file"
1256 wait_request_state $fid ARCHIVE SUCCEED
1258 # Release and check states
1259 $LFS hsm_release $f || error "could not release file"
1260 check_hsm_flags $f "0x0000000d"
1263 $LFS swap_layouts $swap $f && error "swap_layouts should failed"
1268 run_test 22 "Could not swap a release file"
1271 # test needs a running copytool
1276 local f=$DIR/$tdir/test_mtime
1278 # Create a file and check its states
1279 local fid=$(make_small $f)
1280 check_hsm_flags $f "0x00000000"
1282 $LFS hsm_archive $f || error "could not archive file"
1283 wait_request_state $fid ARCHIVE SUCCEED
1285 # Set modification time in the past
1286 touch -m -a -d @978261179 $f
1288 # Release and check states
1289 $LFS hsm_release $f || error "could not release file"
1290 check_hsm_flags $f "0x0000000d"
1292 local MTIME=$(stat -c "%Y" $f)
1293 local ATIME=$(stat -c "%X" $f)
1294 [ $MTIME -eq "978261179" ] || fail "bad mtime: $MTIME"
1295 [ $ATIME -eq "978261179" ] || fail "bad atime: $ATIME"
1299 run_test 23 "Release does not change a/mtime (utime)"
1302 # test needs a running copytool
1307 local f=$DIR/$tdir/test_mtime
1309 # Create a file and check its states
1310 local fid=$(make_small $f)
1311 check_hsm_flags $f "0x00000000"
1313 # make mtime is different
1316 local MTIME=$(stat -c "%Y" $f)
1317 local ATIME=$(stat -c "%X" $f)
1319 $LFS hsm_archive $f || error "could not archive file"
1320 wait_request_state $fid ARCHIVE SUCCEED
1322 # Release and check states
1323 $LFS hsm_release $f || error "could not release file"
1324 check_hsm_flags $f "0x0000000d"
1326 [ "$(stat -c "%Y" $f)" -eq "$MTIME" ] ||
1327 error "mtime should be $MTIME"
1329 [ "$(stat -c "%X" $f)" -eq "$ATIME" ] ||
1330 error "atime should be $ATIME"
1334 run_test 24 "Release does not change a/mtime (i/o)"
1337 # test needs a running copytool
1340 mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir
1341 cp /etc/hosts $HSM_ARCHIVE/$tdir/$tfile
1342 local f=$DIR/$tdir/$tfile
1344 import_file $tdir/$tfile $f
1346 $LFS hsm_set --lost $f
1351 [[ $st == 1 ]] || error "lost file access should failed (returns $st)"
1355 run_test 25a "Restore lost file (HS_LOST flag) from import"\
1356 " (Operation not permitted)"
1359 # test needs a running copytool
1364 local f=$DIR/$tdir/$tfile
1365 local fid=$(copy_file /etc/passwd $f)
1367 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
1368 wait_request_state $fid ARCHIVE SUCCEED
1371 $LFS hsm_set --lost $f
1375 [[ $st == 1 ]] || error "lost file access should failed (returns $st)"
1379 run_test 25b "Restore lost file (HS_LOST flag) after release"\
1380 " (Operation not permitted)"
1383 # test needs a running copytool
1387 local f=$DIR/$tdir/$tfile
1388 local fid=$(make_large_for_progress $f)
1389 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
1390 wait_request_state $fid ARCHIVE SUCCEED
1393 wait_request_state $fid REMOVE SUCCEED
1395 check_hsm_flags $f "0x00000000"
1399 run_test 26 "Remove the archive of a valid file"
1402 # test needs a running copytool
1406 make_archive $tdir/$tfile
1407 local f=$DIR/$tdir/$tfile
1408 import_file $tdir/$tfile $f
1409 local fid=$(path2fid $f)
1413 [[ $? != 0 ]] || error "Remove of a released file should fail"
1417 run_test 27a "Remove the archive of an imported file (Operation not permitted)"
1420 # test needs a running copytool
1424 local f=$DIR/$tdir/$tfile
1425 local fid=$(make_large_for_progress $f)
1426 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
1427 wait_request_state $fid ARCHIVE SUCCEED
1432 [[ $? != 0 ]] || error "Remove of a released file should fail"
1436 run_test 27b "Remove the archive of a relased file (Operation not permitted)"
1439 # test needs a running copytool
1443 local f=$DIR/$tdir/$tfile
1444 local fid=$(make_large_for_progress $f)
1445 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
1446 wait_request_state $fid ARCHIVE SUCCEED
1455 wait_request_state $fid REMOVE SUCCEED
1459 run_test 28 "Concurrent archive/file remove"
1462 # restore at exec cannot work on agent node (because of Linux kernel
1463 # protection of executables)
1464 need2clients || return 0
1466 # test needs a running copytool
1469 mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir
1470 cp -p /bin/true $HSM_ARCHIVE/$tdir/$tfile
1471 local f=$DIR/$tdir/true
1472 import_file $tdir/$tfile $f
1474 local fid=$(path2fid $f)
1476 # set no retry action mode
1482 # remove no try action mode
1486 [[ $st == 0 ]] || error "Failed to exec a released file"
1490 run_test 30a "Restore at exec (import case)"
1493 # restore at exec cannot work on agent node (because of Linux kernel
1494 # protection of executables)
1495 need2clients || return 0
1497 # test needs a running copytool
1501 local f=$DIR/$tdir/true
1502 local fid=$(copy_file /bin/true $f)
1504 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
1505 wait_request_state $fid ARCHIVE SUCCEED
1508 # set no retry action mode
1514 # remove no try action mode
1518 [[ $st == 0 ]] || error "Failed to exec a released file"
1522 run_test 30b "Restore at exec (release case)"
1524 restore_and_check_size() {
1527 local s=$(stat -c "%s" $f)
1529 local st=$(get_hsm_flags $f)
1533 while [[ "$st" != "0x00000009" && $cpt -le 10 ]]
1535 n=$(stat -c "%s" $f)
1536 # we echo in both cases to show stat is not
1540 echo "size seen is $n != $s"
1543 echo "size seen is right: $n == $s"
1545 st=$(get_hsm_flags $f)
1549 if [[ $cpt -lt 10 ]]
1551 echo " restore is too long"
1555 wait_request_state $fid RESTORE SUCCEED
1560 # test needs a running copytool
1565 make_archive $tdir/$tfile
1566 local f=$DIR/$tdir/$tfile
1567 import_file $tdir/$tfile $f
1568 local fid=$($LFS path2fid $f)
1569 HSM_ARCHIVE_PURGE=false copytool_setup
1571 restore_and_check_size $f $fid
1574 [[ $err -eq 0 ]] || error "File size changed during restore"
1578 run_test 31a "Import a large file and check size during restore"
1582 # test needs a running copytool
1587 local f=$DIR/$tdir/$tfile
1588 local fid=$(make_large_for_progress $f)
1589 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
1590 wait_request_state $fid ARCHIVE SUCCEED
1593 restore_and_check_size $f $fid
1596 [[ $err -eq 0 ]] || error "File size changed during restore"
1600 run_test 31b "Restore a large unaligned file and check size during restore"
1603 # test needs a running copytool
1608 local f=$DIR/$tdir/$tfile
1609 local fid=$(make_large_for_progress_aligned $f)
1610 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
1611 wait_request_state $fid ARCHIVE SUCCEED
1614 restore_and_check_size $f $fid
1617 [[ $err -eq 0 ]] || error "File size changed during restore"
1621 run_test 31c "Restore a large aligned file and check size during restore"
1624 # test needs a running copytool
1629 local f=$DIR/$tdir/$tfile
1630 local fid=$(make_large_for_progress $f)
1631 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
1632 wait_request_state $fid ARCHIVE SUCCEED
1635 md5sum $f >/dev/null &
1637 wait_request_state $fid RESTORE STARTED
1642 # Check restore trigger process was killed
1643 local killed=$(ps -o pid,comm hp $pid >/dev/null)
1647 wait_request_state $fid RESTORE CANCELED
1648 wait_request_state $fid CANCEL SUCCEED
1651 error "Cannot kill process waiting for restore ($killed)"
1655 run_test 33 "Kill a restore waiting process"
1658 # test needs a running copytool
1663 local f=$DIR/$tdir/$tfile
1664 local fid=$(make_large_for_progress $f)
1665 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
1666 wait_request_state $fid ARCHIVE SUCCEED
1669 md5sum $f >/dev/null &
1671 wait_request_state $fid RESTORE STARTED
1673 rm $f || error "rm $f failed"
1674 # rm must not block during restore
1675 wait_request_state $fid RESTORE STARTED
1677 wait_request_state $fid RESTORE SUCCEED
1678 # check md5sum pgm finished
1679 local there=$(ps -o pid,comm hp $pid >/dev/null)
1680 [[ -z $there ]] || error "Restore initiator does not exit"
1682 local rc=$(wait $pid)
1683 [[ $rc -eq 0 ]] || error "Restore initiator failed with $rc"
1687 run_test 34 "Remove file during restore"
1690 # test needs a running copytool
1695 local f=$DIR/$tdir/$tfile
1696 local f1=$DIR/$tdir/$tfile-1
1697 local fid=$(make_large_for_progress $f)
1698 local fid1=$(copy_file /etc/passwd $f1)
1699 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
1700 wait_request_state $fid ARCHIVE SUCCEED
1703 md5sum $f >/dev/null &
1705 wait_request_state $fid RESTORE STARTED
1707 mv $f1 $f || error "mv $f1 $f failed"
1708 # mv must not block during restore
1709 wait_request_state $fid RESTORE STARTED
1711 wait_request_state $fid RESTORE SUCCEED
1712 # check md5sum pgm finished
1713 local there=$(ps -o pid,comm hp $pid >/dev/null)
1714 [[ -z $there ]] || error "Restore initiator does not exit"
1716 local rc=$(wait $pid)
1717 [[ $rc -eq 0 ]] || error "Restore initiator failed with $rc"
1720 [[ $fid2 == $fid1 ]] || error "Wrong fid after mv $fid2 != $fid1"
1724 run_test 35 "Overwrite file during restore"
1727 # test needs a running copytool
1732 local f=$DIR/$tdir/$tfile
1733 local fid=$(make_large_for_progress $f)
1734 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
1735 wait_request_state $fid ARCHIVE SUCCEED
1738 md5sum $f >/dev/null &
1740 wait_request_state $fid RESTORE STARTED
1743 # rm must not block during restore
1744 wait_request_state $fid RESTORE STARTED
1746 wait_request_state $fid RESTORE SUCCEED
1747 # check md5sum pgm finished
1748 local there=$(ps -o pid,comm hp $pid >/dev/null)
1750 error "Restore initiator does not exit"
1752 local rc=$(wait $pid)
1754 error "Restore initiator failed with $rc"
1758 run_test 36 "Move file during restore"
1765 for n in $(seq 1 $count); do
1766 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $prefix.$n
1768 echo "$count archive requests submitted"
1772 local stream_count=4
1773 local file_count=100
1775 local f=$DIR/$tdir/$tfile
1780 for i in $(seq 1 $file_count); do
1781 for p in $(seq 1 $stream_count); do
1782 fid=$(copy_file /etc/hosts $f.$p.$i)
1786 # to be sure wait_all_done will not be mislead by previous tests
1788 wait_for_grace_delay
1790 # start archive streams in background (archive files in parallel)
1791 for p in $(seq 1 $stream_count); do
1792 multi_archive $f.$p $file_count &
1795 echo -n "Wait for all requests being enqueued..."
1801 run_test 40 "Parallel archive requests"
1804 # test needs a running copytool
1808 local f=$DIR/$tdir/$tfile
1809 local fid=$(copy_file /etc/motd $f 1)
1811 $LFS hsm_archive $f || error "could not archive file"
1812 wait_request_state $fid ARCHIVE SUCCEED
1813 check_hsm_flags $f "0x00000009"
1815 multiop_bg_pause $f O_c || error "multiop failed"
1819 client_up || client_up || true
1821 kill -USR1 $MULTIPID
1822 wait $MULTIPID || error "multiop close failed"
1824 check_hsm_flags $f "0x0000000b"
1828 run_test 52 "Opened for write file on an evicted client should be set dirty"
1831 # test needs a running copytool
1835 local f=$DIR/$tdir/$tfile
1836 local fid=$(copy_file /etc/motd $f 1)
1838 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f ||
1839 error "could not archive file"
1840 wait_request_state $fid ARCHIVE SUCCEED
1841 check_hsm_flags $f "0x00000009"
1843 multiop_bg_pause $f o_c || error "multiop failed"
1847 client_up || client_up || true
1849 kill -USR1 $MULTIPID
1850 wait $MULTIPID || error "multiop close failed"
1852 check_hsm_flags $f "0x00000009"
1856 run_test 53 "Opened for read file on an evicted client should not be set dirty"
1859 # test needs a running copytool
1863 local f=$DIR/$tdir/$tfile
1864 local fid=$(make_small $f)
1866 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f ||
1867 error "could not archive file"
1868 wait_request_state $fid ARCHIVE STARTED
1870 check_hsm_flags $f "0x00000001"
1872 # Avoid coordinator resending this request as soon it has failed.
1877 wait_request_state $fid ARCHIVE FAILED
1879 check_hsm_flags $f "0x00000003"
1884 run_test 54 "Write during an archive cancels it"
1887 # test needs a running copytool
1891 local f=$DIR/$tdir/$tfile
1892 local fid=$(make_small $f)
1894 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f ||
1895 error "could not archive file"
1896 wait_request_state $fid ARCHIVE STARTED
1898 check_hsm_flags $f "0x00000001"
1900 # Avoid coordinator resending this request as soon it has failed.
1903 $TRUNCATE $f 1024 || error "truncate failed"
1905 wait_request_state $fid ARCHIVE FAILED
1907 check_hsm_flags $f "0x00000003"
1912 run_test 55 "Truncate during an archive cancels it"
1915 # test needs a running copytool
1919 local f=$DIR/$tdir/$tfile
1920 local fid=$(make_large_for_progress $f)
1922 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f ||
1923 error "could not archive file"
1924 wait_request_state $fid ARCHIVE STARTED
1926 check_hsm_flags $f "0x00000001"
1928 # Change metadata and sync to be sure we are not changing only
1933 wait_request_state $fid ARCHIVE SUCCEED
1935 check_hsm_flags $f "0x00000009"
1939 run_test 56 "Setattr during an archive is ok"
1942 # Need one client for I/O, one for request
1943 need2clients || return 0
1945 # test needs a running copytool
1949 local f=$DIR/$tdir/test_archive_remote
1950 # Create a file on a remote node
1951 do_node $CLIENT2 "dd if=/dev/urandom of=$f bs=1M "\
1952 "count=2 conv=fsync"
1955 do_node $CLIENT2 "$LFS hsm_archive -a $HSM_ARCHIVE_NUMBER $f" ||
1956 error "hsm_archive failed"
1957 local fid=$(path2fid $f)
1958 wait_request_state $fid ARCHIVE SUCCEED
1960 # Release and implicit restore it
1961 do_node $CLIENT2 "$LFS hsm_release $f" ||
1962 error "hsm_release failed"
1963 do_node $CLIENT2 "md5sum $f" ||
1964 error "hsm_restore failed"
1966 wait_request_state $fid RESTORE SUCCEED
1970 run_test 57 "Archive a file with dirty cache on another node"
1973 # test needs a running copytool
1977 local f=$DIR/$tdir/$tfile
1978 local fid=$(make_small $f)
1980 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f ||
1981 error "could not archive file"
1982 wait_request_state $fid ARCHIVE SUCCEED
1984 $LFS hsm_release $f || error "could not release file"
1986 $TRUNCATE $f 0 || error "truncate failed"
1989 local sz=$(stat -c %s $f)
1990 [[ $sz == 0 ]] || error "size after truncate is $sz != 0"
1994 check_hsm_flags $f "0x0000000b"
1996 local state=$(get_request_state $fid RESTORE)
1997 [[ "$state" == "" ]] ||
1998 error "truncate 0 trigs a restore, state = $state"
2002 run_test 58 "Truncate 0 on a released file must not trigger restore"
2005 # test needs a running copytool
2009 local f=$DIR/$tdir/$tfile
2010 local fid=$(copy_file /etc/passwd $f)
2013 local sz=$(stat -c %s $ref)
2017 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f ||
2018 error "could not archive file"
2019 wait_request_state $fid ARCHIVE SUCCEED
2021 $LFS hsm_release $f || error "could not release file"
2023 $TRUNCATE $f $sz || error "truncate failed"
2026 local sz1=$(stat -c %s $f)
2027 [[ $sz1 == $sz ]] || error "size after truncate is $sz1 != $sz"
2031 check_hsm_flags $f "0x0000000b"
2033 local state=$(get_request_state $fid RESTORE)
2034 [[ "$state" == "SUCCEED" ]] ||
2035 error "truncate $sz does not trig a successfull restore,"\
2038 cmp $ref $f || error "file data wrong after truncate"
2042 run_test 59 "Truncate != 0 on a released file"
2047 local f=$DIR/$tdir/$tfile
2048 local FILELIST=/tmp/filelist.txt
2052 for i in $(seq 1 $file_count); do
2053 fid=$(copy_file /etc/hosts $f.$i)
2054 echo $f.$i >> $FILELIST
2057 # to be sure wait_all_done will not be mislead by previous tests
2059 wait_for_grace_delay
2060 $LFS hsm_archive --filelist $FILELIST ||
2061 error "cannot archive a file list"
2063 $LFS hsm_release --filelist $FILELIST ||
2064 error "cannot release a file list"
2065 $LFS hsm_restore --filelist $FILELIST ||
2066 error "cannot restore a file list"
2070 run_test 90 "Archive/restore a file list"
2072 double_verify_reset_ham_param() {
2074 echo "Testing $HSM_PARAM.$p"
2075 local val=$(get_hsm_param $p)
2077 local val2=$(($val * 2))
2078 set_hsm_param $p $val2
2079 val=$(get_hsm_param $p)
2080 [[ $val == $val2 ]] ||
2081 error "$HSM_PARAM.$p: $val != $val2 should be (2 * $save)"
2082 echo "Set $p to 0 must failed"
2086 set_hsm_param $p $save
2090 error "we must not be able to set $HSM_PARAM.$p to 0"
2095 double_verify_reset_ham_param loop_period
2096 double_verify_reset_ham_param grace_delay
2097 double_verify_reset_ham_param request_timeout
2098 double_verify_reset_ham_param max_requests
2100 run_test 100 "Set coordinator /proc tunables"
2107 run_test 102 "Verify coordinator control"
2110 # test needs a running copytool
2117 for i in $(seq 1 20); do
2118 fid=$(copy_file /etc/passwd $DIR/$tdir/$i)
2120 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $DIR/$tdir/*
2124 echo "Current requests"
2125 local res=$(do_facet $SINGLEMDS "$LCTL get_param -n\
2126 $HSM_PARAM.agent_actions |\
2127 grep -v CANCELED | grep -v SUCCEED | grep -v FAILED")
2129 [[ -z "$res" ]] || error "Some request have not been canceled"
2133 run_test 103 "Purge all requests"
2138 # test needs a running copytool
2142 local f=$DIR/$tdir/$tfile
2143 local fid=$(make_large_for_progress $f)
2144 # if cdt is on, it can serve too quickly the request
2146 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER --data $DATA $f
2147 local data1=$(do_facet $SINGLEMDS "$LCTL get_param -n\
2148 $HSM_PARAM.agent_actions |\
2149 grep $fid | cut -f16 -d=")
2152 [[ "$data1" == "$DATAHEX" ]] ||
2153 error "Data field in records is ($data1) and not ($DATAHEX)"
2157 run_test 104 "Copy tool data field"
2164 for i in $(seq -w 1 10); do
2165 cp /etc/passwd $DIR/$tdir/$i
2166 $LFS hsm_archive $DIR/$tdir/$i
2168 local reqcnt1=$(do_facet $SINGLEMDS "$LCTL get_param -n\
2169 $HSM_PARAM.agent_actions |\
2170 grep WAITING | wc -l")
2173 local reqcnt2=$(do_facet $SINGLEMDS "$LCTL get_param -n\
2174 $HSM_PARAM.agent_actions |\
2175 grep WAITING | wc -l")
2178 [[ "$reqcnt1" == "$reqcnt2" ]] ||
2179 error "Requests count after shutdown $reqcnt2 != "\
2180 "before shutdown $reqcnt1"
2182 run_test 105 "Restart of coordinator"
2185 # test needs a running copytool
2188 local uuid=$(do_rpc_nodes $(facet_active_host $SINGLEAGT) \
2189 get_client_uuid | cut -d' ' -f2)
2190 local agent=$(do_facet $SINGLEMDS $LCTL get_param -n $HSM_PARAM.agents |
2193 [[ ! -z "$agent" ]] || error "My uuid $uuid not found in agent list"
2194 local agent=$(do_facet $SINGLEMDS $LCTL get_param -n $HSM_PARAM.agents |
2196 [[ -z "$agent" ]] ||
2197 error "My uuid $uuid still found in agent list,"\
2198 " after copytool shutdown"
2200 local agent=$(do_facet $SINGLEMDS $LCTL get_param -n $HSM_PARAM.agents |
2203 [[ ! -z "$agent" ]] ||
2204 error "My uuid $uuid not found in agent list after"\
2207 run_test 106 "Copytool register/unregister"
2210 # test needs a running copytool
2212 # create and archive file
2214 local f1=$DIR/$tdir/$tfile
2215 local fid=$(copy_file /etc/passwd $f1)
2216 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f1
2217 wait_request_state $fid ARCHIVE SUCCEED
2218 # shutdown and restart MDS
2220 # check the copytool still gets messages from MDT
2221 local f2=$DIR/$tdir/2
2222 local fid=$(copy_file /etc/passwd $f2)
2223 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f2
2224 # main check of this sanity: this request MUST succeed
2225 wait_request_state $fid ARCHIVE SUCCEED
2228 run_test 107 "Copytool re-register after MDS restart"
2231 # test needs a running copytool
2234 mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir
2235 cp /etc/passwd $HSM_ARCHIVE/$tdir/$tfile
2236 local f=$DIR/$tdir/$tfile
2237 import_file $tdir/$tfile $f
2238 local fid=$(path2fid $f)
2240 cdt_set_no_blocking_restore
2245 wait_request_state $fid RESTORE SUCCEED
2246 cdt_clear_no_blocking_restore
2250 error "md5sum returns $st != 1, "\
2251 "should also perror ENODATA (No data available)"
2255 run_test 110a "Non blocking restore policy (import case)"
2258 # test needs a running copytool
2262 local f=$DIR/$tdir/$tfile
2263 local fid=$(copy_file /etc/passwd $f)
2264 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
2265 wait_request_state $fid ARCHIVE SUCCEED
2268 cdt_set_no_blocking_restore
2273 wait_request_state $fid RESTORE SUCCEED
2274 cdt_clear_no_blocking_restore
2278 error "md5sum returns $st != 1, "\
2279 "should also perror ENODATA (No data available)"
2283 run_test 110b "Non blocking restore policy (release case)"
2286 # test needs a running copytool
2289 mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir
2290 local f=$DIR/$tdir/$tfile
2291 cp /etc/passwd $HSM_ARCHIVE/$tdir/$tfile
2292 import_file $tdir/$tfile $f
2293 local fid=$(path2fid $f)
2297 copytool_remove_backend $fid
2300 wait_request_state $fid RESTORE FAILED
2307 [[ $st == 0 ]] || error "Restore does not failed"
2311 run_test 111a "No retry policy (import case), restore will error"\
2312 " (No such file or directory)"
2315 # test needs a running copytool
2319 local f=$DIR/$tdir/$tfile
2320 local fid=$(copy_file /etc/passwd $f)
2322 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
2323 wait_request_state $fid ARCHIVE SUCCEED
2326 copytool_remove_backend $fid
2329 wait_request_state $fid RESTORE FAILED
2336 [[ $st == 0 ]] || error "Restore does not failed"
2340 run_test 111b "No retry policy (release case), restore will error"\
2341 " (No such file or directory)"
2344 # test needs a running copytool
2348 local f=$DIR/$tdir/$tfile
2349 local fid=$(copy_file /etc/passwd $f)
2351 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
2352 local l=$($LFS hsm_action $f)
2354 local res=$(echo $l | cut -f 2- -d" " | grep ARCHIVE)
2358 wait_request_state $fid ARCHIVE SUCCEED
2361 [[ ! -z "$res" ]] || error "action is $l which is not an ARCHIVE"
2365 run_test 112 "State of recorded request"
2368 # test needs a running copytool
2372 local f=$DIR/$tdir/$tfile
2373 local fid=$(make_large_for_cancel $f)
2374 # test with cdt on is made in test_221
2376 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
2379 wait_request_state $fid ARCHIVE CANCELED
2380 wait_request_state $fid CANCEL SUCCEED
2384 run_test 200 "Register/Cancel archive"
2387 # test needs a running copytool
2391 local f=$DIR/$tdir/$tfile
2392 make_archive $tdir/$tfile
2393 import_file $tdir/$tfile $f
2394 local fid=$(path2fid $f)
2396 # test with cdt on is made in test_222
2401 wait_request_state $fid RESTORE CANCELED
2402 wait_request_state $fid CANCEL SUCCEED
2406 run_test 201 "Register/Cancel restore"
2409 # test needs a running copytool
2413 local f=$DIR/$tdir/$tfile
2414 local fid=$(make_large_for_progress $f)
2415 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
2416 wait_request_state $fid ARCHIVE SUCCEED
2422 wait_request_state $fid REMOVE CANCELED
2426 run_test 202 "Register/Cancel remove"
2429 # test needs a running copytool
2434 local f=$DIR/$tdir/$tfile
2435 local fid=$(copy_file /etc/passwd $f)
2439 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
2440 wait_request_state $fid ARCHIVE SUCCEED
2442 local flags=$(changelog_get_flags $MDT0 HSM $fid | tail -1)
2446 [[ $flags == $target ]] || error "Changelog flag is $flags not $target"
2450 run_test 220 "Changelog for archive"
2453 # test needs a running copytool
2458 local f=$DIR/$tdir/$tfile
2459 local fid=$(make_large_for_cancel $f)
2463 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
2464 wait_request_state $fid ARCHIVE STARTED
2466 wait_request_state $fid ARCHIVE CANCELED
2467 wait_request_state $fid CANCEL SUCCEED
2469 local flags=$(changelog_get_flags $MDT0 HSM $fid | tail -1)
2472 [[ $flags == $target ]] || error "Changelog flag is $flags not $target"
2476 run_test 221 "Changelog for archive canceled"
2479 # test needs a running copytool
2482 mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir
2483 local f=$DIR/$tdir/$tfile
2484 cp /etc/passwd $HSM_ARCHIVE/$tdir/$tfile
2485 import_file $tdir/$tfile $f
2486 local fid=$(path2fid $f)
2491 wait_request_state $fid RESTORE SUCCEED
2493 local flags=$(changelog_get_flags $MDT0 HSM $fid | tail -1)
2496 [[ $flags == $target ]] || error "Changelog flag is $flags not $target"
2500 run_test 222a "Changelog for explicit restore"
2503 # test needs a running copytool
2507 local f=$DIR/$tdir/$tfile
2508 local fid=$(copy_file /etc/passwd $f)
2511 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
2512 wait_request_state $fid ARCHIVE SUCCEED
2517 wait_request_state $fid RESTORE SUCCEED
2519 local flags=$(changelog_get_flags $MDT0 HSM $fid | tail -1)
2522 [[ $flags == $target ]] || error "Changelog flag is $flags not $target"
2526 run_test 222b "Changelog for implicit restore"
2529 # test needs a running copytool
2534 local f=$DIR/$tdir/$tfile
2535 make_archive $tdir/$tfile
2539 import_file $tdir/$tfile $f
2540 local fid=$(path2fid $f)
2543 wait_request_state $fid RESTORE STARTED
2545 wait_request_state $fid RESTORE CANCELED
2546 wait_request_state $fid CANCEL SUCCEED
2548 local flags=$(changelog_get_flags $MDT0 HSM $fid | tail -1)
2551 [[ $flags == $target ]] ||
2552 error "Changelog flag is $flags not $target"
2556 run_test 223a "Changelog for restore canceled (import case)"
2559 # test needs a running copytool
2564 local f=$DIR/$tdir/$tfile
2565 local fid=$(make_large_for_progress $f)
2568 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
2569 wait_request_state $fid ARCHIVE SUCCEED
2572 wait_request_state $fid RESTORE STARTED
2574 wait_request_state $fid RESTORE CANCELED
2575 wait_request_state $fid CANCEL SUCCEED
2577 local flags=$(changelog_get_flags $MDT0 HSM $fid | tail -1)
2580 [[ $flags == $target ]] ||
2581 error "Changelog flag is $flags not $target"
2585 run_test 223b "Changelog for restore canceled (release case)"
2588 # test needs a running copytool
2593 local f=$DIR/$tdir/$tfile
2594 local fid=$(copy_file /etc/passwd $f)
2597 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
2598 wait_request_state $fid ARCHIVE SUCCEED
2601 wait_request_state $fid REMOVE SUCCEED
2603 local flags=$(changelog_get_flags $MDT0 HSM $fid | tail -1)
2606 [[ $flags == $target ]] ||
2607 error "Changelog flag is $flags not $target"
2611 run_test 224 "Changelog for remove"
2614 # test needs a running copytool
2617 # test is not usable because remove request is too fast
2618 # so it is always finished before cancel can be done ...
2619 echo "Test disabled"
2624 local f=$DIR/$tdir/$tfile
2625 local fid=$(make_large_for_progress $f)
2628 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
2629 wait_request_state $fid ARCHIVE SUCCEED
2631 # if cdt is on, it can serve too quickly the request
2636 wait_request_state $fid REMOVE CANCELED
2637 wait_request_state $fid CANCEL SUCCEED
2639 flags=$(changelog_get_flags $MDT0 RENME $fid2)
2640 local flags=$($LFS changelog $MDT0 | grep HSM | grep $fid | tail -1 |
2644 [[ $flags == $target ]] ||
2645 error "Changelog flag is $flags not $target"
2649 run_test 225 "Changelog for remove canceled"
2652 # test needs a running copytool
2657 local f1=$DIR/$tdir/$tfile-1
2658 local f2=$DIR/$tdir/$tfile-2
2659 local f3=$DIR/$tdir/$tfile-3
2660 local fid1=$(copy_file /etc/passwd $f1)
2661 local fid2=$(copy_file /etc/passwd $f2)
2662 copy_file /etc/passwd $f3
2665 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f1
2666 wait_request_state $fid1 ARCHIVE SUCCEED
2668 $LFS hsm_archive $f2
2669 wait_request_state $fid2 ARCHIVE SUCCEED
2671 rm $f1 || error "rm $f1 failed"
2673 local flags=$(changelog_get_flags $MDT0 UNLNK $fid1)
2676 [[ $flags == $target ]] ||
2677 error "Changelog flag is $flags not $target"
2679 mv $f3 $f2 || error "mv $f3 $f2 failed"
2681 flags=$(changelog_get_flags $MDT0 RENME $fid2)
2684 [[ $flags == $target ]] ||
2685 error "Changelog flag is $flags not $target"
2689 run_test 226 "changelog for last rm/mv with exiting archive"
2691 check_flags_changes() {
2699 $LFS hsm_set --$hsm_flag $f ||
2700 error "Cannot set $hsm_flag on $f"
2701 local flags=($(changelog_get_flags $MDT0 HSM $fid))
2702 local seen=${#flags[*]}
2704 [[ $seen == $cnt ]] ||
2705 error "set $hsm_flag: Changelog events $seen != $cnt"
2706 [[ ${flags[$((cnt - 1))]} == $target ]] ||
2707 error "set $hsm_flag: Changelog flags are "\
2708 "${flags[$((cnt - 1))]} not $target"
2710 $LFS hsm_clear --$hsm_flag $f ||
2711 error "Cannot clear $hsm_flag on $f"
2712 flags=($(changelog_get_flags $MDT0 HSM $fid))
2715 [[ $cnt == $seen ]] ||
2716 error "clear $hsm_flag: Changelog events $seen != $cnt"
2718 [[ ${flags[$((cnt - 1))]} == $target ]] ||
2719 error "clear $hsm_flag: Changelog flag is "\
2720 "${flags[$((cnt - 1))]} not $target"
2724 # test needs a running copytool
2731 for i in norelease noarchive exists archived
2733 local f=$DIR/$tdir/$tfile-$i
2734 local fid=$(copy_file /etc/passwd $f)
2735 check_flags_changes $f $fid $i 0 1
2738 f=$DIR/$tdir/$tfile---lost
2739 fid=$(copy_file /etc/passwd $f)
2740 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
2741 wait_request_state $fid ARCHIVE SUCCEED
2742 check_flags_changes $f $fid lost 3 1
2746 run_test 227 "changelog when explicit setting of HSM flags"
2749 # test needs a running copytool
2753 local maxrequest=$(get_hsm_param max_requests)
2754 local rqcnt=$(($maxrequest * 3))
2758 for i in $(seq -w 1 $rqcnt); do
2760 dd if=/dev/urandom of=$DIR/$tdir/$i bs=1M count=10 conv=fsync
2762 # we do it in 2 steps, so all requests arrive at the same time
2763 for i in $(seq -w 1 $rqcnt); do
2764 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $DIR/$tdir/$i
2769 while [[ $cnt != 0 || $wt != 0 ]]; do
2771 cnt=$(do_facet $SINGLEMDS "$LCTL get_param -n\
2772 $HSM_PARAM.agent_actions |\
2773 grep STARTED | grep -v CANCEL | wc -l")
2774 [[ $cnt -le $maxrequest ]] ||
2775 error "$cnt > $maxrequest too many started requests"
2776 wt=$(do_facet $SINGLEMDS "$LCTL get_param\
2777 $HSM_PARAM.agent_actions |\
2778 grep WAITING | wc -l")
2779 echo "max=$maxrequest started=$cnt waiting=$wt"
2784 run_test 250 "Coordinator max request"
2787 # test needs a running copytool
2791 local f=$DIR/$tdir/$tfile
2792 local fid=$(make_large_for_cancel $f)
2795 # to have a short test
2796 local old_to=$(get_hsm_param request_timeout)
2797 set_hsm_param request_timeout 4
2798 # to be sure the cdt will wake up frequently so
2799 # it will be able to cancel the "old" request
2800 local old_loop=$(get_hsm_param loop_period)
2801 set_hsm_param loop_period 2
2804 $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
2805 wait_request_state $fid ARCHIVE STARTED
2807 wait_request_state $fid ARCHIVE CANCELED
2809 set_hsm_param request_timeout $old_to
2810 set_hsm_param loop_period $old_loop
2814 run_test 251 "Coordinator request timeout"
2817 # the only way to test ondisk conf is to restart MDS ...
2818 echo "Stop coordinator and remove coordinator state at mount"
2821 # clean on disk conf set by default
2822 cdt_clear_mount_state
2823 cdt_check_state stopped
2825 # check cdt still off after umount/remount
2827 cdt_check_state stopped
2829 echo "Set coordinator start at mount, and start coordinator"
2830 cdt_set_mount_state enabled
2833 cdt_check_state enabled
2835 # check cdt still on after umount/remount
2837 cdt_check_state enabled
2839 # we are back to original state (cdt started at mount)
2841 run_test 300 "On disk coordinator state kept between MDT umount/mount"
2846 check_and_cleanup_lustre