From 1955a430556afed48ad0bf87ce07f6e5b70cdfbb Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 14 Jul 2018 15:55:58 -0700 Subject: [PATCH] [vs]: clean up process running in server namespace for vstests (#1862) Signed-off-by: Guohan Lu --- platform/vs/tests/conftest.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/platform/vs/tests/conftest.py b/platform/vs/tests/conftest.py index 0752b86fde..9256597f5e 100644 --- a/platform/vs/tests/conftest.py +++ b/platform/vs/tests/conftest.py @@ -90,6 +90,11 @@ class VirtualServer(object): def __del__(self): if self.cleanup: + pids = subprocess.check_output("ip netns pids %s" % (self.nsname), shell=True) + if pids: + for pid in pids.split('\n'): + if len(pid) > 0: + os.system("kill %s" % int(pid)) os.system("ip netns delete %s" % self.nsname) def runcmd(self, cmd):