@utils.synchronized(SERIAL_LOCK)
def acquire_port(host):
 (start, stop) = _get_port_range()
 for port in six.moves.range(start, stop):
  if ((host, port) in ALLOCATED_PORTS):
   continue
  try:
   _verify_port(host, port)
   ALLOCATED_PORTS.add((host, port))
   return port
  except exception.SocketPortInUseException as e:
   LOG.warning(e.format_message())
 raise exception.SocketPortRangeExhaustedException(host=host)

@ utils . synchronized ( SERIAL_LOCK ) def acquire_port ( host ) : ( start , stop ) = _get_port_range ( ) for port in six . moves . range ( start , stop ) : if ( ( host , port ) in ALLOCATED_PORTS ) : continue try : _verify_port ( host , port ) ALLOCATED_PORTS . add ( ( host , port ) ) return port except exception . SocketPortInUseException as e : LOG . warning ( e . format_message ( ) ) raise exception . SocketPortRangeExhaustedException ( host = host )
returns a free tcp port on host .