Whamcloud - gitweb
Branch HEAD
authorjohann <johann>
Thu, 27 Nov 2008 10:44:18 +0000 (10:44 +0000)
committerjohann <johann>
Thu, 27 Nov 2008 10:44:18 +0000 (10:44 +0000)
b=12596
i=grev
i=adilger

check striping after setstripe in recovery-small test 18*.
move get_stripe_info() to t-f.

lustre/tests/recovery-small.sh
lustre/tests/sanity.sh
lustre/tests/test-framework.sh

index b3902d8..bae9793 100755 (executable)
@@ -255,6 +255,11 @@ test_18a() {
 
     # 1 stripe on ost2
     lfs setstripe $f -s $((128 * 1024)) -i 1 -c 1
+    get_stripe_info client $f
+    if [ $stripe_index -ne 1 ]; then
+        lfs getstripe $f
+        error "$f: different stripe offset ($stripe_index)" && return
+    fi
 
     do_facet client cp $SAMPLE_FILE $f
     sync
@@ -275,14 +280,17 @@ test_18b() {
 
     do_facet client mkdir -p $DIR/$tdir
     f=$DIR/$tdir/$tfile
-    f2=$DIR/$tdir/${tfile}-2
 
     cancel_lru_locks osc
     pgcache_empty || return 1
 
     # shouldn't have to set stripe size of count==1
     lfs setstripe $f -s $((128 * 1024)) -i 0 -c 1
-    lfs setstripe $f2 -s $((128 * 1024)) -i 0 -c 1
+    get_stripe_info client $f
+    if [ $stripe_index -ne 0 ]; then
+        lfs getstripe $f
+        error "$f: different stripe offset ($stripe_index)" && return
+    fi
 
     do_facet client cp $SAMPLE_FILE $f
     sync
@@ -293,7 +301,7 @@ test_18b() {
     # cache after the client reconnects?     
     rc=0
     pgcache_empty || rc=2
-    rm -f $f $f2
+    rm -f $f
     return $rc
 }
 run_test 18b "eviction and reconnect clears page cache (2766)"
@@ -303,14 +311,17 @@ test_18c() {
 
     do_facet client mkdir -p $DIR/$tdir
     f=$DIR/$tdir/$tfile
-    f2=$DIR/$tdir/${tfile}-2
 
     cancel_lru_locks osc
     pgcache_empty || return 1
 
     # shouldn't have to set stripe size of count==1
     lfs setstripe $f -s $((128 * 1024)) -i 0 -c 1
-    lfs setstripe $f2 -s $((128 * 1024)) -i 0 -c 1
+    get_stripe_info client $f
+    if [ $stripe_index -ne 0 ]; then
+        lfs getstripe $f
+        error "$f: different stripe offset ($stripe_index)" && return
+    fi
 
     do_facet client cp $SAMPLE_FILE $f
     sync
@@ -326,7 +337,7 @@ test_18c() {
     # cache after the client reconnects?     
     rc=0
     pgcache_empty || rc=2
-    rm -f $f $f2
+    rm -f $f
     return $rc
 }
 run_test 18c "Dropped connect reply after eviction handing (14755)"
index 37b04d1..4ad3f14 100644 (file)
@@ -3990,17 +3990,6 @@ test_102c() {
 }
 run_test 102c "non-root getfattr/setfattr for lustre.lov EAs ==========="
 
-get_stripe_info() {
-       stripe_size=0
-       stripe_count=0
-       stripe_offset=0
-       local lines=`sed -n '/obdidx/=' $1`
-       stripe_size=`awk '{if($1~/size/) print $2}' $1`
-       stripe_count=`awk '{if($1~/count/) print $2}' $1`
-       lines=`expr $lines + 1`
-       stripe_offset=`sed -n ${lines}p $1 |awk '{print $1}'`
-}
-
 compare_stripe_info1() {
        for num in 1 2 3 4
        do
@@ -4010,22 +3999,16 @@ compare_stripe_info1() {
                        do
                                local size=`expr $STRIPE_SIZE \* $num`
                                local file=file"$num-$offset-$count"
-                               local tmp_file=out
-                               $GETSTRIPE -v $file > $tmp_file
-                               get_stripe_info  $tmp_file
-                               if test $stripe_size -ne $size
-                               then
+                               get_stripe_info client $file
+                               if [ $stripe_size -ne $size ]; then
                                        error "$file: different stripe size" && return
                                fi
-                               if test $stripe_count -ne $count
-                               then
+                               if [ $stripe_count -ne $count ]; then
                                        error "$file: different stripe count" && return
                                fi
-                               if test $stripe_offset -ne 0
-                               then
+                               if [ $stripe_index -ne 0 ]; then
                                        error "$file: different stripe offset" && return
                                fi
-                               rm -f $tmp_file
                        done
                done
        done
@@ -4040,22 +4023,16 @@ compare_stripe_info2() {
                        do
                                local size=`expr $STRIPE_SIZE \* $num`
                                local file=file"$num-$offset-$count"
-                               local tmp_file=out
-                               $GETSTRIPE -v $file > $tmp_file
-                               get_stripe_info  $tmp_file
-                               if test $stripe_size -ne $size
-                               then
+                               get_stripe_info client $file
+                               if [ $stripe_size -ne $size ]; then
                                        error "$file: different stripe size" && return  
                                fi
-                               if test $stripe_count -ne $count
-                               then
+                               if [ $stripe_count -ne $count ]; then
                                        error "$file: different stripe count" && return
                                fi
-                               if test $stripe_offset -ne $offset
-                               then
+                               if [ $stripe_index -ne $offset ]; then
                                        error "$file: different stripe offset" && return
                                fi
-                               rm -f $tmp_file
                        done
                done
        done
index 5ccd826..dd596d6 100644 (file)
@@ -2135,3 +2135,20 @@ check_catastrophe () {
     fi 
 }
 
+# $1 node
+# $2 file
+get_stripe_info() {
+       local tmp_file
+
+       stripe_size=0
+       stripe_count=0
+       stripe_index=0
+       tmp_file=$(mktemp)
+
+       do_facet $1 lfs getstripe -v $2 > $tmp_file
+
+       stripe_size=`awk '$1 ~ /size/ {print $2}' $tmp_file`
+       stripe_count=`awk '$1 ~ /count/ {print $2}' $tmp_file`
+       stripe_index=`awk '/obdidx/ {start = 1; getline; print $1; exit}' $tmp_file`
+       rm -f $tmp_file
+}