From: JC Lafoucriere Date: Mon, 3 Nov 2014 02:17:45 +0000 (-0500) Subject: LU-4178 tests: add messages to sanity-hsm X-Git-Tag: 2.6.92~53 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=597214dc586ae9d329f2bb819600ac4b9ddfcc06;ds=sidebyside LU-4178 tests: add messages to sanity-hsm Add messages in case of file creation failure so we can diagnose the failure. Signed-off-by: JC Lafoucriere Change-Id: I080c4cbb6bfe5a65d964f32a36d7c1dba35d0c27 Reviewed-on: http://review.whamcloud.com/8113 Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Reviewed-by: James Nunez Tested-by: Jenkins Tested-by: Maloo --- diff --git a/lustre/tests/sanity-hsm.sh b/lustre/tests/sanity-hsm.sh index e5a8980..f87ef93 100755 --- a/lustre/tests/sanity-hsm.sh +++ b/lustre/tests/sanity-hsm.sh @@ -336,7 +336,7 @@ make_archive() { local file=$HSM_ARCHIVE/$1 do_facet $SINGLEAGT mkdir -p $(dirname $file) do_facet $SINGLEAGT dd if=/dev/urandom of=$file count=32 bs=1000000 || - error "cannot create $file" + file_creation_failure dd $file $? } copy2archive() { @@ -556,6 +556,15 @@ check_hsm_flags_user() { [[ $st == $fl ]] || error "hsm flags on $f are $st != $fl" } +file_creation_failure() { + local cmd=$1 + local f=$2 + local err=$3 + + df $MOUNT $MOUNT2 + error "cannot create $f with $cmd, status=$err" +} + copy_file() { local f= @@ -569,20 +578,22 @@ copy_file() { f=${f/$DIR/$DIR2} fi rm -f $f - cp $1 $f || error "cannot copy $1 to $f" + cp $1 $f || file_creation_failure cp $f $? + path2fid $f || error "cannot get fid on $f" } make_small() { local file2=${1/$DIR/$DIR2} dd if=/dev/urandom of=$file2 count=2 bs=1M conv=fsync || - error "cannot create $file2" + file_creation_failure dd $file2 $? + path2fid $1 || error "cannot get fid on $1" } make_small_sync() { dd if=/dev/urandom of=$1 count=1 bs=1M conv=sync || - error "cannot create $1" + file_creation_failure dd $1 $? path2fid $1 || error "cannot get fid on $1" } @@ -611,7 +622,8 @@ make_large_for_striping() { [ $? != 0 ] && return $? dd if=/dev/urandom of=$file2 count=5 bs=$sz conv=fsync || - error "cannot create $file2" + file_creation_failure dd $file2 $? + path2fid $1 || error "cannot get fid on $1" } @@ -628,7 +640,8 @@ make_large_for_progress() { # size is not a multiple of 1M to avoid stripe # aligment dd if=/dev/urandom of=$file2 count=39 bs=1000000 conv=fsync || - error "cannot create $file2" + file_creation_failure dd $file2 $? + path2fid $1 || error "cannot get fid on $1" } @@ -645,7 +658,7 @@ make_large_for_progress_aligned() { # size is a multiple of 1M to have stripe # aligment dd if=/dev/urandom of=$file2 count=33 bs=1M conv=fsync || - error "cannot create $file2" + file_creation_failure dd $file2 $? path2fid $1 || error "cannot get fid on $1" } @@ -659,7 +672,7 @@ make_large_for_cancel() { # Copy timeout is 100s. 105MB => 105s dd if=/dev/urandom of=$file2 count=103 bs=1M conv=fsync || - error "cannot create $file2" + file_creation_failure dd $file2 $? path2fid $1 || error "cannot get fid on $1" } @@ -844,7 +857,7 @@ test_3() { error "user could not change hsm flags" dd if=/etc/passwd of=$f.append bs=1 count=3\ conv=notrunc oflag=append status=noxfer || - error "could not append to test file" + file_creation_failure dd $f.append $? check_hsm_flags $f.append "0x00000003" # Modify a file sets it dirty @@ -853,7 +866,7 @@ test_3() { error "user could not change hsm flags" dd if=/dev/zero of=$f.modify bs=1 count=3\ conv=notrunc status=noxfer || - error "could not modify test file" + file_creation_failure dd $f.modify $? check_hsm_flags $f.modify "0x00000003" # Open O_TRUNC sets dirty