Exemplo n.º 1
0
 def batchShutdown(cls, switches, **_kwargs):
     key = attrgetter('server')
     for server, switchGroup in groupby(sorted(switches, key=key), key):
         info('(%s)' % server)
         group = tuple(switchGroup)
         switch = group[0]
         OVSSwitch.batchShutdown(group, run=switch.rcmd)
     return switches
Exemplo n.º 2
0
 def batchShutdown( cls, switches, **_kwargs ):
     "Stop switches in per-server batches"
     key = attrgetter( 'server' )
     for server, switchGroup in groupby( sorted( switches, key=key ), key ):
         info( '(%s)' % server )
         group = tuple( switchGroup )
         switch = group[ 0 ]
         OVSSwitch.batchShutdown( group, run=switch.rcmd )
     return switches
Exemplo n.º 3
0
 def batchShutdown(cls, switches, **_kwargs):
     """
     :return: stopped switches (in per-server batches)
     """
     key = attrgetter('serverIp')
     for server, switchBatch in groupby(sorted(switches, key=key), key):
         info('(%s)' % server)
         batch = tuple(switchBatch)
         OVSSwitch.batchShutdown(batch, run=batch[0].rcmd)
     return switches
Exemplo n.º 4
0
 def batchShutdown( cls, switches ):
     result = []
     for ovsdb, switchGroup in groupby( switches, attrgetter( 'ovsdb') ):
         switchGroup = list( switchGroup )
         info( '(%s)' % ovsdb )
         for switch in switches:
             if switch.pid == ovsdb.pid:
                 switch.pid = None
                 switch.shell = None
         result += OVSSwitch.batchShutdown( switchGroup, run=ovsdb.cmd )
         for switch in switchGroup:
             switch.ovsdbFree()
     return result