Whamcloud - gitweb
LU-2253 tests: get proper free indoes 75/7375/2
authorNiu Yawei <yawei.niu@intel.com>
Mon, 19 Aug 2013 04:16:52 +0000 (00:16 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 3 Sep 2013 05:37:29 +0000 (05:37 +0000)
In the DNE environment, usually we want to get free indoes on the
master MDT but not the whole filesystem.

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Change-Id: I3bbae177ba556eaa7a7cdb582448c94d24c57bfb
Reviewed-on: http://review.whamcloud.com/7375
Tested-by: Hudson
Reviewed-by: Jian Yu <jian.yu@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/mds-survey.sh
lustre/tests/sanity-quota.sh
lustre/tests/sanity.sh
lustre/tests/test-framework.sh

index 63510e9..6eb9b45 100644 (file)
@@ -37,7 +37,7 @@ adjust_inode() {
 
     require_inode=$((file_count * thrhi))
     # get available inode for mdt
-    avail_mdt_inode=$(lfs_df -i $MOUNT | grep "summary" | awk '{print $4}')
+    avail_mdt_inode=$(mdt_free_inodes 0)
     avail_mdt_inode=$((avail_mdt_inode * 9 / 10))
 
     # get available inode for ost
index a0ec174..ba3971e 100644 (file)
@@ -488,7 +488,8 @@ test_2() {
 
        [ "$SLOW" = "no" ] && LIMIT=1024 # 1k inodes
 
-       local FREE_INODES=$(lfs_df -i | grep "summary" | awk '{print $4}')
+       local FREE_INODES=$(mdt_free_inodes 0)
+       echo "$FREE_INODES free inodes on master MDT"
        [ $FREE_INODES -lt $LIMIT ] &&
                skip "not enough free inodes $FREE_INODES required $LIMIT" &&
                return
index 5ac4621..5c1a0d7 100644 (file)
@@ -990,7 +990,7 @@ max_pages_per_rpc() {
 
 test_24v() {
        local NRFILES=100000
-       local FREE_INODES=$(lfs_df -i | grep "summary" | awk '{print $4}')
+       local FREE_INODES=$(mdt_free_inodes 0)
        [ $FREE_INODES -lt $NRFILES ] && \
                skip "not enough free inodes $FREE_INODES required $NRFILES" &&
                return
index f1d54fb..62d0881 100644 (file)
@@ -1297,6 +1297,23 @@ lfs_df() {
        $LFS df $* | sed -e 's/filesystem /filesystem_/'
 }
 
+# Get free inodes on the MDT specified by mdt index, free indoes on
+# the whole filesystem will be returned when index == -1.
+mdt_free_inodes() {
+       local index=$1
+       local free_inodes
+       local mdt_uuid
+
+       if [ $index -eq -1 ]; then
+               mdt_uuid="summary"
+       else
+               mdt_uuid=$(mdtuuid_from_index $index)
+       fi
+
+       free_inodes=$(lfs_df -i $MOUNT | grep $mdt_uuid | awk '{print $4}')
+       echo $free_inodes
+}
+
 setup_quota(){
        if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.50) ]; then
                setup_quota_old $1