Fix bad log message with glance client timeout

Fixes bad log message where when a glance call finally timeouts instead
of a log message saying that it has given up it instead says it is
retrying

Co-Authored-By: qinchenchong@gmail.com

Change-Id: I325918f2d7fa971d4239343131b0f95dae293281
Closes-Bug: 1292993
This commit is contained in:
Chris Yeoh
2014-06-24 16:50:32 +09:30
parent 685c6cb78b
commit a12c7a5dae

View File

@@ -227,18 +227,21 @@ class GlanceClientWrapper(object):
except retry_excs as e:
host = self.host
port = self.port
extra = "retrying"
if attempt < num_attempts:
extra = "retrying"
else:
extra = 'done trying'
error_msg = (_("Error contacting glance server "
"'%(host)s:%(port)s' for '%(method)s', "
"%(extra)s.") %
{'host': host, 'port': port,
'method': method, 'extra': extra})
LOG.exception(error_msg)
if attempt == num_attempts:
extra = 'done trying'
LOG.exception(error_msg)
raise exception.GlanceConnectionFailed(
host=host, port=port, reason=str(e))
LOG.exception(error_msg)
time.sleep(1)