Skip to content

Commit 9db6cdc

Browse files
committed
Call delete() in link.stop() ; warn on exited node.cmd()
We should think a bit about the semantics that we want here. The comments say "stop and clean up link" so perhaps that's what we want. However, we could also imagine stop stopping forwarding on the link (and possibly allowing restarts). We warn on exited node.cmd() because we terminate the controller before stopping/deleting the links. This makes sense to avoid a storm of link/port down events, but since the controller's shell has exited we cannot call link.stop() on any of its links. We may want to simply stop the controller and not terminate it, but at least it doesn't hang for now.
1 parent f7b2933 commit 9db6cdc

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

mininet/link.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -465,13 +465,13 @@ def makeIntfPair( cls, intfname1, intfname2, addr1=None, addr2=None,
465465
def delete( self ):
466466
"Delete this link"
467467
self.intf1.delete()
468-
# We only need to delete one side, but this doesn't seem to
469-
# cost us anything and may help subclasses.
470-
self.intf2.delete()
468+
# We only need to delete one side, though this doesn't seem to
469+
# cost us much and might help subclasses.
470+
# self.intf2.delete()
471471

472472
def stop( self ):
473473
"Override to stop and clean up link as needed"
474-
pass
474+
self.delete()
475475

476476
def status( self ):
477477
"Return link status as a string"

mininet/node.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def sendCmd( self, *args, **kwargs ):
259259
and return without waiting for the command to complete.
260260
args: command and arguments, or string
261261
printPid: print command's PID?"""
262-
assert not self.waiting
262+
assert self.shell and not self.waiting
263263
printPid = kwargs.get( 'printPid', True )
264264
# Allow sendCmd( [ list ] )
265265
if len( args ) == 1 and isinstance( args[ 0 ], list ):
@@ -339,8 +339,11 @@ def cmd( self, *args, **kwargs ):
339339
verbose = kwargs.get( 'verbose', False )
340340
log = info if verbose else debug
341341
log( '*** %s : %s\n' % ( self.name, args ) )
342-
self.sendCmd( *args, **kwargs )
343-
return self.waitOutput( verbose )
342+
if self.shell:
343+
self.sendCmd( *args, **kwargs )
344+
return self.waitOutput( verbose )
345+
else:
346+
warn( '(%s exited - ignoring cmd%s)\n' % ( self, args ) )
344347

345348
def cmdPrint( self, *args):
346349
"""Call cmd and printing its output

0 commit comments

Comments
 (0)