[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240216152846.1850120-5-aconole@redhat.com>
Date: Fri, 16 Feb 2024 10:28:43 -0500
From: Aaron Conole <aconole@...hat.com>
To: netdev@...r.kernel.org
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Pravin B Shelar <pshelar@....org>,
dev@...nvswitch.org,
Ilya Maximets <i.maximets@....org>,
Simon Horman <horms@....org>,
Eelco Chaudron <echaudro@...hat.com>,
Shuah Khan <shuah@...nel.org>,
linux-kselftest@...r.kernel.org
Subject: [RFC 4/7] selftests: openvswitch: delete previously allocated netns
Many openvswitch test cases reused netns and interface names. This works
fine as long as the test case cleans up gracefully. However, if there is
some kind of ungraceful termination (such as an external signal) the netns
or interfaces can be left lingering. This happens when the selftest
timeout gets exceeded, while running under very slow debugging conditions.
The solution here is to cleanup the netns on executing the next test.
Signed-off-by: Aaron Conole <aconole@...hat.com>
---
tools/testing/selftests/net/openvswitch/openvswitch.sh | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/testing/selftests/net/openvswitch/openvswitch.sh b/tools/testing/selftests/net/openvswitch/openvswitch.sh
index 678a72ad47c1..8dc315585710 100755
--- a/tools/testing/selftests/net/openvswitch/openvswitch.sh
+++ b/tools/testing/selftests/net/openvswitch/openvswitch.sh
@@ -115,6 +115,10 @@ ovs_netns_spawn_daemon() {
ovs_add_netns_and_veths () {
info "Adding netns attached: sbx:$1 dp:$2 {$3, $4, $5}"
+ ntns_e=`ip netns list | grep $3`
+ [ "$ntns_e" != "" ] && ip netns del "$3"
+ if4_e=`ip link show $4 2>/dev/null`
+ [ "$if4_e" != "" ] && ip link del "$4"
ovs_sbx "$1" ip netns add "$3" || return 1
on_exit "ovs_sbx $1 ip netns del $3"
ovs_sbx "$1" ip link add "$4" type veth peer name "$5" || return 1
--
2.41.0
Powered by blists - more mailing lists