Clean things up slightly.

This commit is contained in:
Bob Lantz
2014-02-06 17:50:09 -08:00
parent 1fda4865c8
commit 9cf9b7b223
+11 -9
View File
@@ -47,24 +47,26 @@ def cleanup():
cleanUpScreens()
info( "*** Removing excess kernel datapaths\n" )
dps = sh( "ps ax | egrep -o 'dp[0-9]+' | sed 's/dp/nl:/'" ).split( '\n' )
dps = sh( "ps ax | egrep -o 'dp[0-9]+' | sed 's/dp/nl:/'" ).splitlines()
for dp in dps:
if dp != '':
if dp:
sh( 'dpctl deldp ' + dp )
info( "*** Removing OVS datapaths" )
dps = sh("ovs-vsctl --timeout=1 list-br").split( '\n' )
sh( "ovs-vsctl " + " -- ".join( "--if-exists del-br " + dp for dp in dps if dp ) )
dps = sh("ovs-vsctl --timeout=1 list-br").strip().splitlines()
if dps:
sh( "ovs-vsctl " + " -- ".join( "--if-exists del-br " + dp
for dp in dps if dp ) )
# And in case the above didn't work...
dps = sh("ovs-vsctl --timeout=1 list-br").split( '\n' )
dps = sh("ovs-vsctl --timeout=1 list-br").strip().splitlines()
for dp in dps:
if dp:
sh( 'ovs-vsctl del-br ' + dp )
sh( 'ovs-vsctl del-br ' + dp )
info( "*** Removing all links of the pattern foo-ethX\n" )
links = sh( r"ip link show | egrep -o '([-_.[:alnum:]]+-eth[[:digit:]]+)'" ).split( '\n' )
links = sh( "ip link show | "
"egrep -o '([-_.[:alnum:]]+-eth[[:digit:]]+)'" ).splitlines()
for link in links:
if link != '':
if link:
sh( "ip link del " + link )
info( "*** Cleanup complete.\n" )