From d0a284de2ff272ae65a62bc2722c0274ff1be7d2 Mon Sep 17 00:00:00 2001 From: Mark McClain Date: Thu, 29 Nov 2012 12:26:29 -0500 Subject: [PATCH] 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 --- quantum/agent/rpc.py | 3 +++ quantum/tests/unit/test_agent_rpc.py | 1 + 2 files changed, 4 insertions(+) diff --git a/quantum/agent/rpc.py b/quantum/agent/rpc.py index dc65175c88..e036822f26 100644 --- a/quantum/agent/rpc.py +++ b/quantum/agent/rpc.py @@ -24,6 +24,7 @@ from quantum.openstack.common.notifier import api from quantum.openstack.common.notifier import rpc_notifier from quantum.openstack.common import rpc from quantum.openstack.common.rpc import proxy +from quantum.openstack.common import uuidutils LOG = logging.getLogger(__name__) @@ -88,7 +89,9 @@ class NotificationDispatcher(object): self.connection = rpc.create_connection(new=True) topic = '%s.%s' % (rpc_notifier.CONF.notification_topics[0], api.CONF.default_notification_level.lower()) + queue_name = 'notification_listener_%s' % uuidutils.generate_uuid() self.connection.declare_topic_consumer(topic=topic, + queue_name=queue_name, callback=self._add_to_queue) self.connection.consume_in_thread() diff --git a/quantum/tests/unit/test_agent_rpc.py b/quantum/tests/unit/test_agent_rpc.py index a36ea0d89f..fedf20b384 100644 --- a/quantum/tests/unit/test_agent_rpc.py +++ b/quantum/tests/unit/test_agent_rpc.py @@ -82,6 +82,7 @@ class AgentRPCNotificationDispatcher(unittest.TestCase): expected = [ mock.call(new=True), mock.call().declare_topic_consumer(topic='notifications.info', + queue_name=mock.ANY, callback=nd._add_to_queue), mock.call().consume_in_thread() ]