Whamcloud - gitweb
b=17555
[fs/lustre-release.git] / lustre / tests / replay-ost-single.sh
index c2e493b..1ae6256 100755 (executable)
@@ -10,11 +10,18 @@ CLEANUP=${CLEANUP:-""}
 init_test_env $@
 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 
 init_test_env $@
 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 
-ostfailover_HOST=${ostfailover_HOST:-$ost_HOST}
+# While we do not use OSTCOUNT=1 setup anymore,
+# ost1failover_HOST is used
+#ostfailover_HOST=${ostfailover_HOST:-$ost_HOST}
 #failover= must be defined in OST_MKFS_OPTIONS if ostfailover_HOST != ost_HOST
 
 remote_ost_nodsh && skip "remote OST with nodsh" && exit 0
 
 #failover= must be defined in OST_MKFS_OPTIONS if ostfailover_HOST != ost_HOST
 
 remote_ost_nodsh && skip "remote OST with nodsh" && exit 0
 
+if [ "$FAILURE_MODE" = "HARD" ] && mixed_ost_devs; then
+    skip "$0: Several ost services on one ost node are used with FAILURE_MODE=$FAILURE_MODE. "
+    exit 0
+fi
+
 # Tests that fail on uml
 CPU=`awk '/model/ {print $4}' /proc/cpuinfo`
 [ "$CPU" = "UML" ] && EXCEPT="$EXCEPT 6"
 # Tests that fail on uml
 CPU=`awk '/model/ {print $4}' /proc/cpuinfo`
 [ "$CPU" = "UML" ] && EXCEPT="$EXCEPT 6"
@@ -26,87 +33,89 @@ ALWAYS_EXCEPT="$REPLAY_OST_SINGLE_EXCEPT"
 #                                      
 [ "$SLOW" = "no" ] && EXCEPT_SLOW="5"
 
 #                                      
 [ "$SLOW" = "no" ] && EXCEPT_SLOW="5"
 
-# It is replay-ost-single, after all
-OSTCOUNT=1
-
 build_test_filter
 
 build_test_filter
 
-REFORMAT=--reformat cleanup_and_setup_lustre
+check_and_setup_lustre
 assert_DIR
 rm -rf $DIR/[df][0-9]*
 
 assert_DIR
 rm -rf $DIR/[df][0-9]*
 
