Merge "Avoid BadRequest error log on volume attachment"

This commit is contained in:
Zuul
2019-02-27 05:13:20 +00:00
committed by Gerrit Code Review

View File

@@ -768,6 +768,9 @@ class API(object):
return _translate_attachment_ref(attachment_ref) return _translate_attachment_ref(attachment_ref)
except cinder_exception.ClientException as ex: except cinder_exception.ClientException as ex:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
# NOTE: It is unnecessary to output BadRequest(400) error log,
# because operators don't need to debug such cases.
if getattr(ex, 'code', None) != 400:
LOG.error(('Create attachment failed for volume ' LOG.error(('Create attachment failed for volume '
'%(volume_id)s. Error: %(msg)s Code: %(code)s'), '%(volume_id)s. Error: %(msg)s Code: %(code)s'),
{'volume_id': volume_id, {'volume_id': volume_id,