Aliases for deprecated transport names

Registered by Mark McLoughlin

We need to configure deprecated transport driver configurations like

   rpc_backend = nova.openstack.common.rpc.impl_kombu

i.e. 'nova.openstack.common.rpc.impl_kombu' is essentially a deprecated alias for 'rabbit'

Initially, we thought we'd support this by having each project put something like the following in their setup.cfg:

# These are for backwards compat with Grizzly rpc_backend configuration values
oslo.messaging.drivers =
    nova.openstack.common.rpc.impl_kombu = oslo.messaging._drivers.impl_rabbit:RabbitDriver
    nova.openstack.common.rpc.impl_qpid = oslo.messaging._drivers.impl_qpid:QpidDriver
    nova.openstack.common.rpc.impl_zmq = oslo.messaging._drivers.impl_zmq:ZmqDriver

However, we now realize that code like this:

  url = str(TransportURL(conf))

will generate a bogus URL string like:

  nova.openstack.common.rpc.impl_kombu://guest:secret@localhost:5672/child_cell

So, we want to supply these transport aliases to the TransportURL constructor and have the Transport.transport property use this set of aliases to map rpc_backend to the canonical transport driver name:

      transport_aliases = {
          'nova.openstack.common.rpc.impl_kombu': 'rabbit',
          'nova.openstack.common.rpc.impl_qpid': 'qpid',
          'nova.openstack.common.rpc.impl_zmq': 'zmq',
      }

    def get_transport(conf, url=None, allowed_remote_exmods=[], transport_aliases=None):
        ...
        # pass the aliases to TransportURL.parse() so that if e.g. url == None, we map rpc_backend to the transport name using the aliases dict
        # note: this assumes a transport URL string will not use the deprecated aliases; this is only support for rpc_backend values

    class TransportURL(object):
        ...
        def __init__(self, conf, transport=None, virtual_host=None, hosts=None, transport_aliases=None):
            ...
        @property
        def transport(self):
            if self._transport is None:
                # map conf.rpc_backend using the aliases dict

Note: the advantage of this way of describing the aliases is that e.g. Nova's setup.cfg doesn't need to know the rabbit driver is oslo.messaging._drivers.impl_rabbit:RabbitDriver ... knowledge of which is arguably not part of oslo.messaging's public API

Blueprint information

Status:
Complete
Approver:
Mark McLoughlin
Priority:
High
Drafter:
Mark McLoughlin
Direction:
Approved
Assignee:
Mark McLoughlin
Definition:
Approved
Series goal:
Accepted for icehouse
Implementation:
Implemented
Milestone target:
milestone icon 1.3.0
Started by
Mark McLoughlin
Completed by
Mark McLoughlin

Related branches

Sprints

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.