Use Neutron's push notification for state

Registered by Antoni Segura Puimedon

When we create network resources in OpenStack we currently go into polling mode until the ports go active. It is worthy to investigate the gains we'd get (and the decreased load on the Neutron server) by using OpenStack oslo_messaging push notifications.

Blueprint information

Not started
Antoni Segura Puimedon
Antoni Segura Puimedon
Needs approval
Series goal:
Milestone target:

Related branches



Here you can see an example of connecting to the stream using Kombu (what oslo_messaging uses in the background when the transport is amqp:

Here there's a related example of consuming the events with oslo messaging:

Of course there's several questions raised:
- Do we want to have the controller connect to rabbitmq? Do we want to simplify the controller so that the port active events are watched instead by the CNI Daemon and have the Daemon set the ports active itself?
- Do we want instead to try to make a Neutron http stream agent that then we can use with the current watch facility?

Addressed by:
    Use neutron rpc for port status checking

Addressed by:
    Disable N530 PEP8 warning

Gerrit topic:

Pitfalls or why this approach can't be used out of the box.

I tested oslo_messaging_notification on Ocata and on Stein. I used the same sample as in

 On both of it I can receive messages which neutron server sends.
    oslo.messaging.notification.port.create.start|end message when we create new port and
    oslo.messaging.notification.port.delete.start|end message when we delete port.
    The status of the port in payload is DOWN in any cases, and oslo.messaging.notification.port.create.end comes even in case when I advisedly disable port binding (just by misconfigure or stop of neutron-openvswitch-agent).
    So I didn't find any events which can help to distinguish port status changing to ACTIVE.
    I tried to figure out by code /usr/lib/python2.7/site-packages/neutron/plugins/ml2/ has method which tracks down port creation/deletion/updating and sends notification through oslo_messaging_notification.
    REMARKS this file contains two type of notification

         registry.notify(resources.PORT, events.AFTER_CREATE, self, **kwargs)

        it's notification which working through default rabbitmq, patch for that was proposed by Ilya. But it was concern.

        self.notifier.port_update(mech_context._plugin_context, port,

        It's what we need, it works through [oslo_messaging_notification]
    I tested it on OpenStack with nova-compute, in case of nova-instance
    oslo.messaging.notification.port.update.start|end sends in this case, but w/o status ACTIVE, status still was DOWN.

As a result we can't handle port status changes this way right now

As an approach of solving it, we can add port update notification call to the neutron openvswitch agent.
Looks like /usr/lib/python2.7/site-packages/neutron/agent/ - record_resource_update method of the RemoteResourceCache it's a proper place for it.


Work Items

This blueprint contains Public information 
Everyone can see this information.