Don't clean up links that may have been dumped into root NS.

This should rarely happen - in the usual case, either the
links will be shut down by Mininet.stop(), or the interfaces
will be deleted by node.stop( deleteIntfs=True ), or the
links or interfaces will be explicitly deleted or stopped
using the low-level API.

Cases that are relying on links being automatically deleted
in cleanup() will potentially find that they are now no longer
deleted, but these cases should be rare.
This commit is contained in:
Bob Lantz
2015-01-26 14:06:23 -08:00
parent eafbd2a597
commit 574d634fc2
2 changed files with 8 additions and 10 deletions
+4 -3
View File
@@ -197,9 +197,10 @@ class Intf( object ):
def delete( self ): def delete( self ):
"Delete interface" "Delete interface"
self.cmd( 'ip link del ' + self.name ) self.cmd( 'ip link del ' + self.name )
if self.node.inNamespace: # We used to do this, but it slows us down:
# Link may have been dumped into root NS # if self.node.inNamespace:
quietRun( 'ip link del ' + self.name ) # Link may have been dumped into root NS
# quietRun( 'ip link del ' + self.name )
def status( self ): def status( self ):
"Return intf status as a string" "Return intf status as a string"
+4 -7
View File
@@ -194,10 +194,11 @@ class Node( object ):
def cleanup( self ): def cleanup( self ):
"Help python collect its garbage." "Help python collect its garbage."
# We used to do this, but it slows us down:
# Intfs may end up in root NS # Intfs may end up in root NS
for intfName in self.intfNames(): # for intfName in self.intfNames():
if self.name in intfName: # if self.name in intfName:
quietRun( 'ip link del ' + intfName ) # quietRun( 'ip link del ' + intfName )
self.shell = None self.shell = None
# Subshell I/O, commands and control # Subshell I/O, commands and control
@@ -1311,10 +1312,6 @@ class OVSBatch( OVSSwitch ):
super( OVSBatch, self ).stop( *args, **kwargs ) super( OVSBatch, self ).stop( *args, **kwargs )
self.started = False self.started = False
def cleanup( self):
"Don't bother to clean up"
return
class IVSSwitch( Switch ): class IVSSwitch( Switch ):
"Indigo Virtual Switch" "Indigo Virtual Switch"