From 412970c586ea189d442620316c5ed6f1fa43cc0e Mon Sep 17 00:00:00 2001 From: Chris Horn Date: Thu, 24 Jun 2021 13:37:42 -0500 Subject: [PATCH] LU-14790 tests: Check NI status when link is downed Add test to check that NI status is set to down when the ni_fatal_error_on flag is set (i.e. when a link is down). HPE-bug-id: LUS-10167 Test-Parameters: trivial testlist=sanity-lnet Signed-off-by: Chris Horn Change-Id: If98a899b0ee8dd9637c08774109668ad06244c60 Reviewed-on: https://review.whamcloud.com/44073 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Serguei Smirnov Reviewed-by: Cyril Bordage Reviewed-by: Oleg Drokin --- lustre/tests/sanity-lnet.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/lustre/tests/sanity-lnet.sh b/lustre/tests/sanity-lnet.sh index 784ad85..df22b37 100755 --- a/lustre/tests/sanity-lnet.sh +++ b/lustre/tests/sanity-lnet.sh @@ -1998,6 +1998,53 @@ test_213() { } run_test 213 "Check LNetDist calculation for multiple local NIDs" +function check_ni_status() { + local nid="$1" + local expect="$2" + + local status=$($LNETCTL net show | + grep -A 1 ${nid} | + awk '/status/{print $NF}') + + echo "NI ${nid} expect status \"${expect}\" found \"${status}\"" + if [[ $status != $expect ]]; then + error "Error: Expect NI status \"$expect\" for NID \"$nid\" but found \"$status\"" + fi + + return 0 +} + +test_214() { + have_interface "eth0" || skip "Need eth0 interface with ipv4 configured" + + cleanup_netns || error "Failed to cleanup netns before test execution" + cleanup_lnet || error "Failed to unload modules before test execution" + + setup_fakeif || error "Failed to add fake IF" + have_interface "$FAKE_IF" || + error "Expect $FAKE_IF configured but not found" + + reinit_dlc || return $? + + add_net "tcp" "eth0" || return $? + add_net "tcp" "$FAKE_IF" || return $? + + local nid1=$(lctl list_nids | head -n 1) + local nid2=$(lctl list_nids | tail --lines 1) + + check_ni_status "0@lo" up + check_ni_status "$nid1" up + check_ni_status "$nid2" up + + echo "Set $FAKE_IF down" + echo "ip link set dev $FAKE_IF down" + ip link set dev $FAKE_IF down + check_ni_status "0@lo" up + check_ni_status "$nid1" up + check_ni_status "$nid2" down +} +run_test 214 "Check local NI status when link is downed" + test_230() { # LU-12815 echo "Check valid values; Should succeed" -- 1.8.3.1