Increase the verbosity of haproxy.rest_api_driver failures

Otherwise it's impossible to identify what's the cause of the
failure (connection, timeout, certificate, etc..).

Change-Id: Ia4eda232b1d3ee5e9f7c2958a4857e155230affb
Closes-Bug: 1633427
This commit is contained in:
Miguel Angel Ajo 2016-10-14 13:03:41 +02:00
parent 451faa2534
commit dfe1dc069d
1 changed files with 8 additions and 4 deletions

View File

@ -260,6 +260,7 @@ class AmphoraAPIClient(object):
headers['User-Agent'] = OCTAVIA_API_CLIENT
self.ssl_adapter.uuid = amp.id
retry_attempt = False
exception = None
# Keep retrying
for a in six.moves.xrange(CONF.haproxy_amphora.connection_max_retries):
try:
@ -277,13 +278,16 @@ class AmphoraAPIClient(object):
retry_attempt = True
raise requests.ConnectionError
return r
except (requests.ConnectionError, requests.Timeout):
except (requests.ConnectionError, requests.Timeout) as e:
exception = e
LOG.warning(_LW("Could not connect to instance. Retrying."))
time.sleep(CONF.haproxy_amphora.connection_retry_interval)
LOG.error(_LE("Connection retries (currently set to %s) "
"exhausted. The amphora is unavailable."),
CONF.haproxy_amphora.connection_max_retries)
LOG.error(_LE("Connection retries (currently set to %(max_retries)s) "
"exhausted. The amphora is unavailable. Reason: "
"%(exception)s"),
{'max_retries': CONF.haproxy_amphora.connection_max_retries,
'exception': exception})
raise driver_except.TimeOutException()
def upload_config(self, amp, listener_id, config):