Updated openstack/openstack
Project: openstack/oslo.messaging  7914181398630cbcbc25543d72871ccf812df517
null
Properly handle transport URL config on the client

On the client side, in the rabbit and qpid drivers, we use a connection
pool to avoid opening a connection for each message we send. However,
there is only currently one connection pool per process:

 def get_connection_pool(conf, connection_cls):
     with _pool_create_sem:
         # Make sure only one thread tries to create the connection pool.
         if not connection_cls.pool:
             connection_cls.pool = ConnectionPool(conf, connection_cls)
     return connection_cls.pool

This is a nasty artifact of the original RPC having no conectp of a
transport context - everything was a global. We'll fix this soon enough.

In the meantime, we need to make sure we only use this connection pool
where we're not using the default transport configuration from the
config file - i.e. where we supply a transport URL.

The use case here is cells - we send messages to a remote cell by
connecting to it using a transport URL. In our devstack testing, the
two cells are on the same Rabbit broker but under different virtual
hosts. Because we were always using the connection pool on the client
side, we were seeing both cells always send messages to the '/' virtual
host.

Note - avoiding the connection pool in the case of cells is the same
behaviour as the current RPC code:

 def cast_to_server(conf, context, server_params, topic, msg, connection_pool):
     ...
     with ConnectionContext(conf, connection_pool, pooled=False,
                            server_params=server_params) as conn:

Change-Id: I2f35b45ef237bb85ab8faf58a408c03fcb1de9d7