Whamcloud - gitweb
LU-13156 tests: wait for nodemap update in sanity-selinux 00/50400/3
authorSebastien Buisson <sbuisson@ddn.com>
Mon, 23 Mar 2020 15:23:57 +0000 (16:23 +0100)
committerOleg Drokin <green@whamcloud.com>
Tue, 27 Feb 2024 05:41:42 +0000 (05:41 +0000)
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.

Lustre-change: https://review.whamcloud.com/38034
Lustre-commit: f1761cbe6b1243edd7a69c68c401d7285f7f3b38

Test-Parameters: clientselinux mdscount=2 mdtcount=4 testlist=recovery-small,sanity-selinux env=ONLY="21 23",ONLY_REPEAT=80
Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: I363e2bec757efc199f7039f8af4bcb77e2a2a184
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Nunez <jnunez@whamcloud.com>
Signed-off-by: Etienne AUJAMES <eaujames@ddn.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50400
Tested-by: Maloo <maloo@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
lustre/tests/sanity-selinux.sh

index 561184d..d0cc3f7 100755 (executable)
@@ -502,6 +502,7 @@ check_nodemap() {
        local nm=$1
        local key=$2
        local val=$3
+       local facets=""
        local i
 
        if [ "$nm" == "active" ]; then
@@ -509,17 +510,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() {
@@ -541,6 +548,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 nodemap.$nm.sepol="$sepol"
        do_facet mgs $LCTL set_param -P nodemap.$nm.sepol="$sepol"