[openstack-dev] [Horizon[ Update on the realtime-communication blueprint
Tomas Sedovic
tsedovic at redhat.com
Mon Jun 24 16:45:59 UTC 2013
All,
Presenting a new version of the proof of concept for the
realtime-communication Horizon blueprint[0]. Here's the code:
https://review.openstack.org/#/q/status:open+project:openstack/horizon+branch:master+topic:bp/realtime-communication,n,z
Following the previous discussion, this iteration listens to the
OpenStack notifications and passes them using websocket (or one of the
fallbacks) to the connected browsers. That means adding oslo-incubator
as a dependency (the RPC bits of it at least).
The code grew a bit more complex, because as far as I can see, the RPC
helpers in oslo-incubator are deeply intertwined with eventlet, but
there is no suitable web realtime library built on top of eventlet*.
The available solutions are built on top of gevent or tornado, both of
which come with their own event loops. In order to both receive
notifications and push them to the browsers, we need two separate
threads, one for each event loop.
We're only talking about a 150 lines of code and I don't expect it to
grow much beyond that, so I'm not really worried about that now. But if
there are better solutions, please share them.
The original PoC was built on top of gevent and gevent-socketio, neither
of which is likely to be Python3-compatible any time soon. Since that's
a requirement for new dependencies, I've switched to Tornado[1] and
SockJS-tornado[2] that are both compatible with Python 3.
I didn't add the dependencies to openstack/requirements[3] yet but if
you are fine with this stack, I shall do so and we can start thinking
about merging this.
To try it out, please run the server:
./horizon-realtime.py --config-file etc/horizon/horizon-realtime.conf
navigate to `http://localhost:8080/project/instances` (you can verify
the WebSocket connection in the JavaScript console) and then launch an
instance out of band (e.g. via the nova command line). The webpage
should update automatically when you add, suspend, resume or delete the
instance.
T.
[0]: https://blueprints.launchpad.net/horizon/+spec/realtime-communication
[1]: http://www.tornadoweb.org/en/stable/
[2]: https://github.com/mrjoes/sockjs-tornado
[3]: https://github.com/openstack/requirements
* eventlet ships with a WebSocket implementation, but it lacks the
fallback transports, etc. that socket.io and SockJS provide.
More information about the OpenStack-dev
mailing list