From e41f91dc90a0977f7ea85b199b7e5809c56b810e Mon Sep 17 00:00:00 2001 From: James Simmons Date: Wed, 30 Mar 2022 09:10:28 -0400 Subject: [PATCH] LU-15363 tests: don't use lustre module to test lnet Currently sanity-lnet.sh loads the lustre modules to properly initialize the lnet modules. This doesn't work with the native Linux client since it only starts up LNet after mounting the file system. We shouldn't be using lustre to test lnet so load lnet modules with config_on_load option to properly setup the default LNet configuration. Also fix ksocklnd-config to use bash so sanity-lnet.sh can pass on Ubuntu. Test-Parameters: trivial testlist=sanity-lnet Change-Id: Ifffc51625f5c2ffbb3ab811b75739c0e6407a821 Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/45834 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/scripts/ksocklnd-config | 4 +-- lustre/tests/sanity-lnet.sh | 39 ++++---------------------- lustre/tests/test-framework.sh | 62 ++++++++++++++++++++++++++++-------------- 3 files changed, 48 insertions(+), 57 deletions(-) diff --git a/lustre/scripts/ksocklnd-config b/lustre/scripts/ksocklnd-config index c06e822..b716cfd 100755 --- a/lustre/scripts/ksocklnd-config +++ b/lustre/scripts/ksocklnd-config @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash me="${0##*/}" @@ -10,7 +10,7 @@ cidr2mask() { for ((i=0;i<4;i+=1)); do if [ $i -lt $full_octets ]; then - mask+=255 + mask+=255 elif [ $i -eq $full_octets ]; then mask+=$((256 - 2**(8-$partial_octet))) else diff --git a/lustre/tests/sanity-lnet.sh b/lustre/tests/sanity-lnet.sh index ccea0d3..e45f152 100755 --- a/lustre/tests/sanity-lnet.sh +++ b/lustre/tests/sanity-lnet.sh @@ -68,35 +68,6 @@ cleanup_testsuite() { return 0 } -load_lnet() { - load_module ../libcfs/libcfs/libcfs - # Prevent local MODOPTS_LIBCFS being passed as part of environment - # variable to remote nodes - unset MODOPTS_LIBCFS - - set_default_debug "neterror net nettrace malloc" - load_module ../lnet/lnet/lnet "$@" - - LNDPATH=${LNDPATH:-"../lnet/klnds"} - if [ -z "$LNETLND" ]; then - case $NETTYPE in - o2ib*) LNETLND="o2iblnd/ko2iblnd" ;; - tcp*) LNETLND="socklnd/ksocklnd" ;; - *) local lnd="${NETTYPE%%[0-9]}lnd" - [ -f "$LNDPATH/$lnd/k$lnd.ko" ] && - LNETLND="$lnd/k$lnd" || - LNETLND="socklnd/ksocklnd" - esac - fi - load_module ../lnet/klnds/$LNETLND -} - -do_lnetctl() { - $LCTL mark "$LNETCTL $*" - echo "$LNETCTL $*" - $LNETCTL "$@" -} - TESTNS='test_ns' FAKE_IF="test1pg" FAKE_IP="10.1.2.3" @@ -250,7 +221,7 @@ cleanupall -f setup_netns || error "setup_netns failed with $?" # Determine the local interface(s) used for LNet -load_modules || error "Failed to load modules" +load_lnet "config_on_load=1" || error "Failed to load modules" do_lnetctl net show ip a @@ -1437,7 +1408,7 @@ setup_health_test() { # Loading modules should configure LNet with the appropriate # test-framework configuration - load_modules || error "Failed to load modules" + load_lnet "config_on_load=1" || error "Failed to load modules" LNIDS=( $($LCTL list_nids | xargs echo) ) @@ -1445,7 +1416,7 @@ setup_health_test() { RNIDS=( $(do_node $RNODE $LCTL list_nids | xargs echo) ) if [[ -z ${RNIDS[@]} ]]; then - do_rpc_nodes $RNODE load_modules_local + do_rpc_nodes $RNODE load_lnet "config_on_load=1" RLOADED=true RNIDS=( $(do_node $RNODE $LCTL list_nids | xargs echo) ) fi @@ -2007,7 +1978,7 @@ test_212() { # Loading modules should configure LNet with the appropriate # test-framework configuration - load_modules || error "Failed to load modules" + load_lnet "config_on_load=1" || error "Failed to load modules" local my_nid=$($LCTL list_nids | head -n 1) [[ -z $my_nid ]] && @@ -2018,7 +1989,7 @@ test_212() { local rloaded=false if [[ -z $rnodenids ]]; then - do_rpc_nodes $rnode load_modules_local + do_rpc_nodes $rnode load_lnet "config_on_load=1" rloaded=true rnodenids=$(do_node $rnode $LCTL list_nids | xargs echo) fi diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index b0a4a12..266b96a 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -676,22 +676,13 @@ load_module() { fi } -load_modules_local() { - if [ -n "$MODPROBE" ]; then - # use modprobe - echo "Using modprobe to load modules" - return 0 - fi - - # Create special udev test rules on every node - if [ -f $LUSTRE/lustre/conf/99-lustre.rules ]; then { - sed -e 's|/usr/sbin/lctl|$LCTL|g' $LUSTRE/lustre/conf/99-lustre.rules > /etc/udev/rules.d/99-lustre-test.rules - } else { - echo "SUBSYSTEM==\"lustre\", ACTION==\"change\", ENV{PARAM}==\"?*\", RUN+=\"$LCTL set_param '\$env{PARAM}=\$env{SETTING}'\"" > /etc/udev/rules.d/99-lustre-test.rules - } fi - udevadm control --reload-rules - udevadm trigger +do_lnetctl() { + $LCTL mark "$LNETCTL $*" + echo "$LNETCTL $*" + $LNETCTL "$@" +} +load_lnet() { # For kmemleak-enabled kernels we need clear all past state # that obviously has nothing to do with this Lustre run # Disable automatic memory scanning to avoid perf hit. @@ -735,23 +726,52 @@ load_modules_local() { load_module ../libcfs/libcfs/libcfs # Prevent local MODOPTS_LIBCFS being passed as part of environment # variable to remote nodes - MODOPTS_LIBCFS=$saved_opts + unset MODOPTS_LIBCFS - set_default_debug - load_module ../lnet/lnet/lnet + set_default_debug "neterror net nettrace malloc" + if [ "$1" = "config_on_load=1" ]; then + load_module ../lnet/lnet/lnet + else + load_module ../lnet/lnet/lnet "$@" + fi LNDPATH=${LNDPATH:-"../lnet/klnds"} if [ -z "$LNETLND" ]; then case $NETTYPE in - o2ib*) LNETLND="o2iblnd/ko2iblnd" ;; - tcp*) LNETLND="socklnd/ksocklnd" ;; - *) local lnd="${NETTYPE%%[0-9]}lnd" + o2ib*) LNETLND="o2iblnd/ko2iblnd" ;; + tcp*) LNETLND="socklnd/ksocklnd" ;; + *) local lnd="${NETTYPE%%[0-9]}lnd" [ -f "$LNDPATH/$lnd/k$lnd.ko" ] && LNETLND="$lnd/k$lnd" || LNETLND="socklnd/ksocklnd" esac fi load_module ../lnet/klnds/$LNETLND + + if [ "$1" = "config_on_load=1" ]; then + do_lnetctl lnet configure --all || + return $? + fi +} + +load_modules_local() { + if [ -n "$MODPROBE" ]; then + # use modprobe + echo "Using modprobe to load modules" + return 0 + fi + + # Create special udev test rules on every node + if [ -f $LUSTRE/lustre/conf/99-lustre.rules ]; then { + sed -e 's|/usr/sbin/lctl|$LCTL|g' $LUSTRE/lustre/conf/99-lustre.rules > /etc/udev/rules.d/99-lustre-test.rules + } else { + echo "SUBSYSTEM==\"lustre\", ACTION==\"change\", ENV{PARAM}==\"?*\", RUN+=\"$LCTL set_param '\$env{PARAM}=\$env{SETTING}'\"" > /etc/udev/rules.d/99-lustre-test.rules + } fi + udevadm control --reload-rules + udevadm trigger + + load_lnet + load_module obdclass/obdclass if ! client_only; then MODOPTS_PTLRPC=${MODOPTS_PTLRPC:-"lbug_on_grant_miscount=1"} -- 1.8.3.1