+TDIR=$DIR/d0.${TESTSUITE}
+mkdir -p $TDIR
+$LFS setstripe $TDIR -i 0 -c 1
+$LFS getstripe $TDIR
+
 test_0a() {
     zconf_umount `hostname` $MOUNT -f
     # needs to run during initial client->OST connection
     #define OBD_FAIL_OST_ALL_REPLY_NET       0x211
 test_0a() {
     zconf_umount `hostname` $MOUNT -f
     # needs to run during initial client->OST connection
     #define OBD_FAIL_OST_ALL_REPLY_NET       0x211
-    do_facet ost "lctl set_param fail_loc=0x80000211"
+    do_facet ost1 "lctl set_param fail_loc=0x80000211"
     zconf_mount `hostname` $MOUNT && df $MOUNT || error "0a mount fail"
 }
 run_test 0a "target handle mismatch (bug 5317) `date +%H:%M:%S`"
 
 test_0b() {
     fail ost1
     zconf_mount `hostname` $MOUNT && df $MOUNT || error "0a mount fail"
 }
 run_test 0a "target handle mismatch (bug 5317) `date +%H:%M:%S`"
 
 test_0b() {
     fail ost1
-    cp /etc/profile  $DIR/$tfile
+    cp /etc/profile  $TDIR/$tfile
     sync
     sync
-    diff /etc/profile $DIR/$tfile
-    rm -f $DIR/$tfile
+    diff /etc/profile $TDIR/$tfile
+    rm -f $TDIR/$tfile
 }
 run_test 0b "empty replay"
 
 test_1() {
 }
 run_test 0b "empty replay"
 
 test_1() {
-    date > $DIR/$tfile || error "error creating $DIR/$tfile"
+    date > $TDIR/$tfile || error "error creating $TDIR/$tfile"
     fail ost1
     fail ost1
-    $CHECKSTAT -t file $DIR/$tfile || return 1
-    rm -f $DIR/$tfile
+    $CHECKSTAT -t file $TDIR/$tfile || return 1
+    rm -f $TDIR/$tfile
 }
 run_test 1 "touch"
 
 test_2() {
     for i in `seq 10`; do
 }
 run_test 1 "touch"
 
 test_2() {
     for i in `seq 10`; do
-        echo "tag-$i" > $DIR/$tfile-$i || error "create $DIR/$tfile-$i"
+        echo "tag-$i" > $TDIR/$tfile-$i || error "create $TDIR/$tfile-$i"
     done 
     fail ost1
     for i in `seq 10`; do
     done 
     fail ost1
     for i in `seq 10`; do
-      grep -q "tag-$i" $DIR/$tfile-$i || error "grep $DIR/$tfile-$i"
+      grep -q "tag-$i" $TDIR/$tfile-$i || error "grep $TDIR/$tfile-$i"
     done 
     done 
-    rm -f $DIR/$tfile-*
+    rm -f $TDIR/$tfile-*
 }
 run_test 2 "|x| 10 open(O_CREAT)s"
 
 test_3() {
     verify=$ROOT/tmp/verify-$$
 }
 run_test 2 "|x| 10 open(O_CREAT)s"
 
 test_3() {
     verify=$ROOT/tmp/verify-$$
-    dd if=/dev/urandom bs=4096 count=1280 | tee $verify > $DIR/$tfile &
+    dd if=/dev/urandom bs=4096 count=1280 | tee $verify > $TDIR/$tfile &
     ddpid=$!
     sync &
     fail ost1
     wait $ddpid || return 1
     ddpid=$!
     sync &
     fail ost1
     wait $ddpid || return 1
-    cmp $verify $DIR/$tfile || return 2
-    rm -f $verify $DIR/$tfile
+    cmp $verify $TDIR/$tfile || return 2
+    rm -f $verify $TDIR/$tfile
 }
 run_test 3 "Fail OST during write, with verification"
 
 test_4() {
     verify=$ROOT/tmp/verify-$$
 }
 run_test 3 "Fail OST during write, with verification"
 
 test_4() {
     verify=$ROOT/tmp/verify-$$
-    dd if=/dev/urandom bs=4096 count=1280 | tee $verify > $DIR/$tfile
+    dd if=/dev/urandom bs=4096 count=1280 | tee $verify > $TDIR/$tfile
     # invalidate cache, so that we're reading over the wire
     cancel_lru_locks osc
     # invalidate cache, so that we're reading over the wire
     cancel_lru_locks osc
-    cmp $verify $DIR/$tfile &
+    cmp $verify $TDIR/$tfile &
     cmppid=$!
     fail ost1
     wait $cmppid || return 1
     cmppid=$!
     fail ost1
     wait $cmppid || return 1
-    rm -f $verify $DIR/$tfile
+    rm -f $verify $TDIR/$tfile
 }
 run_test 4 "Fail OST during read, with verification"
 
 test_5() {
     [ -z "`which iozone 2> /dev/null`" ] && skip "iozone missing" && return 0
 }
 run_test 4 "Fail OST during read, with verification"
 
 test_5() {
     [ -z "`which iozone 2> /dev/null`" ] && skip "iozone missing" && return 0
-    FREE=`df -P $DIR | tail -n 1 | awk '{ print $4/2 }'`
+    FREE=`df -P $TDIR | tail -n 1 | awk '{ print $4/2 }'`
     GB=1048576  # 1048576KB == 1GB
     if (( FREE > GB )); then
         FREE=$GB
     fi
     IOZONE_OPTS="-i 0 -i 1 -i 2 -+d -r 4 -s $FREE"
     GB=1048576  # 1048576KB == 1GB
     if (( FREE > GB )); then
         FREE=$GB
     fi
     IOZONE_OPTS="-i 0 -i 1 -i 2 -+d -r 4 -s $FREE"
-    iozone $IOZONE_OPTS -f $DIR/$tfile &
+    iozone $IOZONE_OPTS -f $TDIR/$tfile &
     PID=$!
     
     sleep 8
     PID=$!
     
     sleep 8
@@ -114,7 +123,7 @@ test_5() {
     wait $PID
     RC=$?
     log "iozone rc=$RC"
     wait $PID
     RC=$?
     log "iozone rc=$RC"
-    rm -f $DIR/$tfile
+    rm -f $TDIR/$tfile
     [ $RC -ne 0 ] && return $RC || true
 }
 run_test 5 "Fail OST during iozone"
     [ $RC -ne 0 ] && return $RC || true
 }
 run_test 5 "Fail OST during iozone"
@@ -126,7 +135,7 @@ kbytesfree() {
 test_6() {
     remote_mds_nodsh && skip "remote MDS with nodsh" && return 0
 
 test_6() {
     remote_mds_nodsh && skip "remote MDS with nodsh" && return 0
 
-    f=$DIR/$tfile
+    f=$TDIR/$tfile
     rm -f $f
     sync && sleep 2 && sync    # wait for delete thread
     before=`kbytesfree`
     rm -f $f
     sync && sleep 2 && sync    # wait for delete thread
     before=`kbytesfree`
@@ -153,7 +162,7 @@ test_6() {
 run_test 6 "Fail OST before obd_destroy"
 
 test_7() {
 run_test 6 "Fail OST before obd_destroy"
 
 test_7() {
-    f=$DIR/$tfile
+    f=$TDIR/$tfile
     rm -f $f
     sync && sleep 5 && sync    # wait for delete thread
     before=`kbytesfree`
     rm -f $f
     sync && sleep 5 && sync    # wait for delete thread
     before=`kbytesfree`