Refactor configuration of message queue to be generic
In order to make the message queue generic and adaptable, I'm proposing we refactor the way that the message queue configuration variables are structured.
Currently, the message queue configuration variables are tied to RabbitMQ:
from nova/flags.py:
DEFINE_
...
DEFINE_
DEFINE_
DEFINE_
DEFINE_
DEFINE_
A more future-proof and generic way to structure configuration might be to do something like the following:
DEFINE_
DEFINE_
DEFINE_
DEFINE_
DEFINE_
DEFINE_
Since we are using gflags instead of something like Cement (which has support for namespaced configuration variables), I've prefixed the configuration variables that describe message queue functionality with "mq_".
I removed the fake_rabbit boolean flag and replaced it, instead, with a string flag called 'mq_adapter' which defaults to 'rabbitmq'.
In the test suites, we could add the following:
self.flags(
or just:
self.flags(
which would simply fill the test case's message queue implementation with an instance of the fake MQ.
This would make a lot of code like this (from nova/rpc.py) more adaptable:
class Connection(
@classmethod
def instance(cls):
if not hasattr(cls, '_instance'):
params = dict(hostname=
if FLAGS.fake_rabbit:
return cls._instance
to something more like this:
class Connection(
@classmethod
def instance(cls):
if not hasattr(cls, '_instance'):
mq = self._get_
return cls._instance
def _find_mq_
if adapter == 'rabbitmq':
elif adapter == 'fake':
return mq_adapter()
Whiteboard
After lots of research into this, I've decided that using the existing Celery distributed task queue manager is probably the best solution to this. There is a blueprint and wiki spec for it here:
https:/
http://