make the DHCP agent use a unique queue name

fixes bug: 1084621

This generates a unique name, so that multiple agents can be active
within a deployment.

Change-Id: Ia2bdc27866e6aa4aebd0bd28d1dfd25c3167dd03
This commit is contained in:
Mark McClain 2012-11-29 12:26:29 -05:00
parent bc3ff97870
commit d0a284de2f
2 changed files with 4 additions and 0 deletions

View File

@ -24,6 +24,7 @@ from quantum.openstack.common.notifier import api
from quantum.openstack.common.notifier import rpc_notifier from quantum.openstack.common.notifier import rpc_notifier
from quantum.openstack.common import rpc from quantum.openstack.common import rpc
from quantum.openstack.common.rpc import proxy from quantum.openstack.common.rpc import proxy
from quantum.openstack.common import uuidutils
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -88,7 +89,9 @@ class NotificationDispatcher(object):
self.connection = rpc.create_connection(new=True) self.connection = rpc.create_connection(new=True)
topic = '%s.%s' % (rpc_notifier.CONF.notification_topics[0], topic = '%s.%s' % (rpc_notifier.CONF.notification_topics[0],
api.CONF.default_notification_level.lower()) api.CONF.default_notification_level.lower())
queue_name = 'notification_listener_%s' % uuidutils.generate_uuid()
self.connection.declare_topic_consumer(topic=topic, self.connection.declare_topic_consumer(topic=topic,
queue_name=queue_name,
callback=self._add_to_queue) callback=self._add_to_queue)
self.connection.consume_in_thread() self.connection.consume_in_thread()

View File

@ -82,6 +82,7 @@ class AgentRPCNotificationDispatcher(unittest.TestCase):
expected = [ expected = [
mock.call(new=True), mock.call(new=True),
mock.call().declare_topic_consumer(topic='notifications.info', mock.call().declare_topic_consumer(topic='notifications.info',
queue_name=mock.ANY,
callback=nd._add_to_queue), callback=nd._add_to_queue),
mock.call().consume_in_thread() mock.call().consume_in_thread()
] ]