Whamcloud - gitweb
LU-309 Fix sanity test_27z to work if lustre is mounted from loop device
[fs/lustre-release.git] / lustre / tests / sanity.sh
index 4e747ee..d400b26 100644 (file)
@@ -1329,6 +1329,7 @@ check_seq_oid()
                 local group=${lmm[$((j+3))]}
                 local dev=$(ostdevname $devnum)
                 local dir=${MOUNT%/*}/ost$devnum
+                local mntpt=$(facet_mntpt ost$devnum)
 
                 stop ost$devnum
                 do_facet ost$devnum mount -t $FSTYPE $dev $dir $OST_MOUNT_OPTS ||
@@ -1348,7 +1349,7 @@ check_seq_oid()
                 [ $stripe -eq $i ] || { error "stripe mismatch"; return 6; }
 
                 echo -e "\t\tost $obdidx, objid $objid, group $group"
-                do_facet ost$devnum umount -d $dev
+                do_facet ost$devnum umount -d $mntpt
                 start ost$devnum $dev $OST_MOUNT_OPTS
         done
 }
@@ -6872,21 +6873,21 @@ test_155_small_load() {
 test_155_big_load() {
     local temp=$TMP/$tfile
     local file=$DIR/$tfile
-    local list=$(comma_list $(osts_nodes))
-    local big=$(do_nodes $list grep "cache" /proc/cpuinfo | \
-        awk '{sum+=$4} END{print sum}')
-    local min_avail=$(lctl get_param -n osc.*[oO][sS][cC]-[^M]*.kbytesavail | \
-        sort -n | head -1)
-    local large_file_size=$((big * 2))
-
-    log "cache size on OSS is $big KB"
-    log "large file size is $large_file_size KB"
-    log "min available OST size is $min_avail KB"
-
-    [ $min_avail -le $large_file_size ] && \
-        skip "the minimum available OST size needs > $large_file_size KB" && \
+
+    free_min_max
+    local cache_size=$(do_facet ost$((MAXI+1)) \
+        "awk '/cache/ {sum+=\\\$4} END {print sum}' /proc/cpuinfo")
+    local large_file_size=$((cache_size * 2))
+
+    echo "OSS cache size: $cache_size KB"
+    echo "Large file size: $large_file_size KB"
+
+    [ $MAXV -le $large_file_size ] && \
+        skip_env "max available OST size needs > $large_file_size KB" && \
         return 0
 
+    $SETSTRIPE $file -c 1 -i $MAXI || error "$SETSTRIPE $file failed"
+
     dd if=/dev/urandom of=$temp bs=$large_file_size count=1k || \
         error "dd of=$temp bs=$large_file_size count=1k failed"
     cp $temp $file
@@ -7346,7 +7347,9 @@ test_170() {
         local expected_good=$((good_line1 + good_line2*2))
 
         rm -f $TMP/${tfile}*
-        if [ $bad_line -ne $bad_line_new ]; then
+       # LU-231, short malformed line may not be counted into bad lines
+        if [ $bad_line -ne $bad_line_new ] &&
+                  [ $bad_line -ne $((bad_line_new - 1)) ]; then
                 error "expected $bad_line bad lines, but got $bad_line_new"
                 return 1
         fi
@@ -7383,6 +7386,9 @@ setup_obdecho_osc () {
         local ost_nid=$1
         local obdfilter_name=$2
         echo "Creating new osc for $obdfilter_name on $ost_nid"
+        # make sure we can find loopback nid
+        $LCTL add_uuid $ost_nid $ost_nid >/dev/null 2>&1
+
         [ $rc -eq 0 ] && { $LCTL attach osc ${obdfilter_name}_osc     \
                            ${obdfilter_name}_osc_UUID || rc=2; }
         [ $rc -eq 0 ] && { $LCTL --device ${obdfilter_name}_osc setup \