[vs]: clean up process running in server namespace for vstests (#1862)

Signed-off-by: Guohan Lu <gulv@microsoft.com>
This commit is contained in:
lguohan 2018-07-14 15:55:58 -07:00 committed by GitHub
parent 015d2d1d09
commit 1955a43055
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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):