Whamcloud - gitweb
b=13499
[fs/lustre-release.git] / lustre / tests / test-framework.sh
index a77b231..df22936 100644 (file)
@@ -487,6 +487,24 @@ wait_for() {
     wait_for_host $HOST
 }
 
+wait_mds_recovery_done () {
+    local timeout=`do_facet mds cat /proc/sys/lustre/timeout`
+#define OBD_RECOVERY_TIMEOUT (obd_timeout * 5 / 2)
+# as we are in process of changing obd_timeout in different ways
+# let's set MAX longer than that
+    MAX=$(( timeout * 4 ))
+    WAIT=0
+    while [ $WAIT -lt $MAX ]; do
+        STATUS=`do_facet mds grep status /proc/fs/lustre/mdt/*-MDT*/recovery_status`
+        echo $STATUS | grep COMPLETE && return 0
+        sleep 5
+        WAIT=$((WAIT + 5))
+        echo "Waiting $(($MAX - $WAIT)) secs for MDS recovery done"
+    done
+    echo "MDS recovery not done in $MAX sec"
+    return 1            
+}
+
 client_df() {
     # not every config has many clients
     if [ ! -z "$CLIENTS" ]; then