From f1761cbe6b1243edd7a69c68c401d7285f7f3b38 Mon Sep 17 00:00:00 2001 From: Sebastien Buisson Date: Mon, 23 Mar 2020 16:23:57 +0100 Subject: [PATCH] LU-13156 tests: wait for nodemap update in sanity-selinux In sanity-selinux test_21a and test_21b, nodemaps are used to test SELinux status checking (sepol). We must wait for nodemap update on all MDS nodes before carrying out tests. Test-Parameters: clientselinux mdscount=2 mdtcount=4 testlist=recovery-small,sanity-selinux env=ONLY="21 23",ONLY_REPEAT=100 Signed-off-by: Sebastien Buisson Change-Id: I363e2bec757efc199f7039f8af4bcb77e2a2a184 Reviewed-on: https://review.whamcloud.com/38034 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: James Nunez Reviewed-by: Oleg Drokin --- lustre/tests/sanity-selinux.sh | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/lustre/tests/sanity-selinux.sh b/lustre/tests/sanity-selinux.sh index 06ba994..8f0869a 100755 --- a/lustre/tests/sanity-selinux.sh +++ b/lustre/tests/sanity-selinux.sh @@ -15,8 +15,8 @@ set -e ONLY=${ONLY:-"$*"} -# bug number for skipped test: LU-13156 -ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"$SANITY_SELINUX_EXCEPT 21a 21b"} +# bug number for skipped test: +ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"$SANITY_SELINUX_EXCEPT"} # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT! SRCDIR=$(dirname $0) @@ -465,6 +465,7 @@ check_nodemap() { local nm=$1 local key=$2 local val=$3 + local facets="" local i if [ "$nm" == "active" ]; then @@ -472,17 +473,23 @@ check_nodemap() { else proc_param="$nm.$key" fi - is_sync=false - for i in $(seq 1 20); do - out=$(do_facet mds1 $LCTL get_param -n \ + # check all MDS nodes, in reverse order to privilege remote ones first + for i in $(seq $MDSCOUNT); do + facets="mds$i $facets" + done + for facet in $facets; do + is_sync=false + for i in {1..20}; do + out=$(do_facet $facet $LCTL get_param -n \ nodemap.$proc_param 2>/dev/null) - echo "On mds1, ${proc_param} = $out" - [ "$val" == "$out" ] && is_sync=true && break - sleep 1 + echo "On $facet, ${proc_param} = $out" + [ "$val" == "$out" ] && is_sync=true && break + sleep 1 + done + if ! $is_sync; then + error "$proc_param not updated on $facet after 20 secs" + fi done - if ! $is_sync; then - error "$proc_param not updated on mds1 after 20 secs" - fi } create_nodemap() { @@ -504,6 +511,7 @@ create_nodemap() { check_nodemap $nm admin_nodemap 1 check_nodemap $nm trusted_nodemap 1 + sleep 10 sepol=$(l_getsepol | cut -d':' -f2- | xargs) do_facet mgs $LCTL set_param -P nodemap.$nm.sepol="$sepol" -- 1.8.3.1