From 8c13ec1e4a26488f238beb710057755b51060441 Mon Sep 17 00:00:00 2001 From: jcl Date: Mon, 23 Sep 2013 20:04:05 +0200 Subject: [PATCH] LU-3979 tests: archive access must be done on agent In sanity-hsm tests, all access to archive backend must be done from an agent, so all the command which access it are executed through a do_facet $SINGLEAGT Modified tests are 10a 10b 10c 11 12a 12b 12d 12n 13 25a 30a 110a 111a 222a When doing remote commands on agent, we cannot use default environnement variables. So test 106 must use explicitly the lustre mount point when calling get_client_uuid. Signed-off-by: JC Lafoucriere Change-Id: I245069655d2dcf20d1c316c8b9e166cbd8ee4e98 Reviewed-on: http://review.whamcloud.com/7730 Tested-by: Maloo Reviewed-by: Jinshan Xiong Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- lustre/tests/sanity-hsm.sh | 107 ++++++++++++++++++++++++++------------------- 1 file changed, 62 insertions(+), 45 deletions(-) diff --git a/lustre/tests/sanity-hsm.sh b/lustre/tests/sanity-hsm.sh index 64ae27f..f1563030 100644 --- a/lustre/tests/sanity-hsm.sh +++ b/lustre/tests/sanity-hsm.sh @@ -15,8 +15,8 @@ ONLY=${ONLY:-"$*"} # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT! # skip test cases failed before landing - Jinshan -ALWAYS_EXCEPT="$SANITY_HSM_EXCEPT 12a 12b 12n 13 30a 31a 34 35 36" -ALWAYS_EXCEPT="$ALWAYS_EXCEPT 110a 200 201 221 222a 223a 223b 225" +ALWAYS_EXCEPT="$SANITY_HSM_EXCEPT 31a 34 35 36" +ALWAYS_EXCEPT="$ALWAYS_EXCEPT 200 201 221 223a 223b 225" LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)} @@ -181,7 +181,7 @@ copytool_remove_backend() { local fid=$1 local be=$(find $HSM_ARCHIVE -name $fid) echo "Remove from backend: $fid = $be" - rm -f $be + do_facet $SINGLEAGT rm -f $be } import_file() { @@ -193,11 +193,17 @@ import_file() { make_archive() { local file=$HSM_ARCHIVE/$1 - mkdir -p $(dirname $file) - dd if=/dev/urandom of=$file count=32 bs=1000000 || + do_facet $SINGLEAGT mkdir -p $(dirname $file) + do_facet $SINGLEAGT dd if=/dev/urandom of=$file count=32 bs=1000000 || error "cannot create $file" } +copy2archive() { + local file=$HSM_ARCHIVE/$2 + do_facet $SINGLEAGT mkdir -p $(dirname $file) + do_facet $SINGLEAGT cp -p $1 $file || error "cannot copy $1 to $file" +} + changelog_setup() { CL_USER=$(do_facet $SINGLEMDS $LCTL --device $MDT0\ changelog_register -n) @@ -315,9 +321,9 @@ cdt_restart() { } needclients() { - local clnt_count=$1 - if [[ $CLIENTCOUNT -lt $clnt_count ]]; then - skip "Need $clnt_count or more clients, have $CLIENTCOUNT" + local client_count=$1 + if [[ $CLIENTCOUNT -lt $client_count ]]; then + skip "Need $client_count or more clients, have $CLIENTCOUNT" return 1 fi return 0 @@ -730,10 +736,10 @@ test_10a() { error "hsm_archive failed" wait_request_state $fid ARCHIVE SUCCEED - local AFILE=$(ls $HSM_ARCHIVE/*/*/*/*/*/*/$fid) || + local AFILE=$(do_facet $SINGLEAGT ls $HSM_ARCHIVE'/*/*/*/*/*/*/'$fid) || error "fid $fid not in archive $HSM_ARCHIVE" echo "Verifying content" - diff $f $AFILE || error "archived file differs" + do_facet $SINGLEAGT diff $f $AFILE || error "archived file differs" echo "Verifying hsm state " check_hsm_flags $f "0x00000009" @@ -751,7 +757,7 @@ test_10b() { # test needs a running copytool copytool_setup - mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir + mkdir -p $DIR/$tdir local f=$DIR/$tdir/$tfile local fid=$(copy_file /etc/hosts $f) $LFS hsm_archive $f || error "archive request failed" @@ -770,7 +776,7 @@ test_10c() { # test needs a running copytool copytool_setup - mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir + mkdir -p $DIR/$tdir local f=$DIR/$tdir/$tfile local fid=$(copy_file /etc/hosts $f) $LFS hsm_set --noarchive $f @@ -800,8 +806,8 @@ test_10d() { run_test 10d "Archive a file on the default archive id" test_11() { - mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir - cp /etc/hosts $HSM_ARCHIVE/$tdir/$tfile + mkdir -p $DIR/$tdir + copy2archive /etc/hosts $tdir/$tfile local f=$DIR/$tdir/$tfile import_file $tdir/$tfile $f @@ -820,7 +826,7 @@ test_11() { local fid=$(path2fid $f) echo "Verifying new fid $fid in archive" - local AFILE=$(ls $HSM_ARCHIVE/*/*/*/*/*/*/$fid) || + local AFILE=$(do_facet $SINGLEAGT ls $HSM_ARCHIVE'/*/*/*/*/*/*/'$fid) || error "fid $fid not in archive $HSM_ARCHIVE" } run_test 11 "Import a file" @@ -829,8 +835,9 @@ test_12a() { # test needs a running copytool copytool_setup - mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir - cp /etc/hosts $HSM_ARCHIVE/$tdir/$tfile + mkdir -p $DIR/$tdir + copy2archive /etc/hosts $tdir/$tfile + local f=$DIR/$tdir/$tfile import_file $tdir/$tfile $f local f=$DIR2/$tdir/$tfile @@ -844,7 +851,7 @@ test_12a() { echo "Verifying file state: " check_hsm_flags $f "0x00000009" - diff -q $HSM_ARCHIVE/$tdir/$tfile $f + do_facet $SINGLEAGT diff -q $HSM_ARCHIVE/$tdir/$tfile $f [[ $? -eq 0 ]] || error "Restored file differs" @@ -856,8 +863,9 @@ test_12b() { # test needs a running copytool copytool_setup - mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir - cp /etc/hosts $HSM_ARCHIVE/$tdir/$tfile + mkdir -p $DIR/$tdir + copy2archive /etc/hosts $tdir/$tfile + local f=$DIR/$tdir/$tfile import_file $tdir/$tfile $f echo "Verifying released state: " @@ -868,7 +876,7 @@ test_12b() { echo "Verifying file state after restore: " check_hsm_flags $f "0x00000009" - diff -q $HSM_ARCHIVE/$tdir/$tfile $f + do_facet $SINGLEAGT diff -q $HSM_ARCHIVE/$tdir/$tfile $f [[ $? -eq 0 ]] || error "Restored file differs" @@ -904,7 +912,8 @@ test_12d() { # test needs a running copytool copytool_setup - mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir + mkdir -p $DIR/$tdir + local f=$DIR/$tdir/$tfile local fid=$(copy_file /etc/hosts $f) $LFS hsm_restore $f || error "restore of non archived file failed" @@ -1045,12 +1054,14 @@ test_12n() { # test needs a running copytool copytool_setup - mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir - cp /etc/hosts $HSM_ARCHIVE/$tdir/$tfile + mkdir -p $DIR/$tdir + copy2archive /etc/hosts $tdir/$tfile + local f=$DIR/$tdir/$tfile import_file $tdir/$tfile $f - cmp /etc/hosts $f || error "Restored file differs" + do_facet $SINGLEAGT cmp /etc/hosts $f || + error "Restored file differs" $LFS hsm_release $f || error "release of $f failed" @@ -1069,24 +1080,23 @@ test_13() { # populate directory to be imported for d in $(seq 1 10); do local CURR_DIR="$HSM_ARCHIVE/$ARC_SUBDIR/dir.$d" - mkdir -p "$CURR_DIR" + do_facet $SINGLEAGT mkdir -p "$CURR_DIR" for f in $(seq 1 10); do CURR_FILE="$CURR_DIR/$tfile.$f" # write file-specific data - echo "d=$d, f=$f, dir=$CURR_DIR, file=$CURR_FILE"\ - > $CURR_FILE + do_facet $SINGLEAGT \ + echo "d=$d, f=$f, dir=$CURR_DIR, "\ + "file=$CURR_FILE" > $CURR_FILE done done # import to Lustre import_file "$ARC_SUBDIR" $DIR/$tdir # diff lustre content and origin (triggers file restoration) # there must be 10x10 identical files, and no difference - local cnt_ok=$(diff -rs $HSM_ARCHIVE/$ARC_SUBDIR \ - $DIR/$tdir/$ARC_SUBDIR | - grep identical | wc -l) - local cnt_diff=$(diff -r $HSM_ARCHIVE/$ARC_SUBDIR \ - $DIR/$tdir/$ARC_SUBDIR | - wc -l) + local cnt_ok=$(do_facet $SINGLEAGT diff -rs $HSM_ARCHIVE/$ARC_SUBDIR \ + $DIR/$tdir/$ARC_SUBDIR | grep identical | wc -l) + local cnt_diff=$(do_facet $SINGLEAGT diff -r $HSM_ARCHIVE/$ARC_SUBDIR \ + $DIR/$tdir/$ARC_SUBDIR | wc -l) [ $cnt_diff -eq 0 ] || error "$cnt_diff imported files differ from read data" @@ -1506,8 +1516,9 @@ test_25a() { # test needs a running copytool copytool_setup - mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir - cp /etc/hosts $HSM_ARCHIVE/$tdir/$tfile + mkdir -p $DIR/$tdir + copy2archive /etc/hosts $tdir/$tfile + local f=$DIR/$tdir/$tfile import_file $tdir/$tfile $f @@ -1635,8 +1646,9 @@ test_30a() { # test needs a running copytool copytool_setup - mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir - cp -p /bin/true $HSM_ARCHIVE/$tdir/$tfile + mkdir -p $DIR/$tdir + copy2archive /bin/true $tdir/$tfile + local f=$DIR/$tdir/true import_file $tdir/$tfile $f @@ -2341,7 +2353,7 @@ test_106() { copytool_setup local uuid=$(do_rpc_nodes $(facet_active_host $SINGLEAGT) \ - get_client_uuid | cut -d' ' -f2) + get_client_uuid $MOUNT | cut -d' ' -f2) local agent=$(do_facet $SINGLEMDS $LCTL get_param -n $HSM_PARAM.agents | grep $uuid) copytool_cleanup @@ -2421,8 +2433,10 @@ test_110a() { # test needs a running copytool copytool_setup - mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir - cp /etc/passwd $HSM_ARCHIVE/$tdir/$tfile + mkdir -p $DIR/$tdir + + copy2archive /etc/passwd $tdir/$tfile + local f=$DIR/$tdir/$tfile import_file $tdir/$tfile $f local fid=$(path2fid $f) @@ -2476,9 +2490,11 @@ test_111a() { # test needs a running copytool copytool_setup - mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir + mkdir -p $DIR/$tdir + copy2archive /etc/passwd $tdir/$tfile + local f=$DIR/$tdir/$tfile - cp /etc/passwd $HSM_ARCHIVE/$tdir/$tfile + import_file $tdir/$tfile $f local fid=$(path2fid $f) @@ -2669,9 +2685,10 @@ test_222a() { # test needs a running copytool copytool_setup - mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir + mkdir -p $DIR/$tdir + copy2archive /etc/passwd $tdir/$tfile + local f=$DIR/$tdir/$tfile - cp /etc/passwd $HSM_ARCHIVE/$tdir/$tfile import_file $tdir/$tfile $f local fid=$(path2fid $f) -- 1.8.3.1