Use LOG.error when no exception handler is used

There's no need to use LOG.exception here since sys.exc_info()
results in (None, None, None) and thus would effectively just
be LOG.error.

Also, the failure of invoking LOG.exception outside of an
exception handler is due to a bug in Python3[1]. The fix for
that is only available in Python3.5.

[1] http://bugs.python.org/issue17911

Closes-Bug: #1482261

Change-Id: I9ceac0fceafa45769cc15f56027c981182ff0750
This commit is contained in:
Sirushti Murugesan 2015-10-08 09:13:04 +05:30
parent e3e2b3ef89
commit f5c415accf
1 changed files with 6 additions and 2 deletions

View File

@ -1378,8 +1378,12 @@ class Resource(object):
if not updated_ok:
ex = exception.UpdateInProgress(self.name)
LOG.exception('atomic:%s engine_id:%s/%s' % (
rs.atomic_key, rs.engine_id, engine_id))
LOG.error(_LE(
'Error acquiring lock for resource id:%(resource_id)s with'
'atomic key:%(atomic_key)s,'
'engine_id:%(rs_engine_id)s/%(engine_id)s') % {
'resource_id': rs.id, 'atomic_key': rs.atomic_key,
'rs_engine_id': rs.engine_id, 'engine_id': engine_id})
raise ex
def _release(self, engine_id):