From 4ec5e98b2d98a2fb15390c9a563f22852141fc09 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. Lustre-change: https://review.whamcloud.com/45834 Lustre-commit: e41f91dc90a0977f7ea85b199b7e5809c56b810e Test-Parameters: trivial testlist=sanity-lnet Change-Id: Ifffc51625f5c2ffbb3ab811b75739c0e6407a821 Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/51666 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Cyril Bordage Reviewed-by: Andreas Dilger --- lustre/scripts/ksocklnd-config | 2 +- lustre/tests/sanity-lnet.sh | 35 ++---------------------- lustre/tests/test-framework.sh | 62 ++++++++++++++++++++++++++++-------------- 3 files changed, 45 insertions(+), 54 deletions(-) diff --git a/lustre/scripts/ksocklnd-config b/lustre/scripts/ksocklnd-config index b44992e..b716cfd 100755 --- a/lustre/scripts/ksocklnd-config +++ b/lustre/scripts/ksocklnd-config @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash me="${0##*/}" diff --git a/lustre/tests/sanity-lnet.sh b/lustre/tests/sanity-lnet.sh index 5dae873..6358ddd 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 @@ -1854,7 +1825,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 ]] && @@ -1865,7 +1836,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 c19f119..09e4100 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -671,22 +671,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. @@ -730,23 +721,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