Whamcloud - gitweb
LU-3852 tests: remove large files created by HSM test 84/7484/3
authorJinshan Xiong <jinshan.xiong@intel.com>
Wed, 28 Aug 2013 18:14:59 +0000 (11:14 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 16 Sep 2013 21:38:00 +0000 (21:38 +0000)
Delete files created by HSM test cases with size bigger than 10M.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Change-Id: Ibe774254110d0d6f3477bd0bbb3bf287c4356b9a
Reviewed-on: http://review.whamcloud.com/7484
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: jacques-Charles Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/sanity-hsm.sh

index 1df1aed..971a38a 100644 (file)
@@ -388,9 +388,17 @@ make_small() {
         path2fid $1 || error "cannot get fid on $1"
 }
 
         path2fid $1 || error "cannot get fid on $1"
 }
 
+cleanup_large_files() {
+       local ratio=$(df $MOUNT |awk '{print $5}' |sed 's/%//g' |grep -v Use)
+       [ $ratio -gt 50 ] && find $MOUNT -size +10M -exec rm -f {} \;
+}
+
 make_large_for_striping() {
        local file2=${1/$DIR/$DIR2}
        local sz=$($LCTL get_param -n lov.*-clilov-*.stripesize | head -1)
 make_large_for_striping() {
        local file2=${1/$DIR/$DIR2}
        local sz=$($LCTL get_param -n lov.*-clilov-*.stripesize | head -1)
+
+       cleanup_large_files
+
        dd if=/dev/urandom of=$file2 count=5 bs=$sz conv=fsync ||
                error "cannot create $file2"
        path2fid $1 || error "cannot get fid on $1"
        dd if=/dev/urandom of=$file2 count=5 bs=$sz conv=fsync ||
                error "cannot create $file2"
        path2fid $1 || error "cannot get fid on $1"
@@ -398,6 +406,9 @@ make_large_for_striping() {
 
 make_large_for_progress() {
        local file2=${1/$DIR/$DIR2}
 
 make_large_for_progress() {
        local file2=${1/$DIR/$DIR2}
+
+       cleanup_large_files
+
        # big file is large enough, so copy time is > 30s
        # so copytool make 1 progress
        # size is not a multiple of 1M to avoid stripe
        # big file is large enough, so copy time is > 30s
        # so copytool make 1 progress
        # size is not a multiple of 1M to avoid stripe
@@ -409,6 +420,9 @@ make_large_for_progress() {
 
 make_large_for_progress_aligned() {
        local file2=${1/$DIR/$DIR2}
 
 make_large_for_progress_aligned() {
        local file2=${1/$DIR/$DIR2}
+
+       cleanup_large_files
+
        # big file is large enough, so copy time is > 30s
        # so copytool make 1 progress
        # size is a multiple of 1M to have stripe
        # big file is large enough, so copy time is > 30s
        # so copytool make 1 progress
        # size is a multiple of 1M to have stripe
@@ -420,6 +434,9 @@ make_large_for_progress_aligned() {
 
 make_large_for_cancel() {
        local file2=${1/$DIR/$DIR2}
 
 make_large_for_cancel() {
        local file2=${1/$DIR/$DIR2}
+
+       cleanup_large_files
+
        # Copy timeout is 100s. 105MB => 105s
        dd if=/dev/urandom of=$file2 count=103 bs=1M conv=fsync ||
                error "cannot create $file2"
        # Copy timeout is 100s. 105MB => 105s
        dd if=/dev/urandom of=$file2 count=103 bs=1M conv=fsync ||
                error "cannot create $file2"