Shut down a list of OVS switches
( cls, switches, run=errRun )
| 1303 | |
| 1304 | @classmethod |
| 1305 | def batchShutdown( cls, switches, run=errRun ): |
| 1306 | "Shut down a list of OVS switches" |
| 1307 | delcmd = 'del-br %s' |
| 1308 | if switches and not switches[ 0 ].isOldOVS(): |
| 1309 | delcmd = '--if-exists ' + delcmd |
| 1310 | # First, delete them all from ovsdb |
| 1311 | run( 'ovs-vsctl ' + |
| 1312 | ' -- '.join( delcmd % s for s in switches ) ) |
| 1313 | # Next, shut down all of the processes |
| 1314 | pids = ' '.join( str( switch.pid ) for switch in switches ) |
| 1315 | run( 'kill -HUP ' + pids ) |
| 1316 | for switch in switches: |
| 1317 | switch.terminate() |
| 1318 | return switches |
| 1319 | |
| 1320 | |
| 1321 | OVSKernelSwitch = OVSSwitch |