From: Niu Yawei Date: Mon, 19 Aug 2013 04:16:52 +0000 (-0400) Subject: LU-2253 tests: get proper free indoes X-Git-Tag: 2.4.92~14 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=50c7a762ea4878041719b7a36d80ddd3e4e12a11 LU-2253 tests: get proper free indoes 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 Change-Id: I3bbae177ba556eaa7a7cdb582448c94d24c57bfb Reviewed-on: http://review.whamcloud.com/7375 Tested-by: Hudson Reviewed-by: Jian Yu Tested-by: Maloo Reviewed-by: Emoly Liu Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/mds-survey.sh b/lustre/tests/mds-survey.sh index 63510e9..6eb9b45 100644 --- a/lustre/tests/mds-survey.sh +++ b/lustre/tests/mds-survey.sh @@ -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 diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index a0ec174..ba3971e 100644 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -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 diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 5ac4621..5c1a0d7 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -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 diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index f1d54fb..62d0881 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -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