get_hsm_flags() {
local f=$1
local u=$2
+ local st
if [[ $u == "user" ]]; then
- local st=$($RUNAS $LFS hsm_state $f)
+ st=$($RUNAS $LFS hsm_state $f)
else
- local st=$($LFS hsm_state $f)
u=root
+ st=$($LFS hsm_state $f)
fi
[[ $? == 0 ]] || error "$LFS hsm_state $f failed (run as $u)"
get_hsm_archive_id() {
local f=$1
- local st=$($LFS hsm_state $f)
+ local st
+ st=$($LFS hsm_state $f)
[[ $? == 0 ]] || error "$LFS hsm_state $f failed"
local ar=$(echo $st | grep "archive_id" | cut -f5 -d" " |
copytool_cleanup
}
-run_test 9 "Use of explict archive number, with dedicated copytool"
+run_test 9 "Use of explicit archive number, with dedicated copytool"
test_9a() {
needclients 3 || return 0
mkdir -p $DIR/$tdir
local f=$DIR/$tdir/$tfile
$LFS setstripe -c 2 $f
- local fid=$(make_large_for_striping $f)
+ local fid
+ fid=$(make_large_for_striping $f)
[ $? != 0 ] && skip "not enough free space" && return
local FILE_CRC=$(md5sum $f)
}
run_test 12o "Layout-swap failure during Restore leaves file released"
+test_12p() {
+ # test needs a running copytool
+ copytool_setup
+
+ mkdir $DIR/$tdir
+ local f=$DIR/$tdir/$tfile
+ local fid=$(copy_file /etc/hosts $f)
+
+ $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
+ wait_request_state $fid ARCHIVE SUCCEED
+ do_facet $SINGLEAGT cat $f > /dev/null || error "cannot cat $f"
+ $LFS hsm_release $f || error "cannot release $f"
+ do_facet $SINGLEAGT cat $f > /dev/null || error "cannot cat $f"
+ $LFS hsm_release $f || error "cannot release $f"
+ do_facet $SINGLEAGT cat $f > /dev/null || error "cannot cat $f"
+
+ copytool_cleanup
+}
+run_test 12p "implicit restore of a file on copytool mount point"
+
test_13() {
# test needs a running copytool
copytool_setup
copytool_setup
mkdir -p $DIR/$tdir
- # Check that root can do HSM actions on a ordinary user's file.
+ # Check that root can do HSM actions on a regular user's file.
rm -f $file
fid=$(make_small $file)
sum0=$(md5sum $file)
mkdir -p $DIR/$tdir
local f=$DIR/$tdir/$tfile
- local fid=$(make_large_for_progress $f)
+ local fid
+ fid=$(make_large_for_progress $f)
[ $? != 0 ] && skip "not enough free space" && return
$LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
mkdir -p $DIR/$tdir
local f=$DIR/$tdir/$tfile
- local fid=$(make_large_for_progress $f)
+ local fid
+ fid=$(make_large_for_progress $f)
[ $? != 0 ] && skip "not enough free space" && return
$LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
mkdir -p $DIR/$tdir
local f=$DIR/$tdir/$tfile
- local fid=$(make_large_for_progress $f)
+ local fid
+ fid=$(make_large_for_progress $f)
[ $? != 0 ] && skip "not enough free space" && return
$LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
mkdir -p $DIR/$tdir
local f=$DIR/$tdir/SLEEP
+ local slp_sum1=$(md5sum /bin/sleep)
local fid=$(copy_file /bin/sleep $f)
chmod 755 $f
$LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
wait $pid
[[ $? == 0 ]] || error "Execution failed during run"
cmp /bin/sleep $f
- [[ $? == 0 ]] || error "Binary overwritten during exec"
+ if [[ $? != 0 ]]; then
+ local slp_sum2=$(md5sum /bin/sleep)
+ # in case sleep file is modified during the test
+ [[ $slp_sum1 == $slp_sum2 ]] &&
+ error "Binary overwritten during exec"
+ fi
# cleanup
# remove no try action mode
mkdir -p $DIR/$tdir
local f=$DIR/$tdir/$tfile
- local fid=$(make_large_for_progress $f)
+ local fid
+ fid=$(make_large_for_progress $f)
[ $? != 0 ] && skip "not enough free space" && return
$LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
mkdir -p $DIR/$tdir
local f=$DIR/$tdir/$tfile
- local fid=$(make_large_for_progress_aligned $f)
+ local fid
+ fid=$(make_large_for_progress_aligned $f)
[ $? != 0 ] && skip "not enough free space" && return
$LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
mkdir -p $DIR/$tdir
local f=$DIR/$tdir/$tfile
- local fid=$(make_large_for_progress $f)
+ local fid
+ fid=$(make_large_for_progress $f)
[ $? != 0 ] && skip "not enough free space" && return
$LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
mkdir -p $DIR/$tdir
local f=$DIR/$tdir/$tfile
- local fid=$(make_large_for_progress $f)
+ local fid
+ fid=$(make_large_for_progress $f)
[ $? != 0 ] && skip "not enough free space" && return
$LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
local f=$DIR/$tdir/$tfile
local f1=$DIR/$tdir/$tfile-1
- local fid=$(make_large_for_progress $f)
+ local fid
+ fid=$(make_large_for_progress $f)
[ $? != 0 ] && skip "not enough free space" && return
local fid1=$(copy_file /etc/passwd $f1)
mkdir -p $DIR/$tdir
local f=$DIR/$tdir/$tfile
- local fid=$(make_large_for_progress $f)
+ local fid
+ fid=$(make_large_for_progress $f)
[ $? != 0 ] && skip "not enough free space" && return
$LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
mkdir -p $DIR/$tdir
local f=$DIR/$tdir/$tfile
- local fid=$(make_large_for_progress $f)
+ local fid
+ fid=$(make_large_for_progress $f)
[ $? != 0 ] && skip "not enough free space" && return
$LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f ||
mkdir -p $DIR/$tdir
local f=$DIR/$tdir/$tfile
- local fid=$(make_large_for_progress $f)
+ local fid
+ fid=$(make_large_for_progress $f)
[ $? != 0 ] && skip "not enough free space" && return
local mdtidx=0
$LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f ||
error "could not archive file"
+ local agent=$(facet_active_host $SINGLEAGT)
+ local prefix=$TESTLOG_PREFIX
+ [[ -z "$TESTNAME" ]] || prefix=$prefix.$TESTNAME
+ local copytool_log=$prefix.copytool_log.$agent.log
+
+
+ wait_update $agent \
+ "grep -o start.copy $copytool_log" "start copy" 100 ||
+ error "copytool failed to start"
+
local cmd="$LCTL get_param -n ${mdt}.hsm.active_requests"
cmd+=" | awk '/'$fid'.*action=ARCHIVE/ {print \\\$12}' | cut -f2 -d="
mkdir -p $DIR/$tdir
local f=$DIR/$tdir/$tfile
- local fid=$(make_large_for_progress $f)
+ local fid
+ fid=$(make_large_for_progress $f)
[ $? != 0 ] && skip "not enough free space" && return
$LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f ||
mkdir -p $DIR/$tdir
local f=$DIR/$tdir/$tfile
- local fid=$(make_large_for_progress $f)
+ local fid
+ fid=$(make_large_for_progress $f)
[ $? != 0 ] && skip "not enough free space" && return
# if cdt is on, it can serve too quickly the request
mkdir -p $DIR/$tdir
local f=$DIR/$tdir/$tfile
- local fid=$(make_large_for_cancel $f)
+ local fid
+ fid=$(make_large_for_cancel $f)
[ $? != 0 ] && skip "not enough free space" && return
# test with cdt on is made in test_221
mkdir -p $DIR/$tdir
local f=$DIR/$tdir/$tfile
- local fid=$(make_large_for_progress $f)
+ local fid
+ fid=$(make_large_for_progress $f)
[ $? != 0 ] && skip "not enough free space" && return
$LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
mkdir -p $DIR/$tdir
local f=$DIR/$tdir/$tfile
- local fid=$(make_large_for_cancel $f)
+ local fid
+ fid=$(make_large_for_cancel $f)
[ $? != 0 ] && skip "not enough free space" && return
changelog_setup
mkdir -p $DIR/$tdir
local f=$DIR/$tdir/$tfile
- local fid=$(make_large_for_progress $f)
+ local fid
+ fid=$(make_large_for_progress $f)
[ $? != 0 ] && skip "not enough free space" && return
changelog_setup
mkdir -p $DIR/$tdir
local f=$DIR/$tdir/$tfile
- local fid=$(make_large_for_progress $f)
+ local fid
+ fid=$(make_large_for_progress $f)
[ $? != 0 ] && skip "not enough free space" && return
changelog_setup
mkdir -p $DIR/$tdir
local f=$DIR/$tdir/$tfile
- local fid=$(make_large_for_cancel $f)
+ local fid
+ fid=$(make_large_for_cancel $f)
[ $? != 0 ] && skip "not enough free space" && return
cdt_disable
set_hsm_param loop_period 2
cdt_enable
+ # clear locks to avoid extra delay caused by flush/cancel
+ # and thus prevent early copytool death to timeout.
+ cancel_lru_locks osc
+
$LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f
wait_request_state $fid ARCHIVE STARTED
sleep 5
}
run_test 405 "archive and release under striped directory"
+test_500()
+{
+ [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.6.92) ] &&
+ skip "HSM migrate is not supported" && return
+
+ # Stop the existing copytool
+ copytool_cleanup
+
+ test_mkdir -p $DIR/$tdir
+ llapi_hsm_test -d $DIR/$tdir || error "One llapi HSM test failed"
+}
+run_test 500 "various LLAPI HSM tests"
+
copytool_cleanup
complete $SECONDS