Clean up intfs in root NS, and avoid deleting HW intfs

It appears that under certain conditions, such as when a
namespace exits, both ends of a veth pair may get dumped
into the root namespace. We therefore now remove an interface
both from its home namespace and from the root namespace.
This commit is contained in:
Bob Lantz
2013-07-04 19:27:57 -07:00
parent fcdb6d8a54
commit 10be691b86
3 changed files with 20 additions and 16 deletions
+4 -3
View File
@@ -25,7 +25,7 @@ Link: basic link class for creating veth pairs
"""
from mininet.log import info, error, debug
from mininet.util import makeIntfPair
from mininet.util import makeIntfPair, quietRun
from time import sleep
import re
@@ -162,8 +162,9 @@ class Intf( object ):
def delete( self ):
"Delete interface"
self.cmd( 'ip link del ' + self.name )
# Does it help to sleep to let things run?
sleep( 0.001 )
if self.node.inNamespace:
# Link may have been dumped into root NS
quietRun( 'ip link del ' + self.name )
def __repr__( self ):
return '<%s %s>' % ( self.__class__.__name__, self.name )