Whamcloud - gitweb
branch: HEAD
[fs/lustre-release.git] / lustre / tests / lreplicate-test.sh
index f3918a1..563839d 100644 (file)
@@ -10,8 +10,8 @@ SRCDIR=`dirname $0`
 export PATH=$PWD/$SRCDIR:$SRCDIR:$PWD/$SRCDIR/../utils:$PATH:/sbin
 
 ONLY=${ONLY:-"$*"}
-ALWAYS_EXCEPT="$LREPLICATE_EXCEPT"
-# bug number for skipped test: -
+ALWAYS_EXCEPT="$LREPLICATE_EXCEPT 5a 5b"
+# bug number for skipped test: -  20878
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
 [ "$ALWAYS_EXCEPT$EXCEPT" ] && \
@@ -43,6 +43,7 @@ build_test_filter
 
 export LREPLICATE=${LREPLICATE:-"$LUSTRE/utils/lreplicate"}
 [ ! -f "$LREPLICATE" ] && export LREPLICATE=$(which lreplicate)
+export LREPLICATE="$LREPLICATE -v" # -a
 
 # control the time of tests
 DBENCH_TIME=${DBENCH_TIME:-60}  # No of seconds to run dbench
@@ -139,11 +140,11 @@ test_1() {
     ln -s $DIR/$tdir/d1/link1  $DIR/$tdir/d1/link3
 
     # Device files
-    mknod $DIR/$tdir/dev1 b 8 1
+    #mknod $DIR/$tdir/dev1 b 8 1
 
     # Replicate
     echo "Replication #1"
-    $LREPLICATE -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG -v
+    $LREPLICATE -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG
 
     # Set attributes
     chmod 000 $DIR/$tdir/d2/file3
@@ -156,7 +157,7 @@ test_1() {
     fi
 
     echo "Replication #2"
-    $LREPLICATE -l $LREPL_LOG -v
+    $LREPLICATE -l $LREPL_LOG
 
     if [ "$xattr" == "yes" ]; then
        local xval1=$(getfattr -n user.foo --absolute-names --only-values \
@@ -166,11 +167,14 @@ test_1() {
     fi
 
     RC=0
-    if [[ ! -b $TGT/$tdir/dev1 ]] || [[ ! -b $TGT2/$tdir/dev1 ]]; then
-       ls -l $DIR/$tdir/dev1 $TGT/$tdir/dev1 $TGT2/$tdir/dev1
-        error "Error replicating block devices"
-        RC=1
-    elif [[ "$xattr" == "yes" ]] &&
+
+    # fid2path and path2fid aren't implemented for block devices
+    #if [[ ! -b $TGT/$tdir/dev1 ]] || [[ ! -b $TGT2/$tdir/dev1 ]]; then
+    #  ls -l $DIR/$tdir/dev1 $TGT/$tdir/dev1 $TGT2/$tdir/dev1
+    #   error "Error replicating block devices"
+    #   RC=1
+
+    if [[ "$xattr" == "yes" ]] &&
        [[ "$xval1" != "bar" || "$xval2" != "bar" ]]; then
         error "Error in replicating xattrs. $xval1, $xval2"
         RC=1
@@ -183,7 +187,6 @@ test_1() {
     fini_changelog
     cleanup_src_tgt
     return $RC
-
 }
 run_test 1 "Simple Replication"
 
@@ -197,7 +200,7 @@ test_2a() {
     sh rundbench -C -D $DIR/$tdir 2 -t $DBENCH_TIME || error "dbench failed!"
 
     # Replicate the changes to $TGT
-    $LREPLICATE -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG -v
+    $LREPLICATE -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG
 
     # Use diff to compare the source and the destination
     check_diff $DIR/$tdir $TGT/$tdir
@@ -227,7 +230,7 @@ test_2b() {
     $KILL -SIGSTOP $child_pid
 
     echo Starting replication
-    $LREPLICATE -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG -v
+    $LREPLICATE -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG
     check_diff $DIR/$tdir $TGT/$tdir
 
     echo Resuming dbench
@@ -238,7 +241,7 @@ test_2b() {
     $KILL -SIGSTOP $child_pid
 
     echo Starting replication
-    $LREPLICATE -l $LREPL_LOG -v
+    $LREPLICATE -l $LREPL_LOG
     check_diff $DIR/$tdir $TGT/$tdir
 
     echo "Wait for dbench to finish"
@@ -247,7 +250,7 @@ test_2b() {
 
     # Replicate the changes to $TGT
     echo Starting replication
-    $LREPLICATE -l $LREPL_LOG -v
+    $LREPLICATE -l $LREPL_LOG
 
     check_diff $DIR/$tdir $TGT/$tdir
     check_diff $DIR/$tdir $TGT2/$tdir
@@ -273,7 +276,7 @@ test_2c() {
     while [ $quit -le 1 ];
     do
         echo "Running lreplicate"
-        $LREPLICATE -s $DIR -t $TGT -t $TGT2 -m ${mds1_svc} -u $CL_USER -l $LREPL_LOG -v
+        $LREPLICATE -s $DIR -t $TGT -t $TGT2 -m ${mds1_svc} -u $CL_USER -l $LREPL_LOG
         sleep 5
         pgrep dbench
         if [ $? -ne 0 ]; then
@@ -303,7 +306,7 @@ test_3a() {
     createmany -o $DIR/$tdir/$tfile $numfiles || error "createmany failed!"
 
     # Replicate the changes to $TGT
-    $LREPLICATE -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG -v
+    $LREPLICATE -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG
     check_diff $DIR/$tdir $TGT/$tdir   
     check_diff $DIR/$tdir $TGT2/$tdir
 
@@ -327,7 +330,7 @@ test_3b() {
     writemany -q -a $DIR/$tdir/$tfile $time $threads || error "writemany failed!"
 
     # Replicate the changes to $TGT
-    $LREPLICATE -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG -v
+    $LREPLICATE -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG
 
     check_diff $DIR/$tdir $TGT/$tdir   
     check_diff $DIR/$tdir $TGT2/$tdir
@@ -351,7 +354,7 @@ test_3c() {
     unlinkmany $DIR/$tdir/$tfile $numfiles || error "unlinkmany failed!"
 
     # Replicate the changes to $TGT
-    $LREPLICATE -s $DIR -t $TGT -t $TGT2 -m $MDT0  -u $CL_USER -l $LREPL_LOG -v
+    $LREPLICATE -s $DIR -t $TGT -t $TGT2 -m $MDT0  -u $CL_USER -l $LREPL_LOG
     check_diff $DIR/$tdir $TGT/$tdir   
     check_diff $DIR/$tdir $TGT2/$tdir
 
@@ -382,15 +385,28 @@ test_4() {
     $KILL -SIGSTOP $child_pid
 
     # Replicate the changes to $TGT
-    $LREPLICATE -s $DIR -t $TGT -t $TGT2 -m $MDT0  -u $CL_USER -l $LREPL_LOG -v
+    $LREPLICATE -s $DIR -t $TGT -t $TGT2 -m $MDT0  -u $CL_USER -l $LREPL_LOG
     check_diff $DIR/$tdir $TGT/$tdir
     check_diff $DIR/$tdir $TGT2/$tdir
 
     $KILL -SIGCONT $child_pid
     sleep 60
-    $KILL -SIGKILL $child_pid
+    $KILL -SIGKILL $(pgrep run_iozone.sh)
+    $KILL -SIGKILL $(pgrep iozone)
+
+    # After killing 'run_iozone.sh', process 'iozone' becomes the
+    # child of PID 1. Hence 'wait' does not wait for it. Killing
+    # iozone first, means more iozone processes are spawned off which
+    # is not desirable. So, after sending a sigkill, the test goes
+    # into a wait loop for iozone to cleanup and exit.
+    wait
+    while [ "$(pgrep "iozone")" != "" ];
+    do
+      ps -ef | grep iozone | grep -v grep
+      sleep 1;
+    done
 
-    $LREPLICATE -l $LREPL_LOG -v
+    $LREPLICATE -l $LREPL_LOG
     check_diff $DIR/$tdir $TGT/$tdir
     check_diff $DIR/$tdir $TGT2/$tdir
 
@@ -413,12 +429,12 @@ test_5a() {
 
     # Replicate the changes to $TGT
     
-    $LREPLICATE -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG -v &
+    $LREPLICATE -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG &
     local child_pid=$!
     sleep 30
     $KILL -SIGHUP $child_pid
     wait
-    $LREPLICATE -l $LREPL_LOG -v
+    $LREPLICATE -l $LREPL_LOG
 
     check_diff $DIR/$tdir $TGT/$tdir   
     check_diff $DIR/$tdir $TGT2/$tdir
@@ -442,12 +458,12 @@ test_5b() {
 
     # Replicate the changes to $TGT
     
-    $LREPLICATE -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG -v &
+    $LREPLICATE -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG &
     local child_pid=$!
     sleep 30
     $KILL -SIGKILL $child_pid
     wait
-    $LREPLICATE -l $LREPL_LOG -v
+    $LREPLICATE -l $LREPL_LOG
 
     check_diff $DIR/$tdir $TGT/$tdir   
     check_diff $DIR/$tdir $TGT2/$tdir
@@ -474,7 +490,7 @@ test_6() {
     done
 
     # Replicate the changes to $TGT
-    $LREPLICATE -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG -v
+    $LREPLICATE -s $DIR -t $TGT -t $TGT2 -m $MDT0 -u $CL_USER -l $LREPL_LOG
     check_diff $DIR/$tdir $TGT/$tdir
     check_diff $DIR/$tdir $TGT2/$tdir
 
@@ -501,12 +517,12 @@ test_7() {
     createmany -o $DIR/$tdir/$tfile $NUMFILES
 
     # To simulate replication to another lustre filesystem, replicate
-    # the changes to $DIR/tgt. Disable changelogs before replication
-    # so that the files created as part of replication are not logged.
-    do_facet $SINGLEMDS lctl set_param -n mdd.$MDT0.changelog off
+    # the changes to $DIR/tgt. We can't turn off the changelogs
+    # while we are registered, so lreplicate better not try to 
+    # replicate the replication steps.  It seems ok :)
     mkdir $DIR/tgt
 
-    $LREPLICATE -s $DIR -t $DIR/tgt -m $MDT0 -u $CL_USER -l $LREPL_LOG -v
+    $LREPLICATE -s $DIR -t $DIR/tgt -m $MDT0 -u $CL_USER -l $LREPL_LOG
     check_diff ${DIR}/$tdir $DIR/tgt/$tdir
 
     local i=0
@@ -545,7 +561,7 @@ test_8() {
            mv $DIR/$tdir/d$i $DIR/$tdir/d0$i
     done
 
-    $LREPLICATE -s $DIR -t $TGT -m $MDT0 -u $CL_USER -l $LREPL_LOG -v
+    $LREPLICATE -s $DIR -t $TGT -m $MDT0 -u $CL_USER -l $LREPL_LOG
 
     check_diff ${DIR}/$tdir $TGT/$tdir
 
@@ -559,5 +575,5 @@ log "cleanup: ======================================================"
 cd $ORIG_PWD
 check_and_cleanup_lustre
 echo '=========================== finished ==============================='
-[ -f "$REPLOG" ] && cat $REPLLOG && grep -q FAIL $REPLLOG && exit 1 || true
+[ -f "$REPLLOG" ] && cat $REPLLOG && grep -q FAIL $REPLLOG && exit 1 || true
 echo "$0: completed"