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
This commit is contained in:
Michael Johnson 2016-02-25 02:12:30 +00:00
parent 7119a6a85a
commit 7be9df899b
1 changed files with 7 additions and 1 deletions

View File

@ -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):