From 8bc0037938af28fa034197a0aad9c07c8acf41a6 Mon Sep 17 00:00:00 2001 From: Bob Lantz Date: Thu, 22 Apr 2010 17:05:27 -0700 Subject: [PATCH] Fixed link check and updated quietRun interface. Link check wasn't quite right - e.g. 'eth1' could be found in 'eth10' previously. Updated quietRun to allow passing in args directly rather than as a list. --- mininet/util.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mininet/util.py b/mininet/util.py index db2dd92..c16dfc3 100644 --- a/mininet/util.py +++ b/mininet/util.py @@ -17,9 +17,11 @@ def checkRun( cmd ): cmd: list of command params""" return check_call( cmd.split( ' ' ) ) -def quietRun( cmd ): +def quietRun( *cmd ): """Run a command, routing stderr to stdout, and return the output. cmd: list of command params""" + if len( cmd ) == 1: + cmd = cmd[ 0 ] if isinstance( cmd, str ): cmd = cmd.split( ' ' ) popen = Popen( cmd, stdout=PIPE, stderr=STDOUT ) @@ -87,7 +89,7 @@ def moveIntfNoRetry( intf, node, printError=False ): cmd = 'ip link set ' + intf + ' netns ' + repr( node.pid ) quietRun( cmd ) links = node.cmd( 'ip link show' ) - if not intf in links: + if not ( ' %s:' % intf ) in links: if printError: lg.error( '*** Error: moveIntf: ' + intf + ' not successfully moved to ' + node.name + '\n' )