Hi,
I am trying to resolve the bug 919835. To resolve that we need to create a empty queue for the component in rabbitmq to hold the message. As there will be no queue created before any service is started. Please let me know how to call that reconnect method from the call / cast method in impl_kombu.py file.
I have written following code for that. Created a new function named create_empty_queue in Class Connection of impl_kombu.py.
def create_empty_queue(self, topic):
options = {'durable': FLAGS.rabbit_durable_queues,
'auto_delete': False,
'exclusive': False}
topic_exchange = kombu.entity.Exchange(
name=FLAGS.control_exchange,
type='topic',
durable=options['durable'],
auto_delete=options['auto_delete'])
LOG.info(_("from create_empty_queue"))
self.channel = self.connection.channel()
queue = kombu.entity.Queue(channel=self.channel,
exchange=topic_exchange,
name=topic,
routing_key=topic)
queue.declare()
Calling this empty queue function in function "def call" and "def cast" as follows:
conn = rpc.create_connection(new=True)
conn.create_empty_queue(topic)
node_topic = '%s.%s' % (self.topic, self.host)
conn.create_empty_queue(node_topic)
But I am getting some exceptions:
2012-04-02 16:44:24 ERROR nova.rpc.common [-] Exception during message handling
(nova.rpc.common): TRACE: Traceback (most recent call last):
(nova.rpc.common): TRACE: File "/usr/lib/python2.7/dist-packages/nova/rpc/amqp.py", line 250, in _process_data
(nova.rpc.common): TRACE: rval = node_func(context=ctxt, *node_args)
(nova.rpc.common): TRACE: File "/usr/lib/python2.7/dist-packages/nova/exception.py", line 112, in wrapped
(nova.rpc.common): TRACE: return f(args, *kw)
(nova.rpc.common): TRACE: File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 156, in decorated_function
(nova.rpc.common): TRACE: function(self, context, instance_uuid, *args, *kwargs)
(nova.rpc.common): TRACE: File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 180, in decorated_function
(nova.rpc.common): TRACE: sys.exc_info())
(nova.rpc.common): TRACE: File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
(nova.rpc.common): TRACE: self.gen.next()
(nova.rpc.common): TRACE: File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 174, in decorated_function
(nova.rpc.common): TRACE: return function(self, context, instance_uuid, args, *kwargs)
(nova.rpc.common): TRACE: File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 736, in terminate_instance
(nova.rpc.common): TRACE: self._delete_instance(context, instance)
(nova.rpc.common): TRACE: File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 716, in _delete_instance
(nova.rpc.common): TRACE: self._shutdown_instance(context, instance, 'Terminating')
(nova.rpc.common): TRACE: File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 671, in _shutdown_instance
(nova.rpc.common): TRACE: network_info = self._get_instance_nw_info(context, instance)
(nova.rpc.common): TRACE: File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 312, in _get_instance_nw_info
(nova.rpc.common): TRACE: instance)
(nova.rpc.common): TRACE: File "/usr/lib/python2.7/dist-packages/nova/network/api.py", line 216, in get_instance_nw_info
(nova.rpc.common): TRACE: 'args': args})
(nova.rpc.common): TRACE: File "/usr/lib/python2.7/dist-packages/nova/rpc/__init__.py", line 69, in call
(nova.rpc.common): TRACE: return _get_impl().call(context, topic, msg, timeout ... (more)