Skip to content

Commit

Permalink
(1) When Heart beat to the discovery server fails [haproxy down/not s…
Browse files Browse the repository at this point in the history
…tarted], the discovery client library marks the Discovery connection as DOWN.

However, on successful Heart beat, the connection status is not being marked UP. Also, reset the connection status to DOWN when the response code for
HeartBeat request is not 200.
(2) Increasing the timeout for introspect connection in contrail-status to 0.5 seconds.
In swisscom setup, changing the timeout from 0.01 to 0.1 did not work. Did not see much load on the system. Changing the timeout to 0.5 to be on the safer side.
Closes-Bug: #1372875

Change-Id: I90fa290beac079b25781d5c2ac2db0d5193c0828
  • Loading branch information
Sundaresan Rajangam committed Sep 24, 2014
1 parent f0cbf2f commit 2681094
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/config/utils/contrail-status.py
Expand Up @@ -115,7 +115,7 @@ def _mk_url_str(self, path):
def _load(self, path):
url = self._mk_url_str(path)
try:
resp = requests.get(url, timeout=0.01)
resp = requests.get(url, timeout=0.5)
return etree.fromstring(resp.text)
except requests.ConnectionError, e:
if self._debug:
Expand Down
14 changes: 14 additions & 0 deletions src/discovery/client.py
Expand Up @@ -301,6 +301,20 @@ def heartbeat(self):
service, data = self.pubdata[cookie]
del self.pubdata[cookie]
self._publish_int(service, data)
elif r.status_code != 200:
service, data = pub_list[cookie]
ConnectionState.update(conn_type = ConnectionType.DISCOVERY,
name = service, status = ConnectionStatus.DOWN,
server_addrs = ['%s:%s' % (self._server_ip, \
self._server_port)],
message = 'HeartBeat Error: %d' % r.status_code)
else:
service, data = pub_list[cookie]
ConnectionState.update(conn_type = ConnectionType.DISCOVERY,
name = service, status = ConnectionStatus.UP,
server_addrs = ['%s:%s' % (self._server_ip, \
self._server_port)],
message = 'HeartBeat OK')
gevent.sleep(HC_INTERVAL)
# end client

Expand Down

0 comments on commit 2681094

Please sign in to comment.