Whamcloud - gitweb
LU-2049 tests: Add GRANT_CHECK_LIST to sanity 19/21619/12
authorNathaniel Clark <nathaniel.l.clark@intel.com>
Mon, 1 Aug 2016 20:23:40 +0000 (16:23 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 3 Jun 2017 03:54:44 +0000 (03:54 +0000)
Test GRANT_CHECK_LIST across a selection of sanity.

Fix check_grant() to account for grant precreate and grant pending and
subtract it from total grant on OSTs.

Test-Parameters: trivial osscount=2 mdscount=2 mdtcount=1 ostcount=2 mdtfilesystemtype=zfs ostfilesystemtype=zfs testlist=sanity
Signed-off-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Change-Id: I05b9f994033e8edf92bf30a17f74f2a0f6bee462
Reviewed-on: https://review.whamcloud.com/21619
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: James Nunez <james.a.nunez@intel.com>
lustre/tests/sanity.sh
lustre/tests/test-framework.sh

index 3bd6019..863eba0 100755 (executable)
@@ -8,13 +8,16 @@
 set -e
 
 ONLY=${ONLY:-"$*"}
-# bug number for skipped test: 13297 2108 9789 3637 9789 3561 5188
-ALWAYS_EXCEPT="                42a  42b  42c  42d  45   68b   $SANITY_EXCEPT"
+# bug number for skipped test:  LU-6493 3561 5188
+ALWAYS_EXCEPT="                 42b     45   68b   $SANITY_EXCEPT"
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
 # bug number for skipped tests: LU-2036 LU-8411 LU-9096
 ALWAYS_EXCEPT="                 76     407     253 $ALWAYS_EXCEPT"
 
+# Check Grants after these tests
+GRANT_CHECK_LIST="$GRANT_CHECK_LIST 42a 42b 42c 42d 42e 63a 63b 64a 64b 64c"
+
 is_sles11()                                            # LU-4341
 {
        if [ -r /etc/SuSE-release ]
index 653709d..dab9279 100755 (executable)
@@ -5314,8 +5314,9 @@ check_grant() {
        export base=$(basetest $1)
        [ "$CHECK_GRANT" == "no" ] && return 0
 
-       testname=GCHECK_ONLY_${base}
-       [ ${!testname}x == x ] && return 0
+       testnamebase=GCHECK_ONLY_${base}
+       testname=GCHECK_ONLY_$1
+       [ ${!testnamebase}x == x -a ${!testname}x == x ] && return 0
 
        echo -n "checking grant......"
 
@@ -5331,17 +5332,22 @@ check_grant() {
                awk '{ total += $1 } END { printf("%0.0f", total) }')
 
        # get server grant
+       # which is tot_granted less grant_precreate
        server_grant=$(do_nodes $(comma_list $(osts_nodes)) \
-               "$LCTL get_param -n obdfilter.${FSNAME}-OST*.tot_granted" |
-               awk '{ total += $1 } END { printf("%0.0f", total) }')
+               "$LCTL get_param "\
+               "obdfilter.${FSNAME}-OST*.{tot_granted,tot_pending,grant_precreate}" |
+               sed 's/=/ /'| awk '/tot_granted/{ total += $2 }; 
+                               /tot_pending/{ total -= $2 };
+                               /grant_precreate/{ total -= $2 };
+                               END { printf("%0.0f", total) }')
 
        # check whether client grant == server grant
        if [[ $client_grant -ne $server_grant ]]; then
-               echo "failed: client:${client_grant} server: ${server_grant}."
                do_nodes $(comma_list $(osts_nodes)) \
-                       "$LCTL get_param obdfilter.${FSNAME}-OST*.tot*"
+                       "$LCTL get_param obdfilter.${FSNAME}-OST*.tot*" \
+                       "obdfilter.${FSNAME}-OST*.grant_*"
                do_nodes $clients "$LCTL get_param osc.${FSNAME}-*.cur_*_bytes"
-               return 1
+               error "failed: client:${client_grant} server: ${server_grant}."
        else
                echo "pass: client:${client_grant} server: ${server_grant}"
        fi