Merge "NSX-mh: Failover controller connections on socket failures"

This commit is contained in:
Jenkins 2015-08-21 20:39:54 +00:00 committed by Gerrit Code Review
commit 9a1395ec1e
2 changed files with 6 additions and 2 deletions

View File

@ -66,8 +66,8 @@ class EventletApiClient(base.ApiClientBase):
# Connection pool is a list of queues.
self._conn_pool = eventlet.queue.PriorityQueue()
self._next_conn_priority = 1
for host, port, is_ssl in api_providers:
for _ in range(concurrent_connections):
for _ in range(concurrent_connections):
for host, port, is_ssl in api_providers:
conn = self._create_connection(host, port, is_ssl)
self._conn_pool.put((self._next_conn_priority, conn))
self._next_conn_priority += 1

View File

@ -17,6 +17,7 @@
import abc
import copy
import socket
import time
import eventlet
@ -186,9 +187,12 @@ class ApiRequest(object):
'url': self._url, 'status': response.status})
raise Exception(_('Server error return: %s'), response.status)
return response
except socket.error:
is_conn_service_unavail = True
except Exception as e:
if isinstance(e, httplib.BadStatusLine):
msg = (_("Invalid server response"))
else:
msg = str(e)
if response is None: