Clean up display
Don't print retry errors by default.
This commit is contained in:
+3
-3
@@ -344,12 +344,13 @@ def makeIntfPair( intf1, intf2 ):
|
|||||||
cmd = 'ip link add name ' + intf1 + ' type veth peer name ' + intf2
|
cmd = 'ip link add name ' + intf1 + ' type veth peer name ' + intf2
|
||||||
return checkRun( cmd )
|
return checkRun( cmd )
|
||||||
|
|
||||||
def moveIntf( intf, node ):
|
def moveIntf( intf, node, print_error = False ):
|
||||||
"Move intf to node."
|
"Move intf to node."
|
||||||
cmd = 'ip link set ' + intf + ' netns ' + `node.pid`
|
cmd = 'ip link set ' + intf + ' netns ' + `node.pid`
|
||||||
quietRun( cmd )
|
quietRun( cmd )
|
||||||
links = node.cmd( 'ip link show' )
|
links = node.cmd( 'ip link show' )
|
||||||
if not intf in links:
|
if not intf in links:
|
||||||
|
if print_error:
|
||||||
print "*** Error: moveIntf:", intf, "not successfully moved to",
|
print "*** Error: moveIntf:", intf, "not successfully moved to",
|
||||||
print node.name,":"
|
print node.name,":"
|
||||||
return False
|
return False
|
||||||
@@ -360,10 +361,9 @@ def retry( n, retry_delay, fn, *args):
|
|||||||
tries = 0
|
tries = 0
|
||||||
while not apply( fn, args ) and tries < n:
|
while not apply( fn, args ) and tries < n:
|
||||||
sleep( retry_delay )
|
sleep( retry_delay )
|
||||||
print "*** retrying..."; flush()
|
|
||||||
tries += 1
|
tries += 1
|
||||||
if tries >= n:
|
if tries >= n:
|
||||||
print "*** giving up"
|
print "*** gave up after %i retries" % tries; flush()
|
||||||
exit( 1 )
|
exit( 1 )
|
||||||
|
|
||||||
def createLink( node1, node2 ):
|
def createLink( node1, node2 ):
|
||||||
|
|||||||
Reference in New Issue
Block a user