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.
This commit is contained in:
+4
-4
@@ -465,13 +465,13 @@ class Link( object ):
|
||||
def delete( self ):
|
||||
"Delete this link"
|
||||
self.intf1.delete()
|
||||
# We only need to delete one side, but this doesn't seem to
|
||||
# cost us anything and may help subclasses.
|
||||
self.intf2.delete()
|
||||
# We only need to delete one side, though this doesn't seem to
|
||||
# cost us much and might help subclasses.
|
||||
# self.intf2.delete()
|
||||
|
||||
def stop( self ):
|
||||
"Override to stop and clean up link as needed"
|
||||
pass
|
||||
self.delete()
|
||||
|
||||
def status( self ):
|
||||
"Return link status as a string"
|
||||
|
||||
+6
-3
@@ -259,7 +259,7 @@ class Node( object ):
|
||||
and return without waiting for the command to complete.
|
||||
args: command and arguments, or string
|
||||
printPid: print command's PID?"""
|
||||
assert not self.waiting
|
||||
assert self.shell and not self.waiting
|
||||
printPid = kwargs.get( 'printPid', True )
|
||||
# Allow sendCmd( [ list ] )
|
||||
if len( args ) == 1 and isinstance( args[ 0 ], list ):
|
||||
@@ -339,8 +339,11 @@ class Node( object ):
|
||||
verbose = kwargs.get( 'verbose', False )
|
||||
log = info if verbose else debug
|
||||
log( '*** %s : %s\n' % ( self.name, args ) )
|
||||
self.sendCmd( *args, **kwargs )
|
||||
return self.waitOutput( verbose )
|
||||
if self.shell:
|
||||
self.sendCmd( *args, **kwargs )
|
||||
return self.waitOutput( verbose )
|
||||
else:
|
||||
warn( '(%s exited - ignoring cmd%s)\n' % ( self, args ) )
|
||||
|
||||
def cmdPrint( self, *args):
|
||||
"""Call cmd and printing its output
|
||||
|
||||
Reference in New Issue
Block a user