]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Remove time formatting in agent clock error
authorKevin Benton <blak111@gmail.com>
Wed, 27 May 2015 21:52:06 +0000 (14:52 -0700)
committerKevin Benton <blak111@gmail.com>
Wed, 27 May 2015 21:56:54 +0000 (14:56 -0700)
This removes time formatting that may be hiding timezone
issues that are leading to a delta being calculated between
the agent and the server even when it shows none. It also
adds logging of the difference so we can see how far off it
thinks they are.

Example message:
during the registration of Open vSwitch agent has a timestamp:
2015-05-19T18:15:27Z. This differs from the current server
timestamp: 2015-05-19T18:15:27Z by more than the threshold agent
downtime: 75.

Note that the timestamps are exactly the same after formatting.

Change-Id: Ibfc30444b7a167fb18ae9051a775266236d4ecce
Related-Bug: #1456760

neutron/db/agents_db.py

index 26a6212d5731e71f161aa336e47f61daa89108be..a9ba6dfe86524737a8f892055cc1f29dc1ba1e8d 100644 (file)
@@ -297,16 +297,17 @@ class AgentExtRpcCallback(object):
             diff = abs((time_server_now - agent_time).seconds)
             if diff > cfg.CONF.agent_down_time:
                 agent_name = agent_state['agent_type']
-                time_agent = timeutils.isotime(agent_time)
                 host = agent_state['host']
                 log_dict = {'host': host,
                             'agent_name': agent_name,
-                            'agent_time': time_agent,
+                            'agent_time': agent_time,
                             'threshold': cfg.CONF.agent_down_time,
-                            'serv_time': timeutils.isotime(time_server_now)}
+                            'serv_time': time_server_now,
+                            'diff': diff}
                 LOG.error(_LE("Message received from the host: %(host)s "
                               "during the registration of %(agent_name)s has "
                               "a timestamp: %(agent_time)s. This differs from "
                               "the current server timestamp: %(serv_time)s by "
-                              "more than the threshold agent down"
+                              "%(diff)s seconds, which is more than the "
+                              "threshold agent down"
                               "time: %(threshold)s."), log_dict)