Whamcloud - gitweb
LU-16775 tests: cleanup target after sanity-sec test_31 66/50766/3
authorSebastien Buisson <sbuisson@ddn.com>
Wed, 26 Apr 2023 07:57:03 +0000 (09:57 +0200)
committerOleg Drokin <green@whamcloud.com>
Fri, 19 May 2023 07:08:12 +0000 (07:08 +0000)
sanity-sec test_31 adds an LNet network tcp999, and associated
servicenode param on MDS target. This param must be cleared when
exiting the test, otherwise it can lead to incorrect client HA
behavior, trying to reach out to the fake service nodes.

Test-Parameters: trivial
Test-Parameters: mdscount=2 mdtcount=4 osscount=1 ostcount=8 clientcount=2 \
    clientselinux testlist=sanity-sec env=SHARED_KEY=true,ONLY="31 61"
Fixes: c508c94268 ("LU-16557 client: -o network needs add_conn processing")
Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: If3a1926855bd23e9154c9a32b7a555e934e94565
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50766
Reviewed-by: Sarah Liu <sarah@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/tests/sanity-sec.sh

index fa99f98..23e4074 100755 (executable)
@@ -2299,6 +2299,8 @@ test_30b() {
 run_test 30b "basic test of all different SSK flavors"
 
 cleanup_31() {
+       local failover_mds1=$1
+
        # unmount client
        zconf_umount $HOSTNAME $MOUNT || error "unable to umount client"
 
@@ -2312,6 +2314,22 @@ cleanup_31() {
        KZPOOL=$KEEP_ZPOOL
        export KEEP_ZPOOL="true"
        stopall
+
+       do_facet mds1 $TUNEFS --erase-param failover.node $(mdsdevname 1)
+       if [ -n "$failover_mds1" ]; then
+               do_facet mds1 $TUNEFS \
+                       --servicenode=$failover_mds1 $(mdsdevname 1)
+       else
+               # If no service node previously existed, setting one in test_31
+               # added the no_primnode flag to the target. To remove everything
+               # and clear the flag, add a meaningless failnode and remove it.
+               do_facet mds1 $TUNEFS \
+                       --failnode=$(do_facet mds1 $LCTL list_nids | head -1) \
+                       $(mdsdevname 1)
+               do_facet mds1 $TUNEFS \
+                       --erase-param failover.node $(mdsdevname 1)
+       fi
+
        export SK_MOUNTED=false
        writeconf_all
        setupall || echo 1
@@ -2326,13 +2344,22 @@ test_31() {
        local mdsnid=$(do_facet mds1 $LCTL list_nids | head -1)
        local addr1=${mdsnid%@*}
        local addr2=${addr1%.*}.$(((${addr1##*.} + 11) % 256))
+       local failover_mds1
 
        export LNETCTL=$(which lnetctl 2> /dev/null)
 
        [ -z "$LNETCTL" ] && skip "without lnetctl support." && return
        local_mode && skip "in local mode."
 
-       stack_trap cleanup_31 EXIT
+       # save mds failover nids for restore at cleanup
+       failover_mds1=$(do_facet mds1 $TUNEFS --dryrun $(mdsdevname 1))
+       if [ -n "$failover_mds1" ]; then
+               failover_mds1=${failover_mds1##*Parameters:}
+               failover_mds1=${failover_mds1%%exiting*}
+               failover_mds1=$(echo $failover_mds1 | tr ' ' '\n' |
+                               grep failover.node | cut -d'=' -f2-)
+       fi
+       stack_trap "cleanup_31 $failover_mds1" EXIT
 
        # umount client
        if [ "$MOUNT_2" ] && $(grep -q $MOUNT2' ' /proc/mounts); then