Commit 787f6b37 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

Fix AMQP bug in snf-progress-monitor

parent b764537a
......@@ -115,7 +115,7 @@ class JobFileHandler(pyinotify.ProcessEvent):
def __init__(self, logger):
pyinotify.ProcessEvent.__init__(self)
self.logger = logger
self.client = AMQPClient(confirm_buffer=25)
self.client = AMQPClient(hosts=settings.AMQP_HOSTS, confirm_buffer=25)
handler_logger.info("Attempting to connect to RabbitMQ hosts")
self.client.connect()
self.client.exchange_declare(settings.EXCHANGE_GANETI, type='topic')
......
......@@ -158,7 +158,8 @@ class GanetiHook():
# FIXME: We need a reconciliation mechanism between the DB and
# Ganeti, for cases exactly like this.
self.client = AMQPClient(max_retries= 2*len(settings.AMQP_HOSTS))
self.client = AMQPClient(hosts=settings.AMQP_HOSTS,
max_retries = 2 * len(settings.AMQP_HOSTS))
self.client.connect()
def on_master(self):
......
......@@ -130,8 +130,9 @@ def main():
# determine the routekey for AMPQ
prefix = opts.instance_name.split('-')[0]
routekey = "ganeti.%s.event.progress" % prefix
amqp_client = AMQPClient()
amqp_client = AMQPClient(hosts=settings.AMQP_HOSTS, confirm_buffer=2)
amqp_client.connect()
amqp_client.exchange_declare(settings.EXCHANGE_GANETI, type='topic')
pid = os.fork()
if pid == 0:
......@@ -202,6 +203,8 @@ def main():
# Sleep for a while
time.sleep(3)
amqp_client.close()
if __name__ == "__main__":
sys.exit(main())
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment