]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Cleanup veth-pairs in default netns for functional tests
authorAndreas Scheuring <andreas.scheuring@de.ibm.com>
Fri, 4 Dec 2015 07:35:28 +0000 (08:35 +0100)
committerAndreas Scheuring <andreas.scheuring@de.ibm.com>
Fri, 4 Dec 2015 07:35:28 +0000 (08:35 +0100)
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

neutron/tests/common/net_helpers.py

index 21ae7d9c977dc56afc11a536e82e0305e8446fd0..36316c2170720229dfd65784b0fa5e4b9a669aa0 100644 (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