Permalink
Browse files

Added some debug

  • Loading branch information...
CyrilPeponnet committed Mar 13, 2016
1 parent 6a4380c commit 8e70b0f4c4c925d360b51868e3d34ffe2bf0f4ed
Showing with 3 additions and 5 deletions.
  1. +3 −5 ArchipelAgent/archipel-agent/archipel/archipelHypervisor.py
@@ -1356,21 +1356,19 @@ def on_xmpp_loop_tick(self):
if self.get_plugin("centraldb"):
if self.get_plugin("centraldb").central_agent_jid():
if not self.seen_central_agent:
self.log.info("HYPERVISOR: Central Agent detected %s, using central database" % self.get_plugin("centraldb").central_agent_jid())
self.log.info("HYPERVISOR: Central Agent detected %s, using central database with keep alive set to %ss" % ( self.get_plugin("centraldb").central_agent_jid(), self.get_plugin("centraldb").keepalive_interval))
self.seen_central_agent = True
return
elif self.seen_central_agent:
self.log.error("CENTRALDB: Central Agent timeout after %s seconds" % self.get_plugin("centraldb").keepalive_interval)
self.last_keepalive_from_central_agent = datetime.datetime.now()
self.log.error("HYPERVISOR: Central Agent timeout after %s seconds. We didn't receive the keepalive." % self.get_plugin("centraldb").keepalive_interval)
self.update_presence()
self.seen_central_agent = False
waiting_for = (datetime.datetime.now() - self.last_keepalive_from_central_agent).seconds
if waiting_for < self.get_plugin("centraldb").keepalive_interval:
status = "Waiting %ss for central-agent" % (self.get_plugin("centraldb").keepalive_interval - waiting_for)
self.update_presence(presence_msg=status)
return
elif waiting_for > self.get_plugin("centraldb").keepalive_interval and waiting_for < (self.get_plugin("centraldb").keepalive_interval * 2):
self.update_presence()
if not self.already_wake_up:
self.log.error("HYPERVISOR: No Central agent found after %s seconds, starting vms based on local db info only." % self.get_plugin("centraldb").keepalive_interval)

0 comments on commit 8e70b0f

Please sign in to comment.