Don't stop switches that we've already stopped.
Note that this also changes the way that links are deleted; the reason is that the batch shutdown doesn't currently delete the links, but OVSSwitch.stop() does. We may wish to revisit this in the future.
This commit is contained in:
+15
-10
@@ -495,20 +495,25 @@ class Mininet( object ):
|
|||||||
if self.terms:
|
if self.terms:
|
||||||
info( '*** Stopping %i terms\n' % len( self.terms ) )
|
info( '*** Stopping %i terms\n' % len( self.terms ) )
|
||||||
self.stopXterms()
|
self.stopXterms()
|
||||||
info( '*** Stopping %i switches\n' % len( self.switches ) )
|
|
||||||
for swclass, switches in groupby(
|
|
||||||
sorted( self.switches, key=type ), type ):
|
|
||||||
if hasattr( swclass, 'batchShutdown' ):
|
|
||||||
swclass.batchShutdown( switches )
|
|
||||||
for switch in self.switches:
|
|
||||||
info( switch.name + ' ' )
|
|
||||||
switch.stop()
|
|
||||||
switch.terminate()
|
|
||||||
info( '\n' )
|
|
||||||
info( '*** Stopping %i links\n' % len( self.links ) )
|
info( '*** Stopping %i links\n' % len( self.links ) )
|
||||||
for link in self.links:
|
for link in self.links:
|
||||||
|
info( '.' )
|
||||||
link.stop()
|
link.stop()
|
||||||
info( '\n' )
|
info( '\n' )
|
||||||
|
info( '*** Stopping %i switches\n' % len( self.switches ) )
|
||||||
|
stopped = {}
|
||||||
|
for swclass, switches in groupby(
|
||||||
|
sorted( self.switches, key=type ), type ):
|
||||||
|
switches = tuple( switches )
|
||||||
|
if hasattr( swclass, 'batchShutdown' ):
|
||||||
|
swclass.batchShutdown( switches )
|
||||||
|
stopped.update( { s: s for s in switches } )
|
||||||
|
for switch in self.switches:
|
||||||
|
info( switch.name + ' ' )
|
||||||
|
if switch not in stopped:
|
||||||
|
switch.stop()
|
||||||
|
switch.terminate()
|
||||||
|
info( '\n' )
|
||||||
info( '*** Stopping %i hosts\n' % len( self.hosts ) )
|
info( '*** Stopping %i hosts\n' % len( self.hosts ) )
|
||||||
for host in self.hosts:
|
for host in self.hosts:
|
||||||
info( host.name + ' ' )
|
info( host.name + ' ' )
|
||||||
|
|||||||
Reference in New Issue
Block a user