From 7be9df899b7e9f88b6260dbcec956c3588ee5947 Mon Sep 17 00:00:00 2001 From: Michael Johnson Date: Thu, 25 Feb 2016 02:12:30 +0000 Subject: [PATCH] Adding improved logging to amphora rest driver We are seeing odd behavior connecting to the amphora on some gate hosts. This patch adds additional logging to gather information on this behavior as well as provide more user friendly log messages when connection issues occur. Change-Id: I086fd64cfadb839eec36128016ee018e373f9457 --- octavia/amphorae/drivers/haproxy/rest_api_driver.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/octavia/amphorae/drivers/haproxy/rest_api_driver.py b/octavia/amphorae/drivers/haproxy/rest_api_driver.py index 2fd1b7f626..f20cbc533a 100644 --- a/octavia/amphorae/drivers/haproxy/rest_api_driver.py +++ b/octavia/amphorae/drivers/haproxy/rest_api_driver.py @@ -31,7 +31,7 @@ from octavia.common.config import cfg from octavia.common import constants from octavia.common.jinja.haproxy import jinja_cfg from octavia.common.tls_utils import cert_parser -from octavia.i18n import _LW +from octavia.i18n import _LE, _LW LOG = logging.getLogger(__name__) API_VERSION = constants.API_VERSION @@ -244,9 +244,15 @@ class AmphoraAPIClient(object): LOG.warning(_LW("Could not connect to instance. Retrying.")) time.sleep(CONF.haproxy_amphora.connection_retry_interval) if a == CONF.haproxy_amphora.connection_max_retries - 1: + LOG.error(_LE("Timed out connecting to the amphora.")) raise driver_except.TimeOutException() else: + LOG.debug( + "Connected to amphora. Response: {resp}".format(resp=r)) return r + LOG.error(_LE("Connection retries (currently set to %s) " + "exhausted. The amphora is unavailable."), + CONF.haproxy_amphora.connection_max_retries) raise driver_except.UnavailableException() def upload_config(self, amp, listener_id, config):