Cleanup veth-pairs in default netns for functional tests

Today, veth-pairs created by the VethFixture of the net_helpers class
are not cleanup on teardown. This is solved by this patch.

Change-Id: I0a969e31e6694d74a9af6ada4e4e707c6332ffeb
Closes-Bug: #1522710
This commit is contained in:
Andreas Scheuring 2015-12-04 08:35:28 +01:00
parent 205e8e4af9
commit 6ec16458fe
1 changed files with 2 additions and 1 deletions

View File

@ -419,7 +419,8 @@ class VethFixture(fixtures.Fixture):
def destroy(self):
for port in self.ports:
ip_wrapper = ip_lib.IPWrapper(port.namespace)
if ip_wrapper.netns.exists(port.namespace):
if (ip_wrapper.netns.exists(port.namespace) or
port.namespace is None):
try:
ip_wrapper.del_veth(port.name)
break