Avoid logging traceback when detach device not found
We use the oslo.utils save_and_reraise_exception context manager in our
detach device code and catch specific exceptions that mean 'not found'
and raise DeviceNotFound instead. When we do that, the
save_and_reraise_exception context manager logs an ERROR traceback of
the original exception, for informational purposes. This is misleading
when trying to debug other issues, as it makes it look like the caught
exception caused a problem.
This passes the reraise=False keyword arg to the context manager and
sets the 'reraise' attribute to True only if we are not going to raise
a different exception.
Reviewed: https:/ /review. opendev. org/671640 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=738774b942d ab21d8c03c70b4e 74b6a487515ff5
Committed: https:/
Submitter: Zuul
Branch: master
commit 738774b942dab21 d8c03c70b4e74b6 a487515ff5
Author: melanie witt <email address hidden>
Date: Thu Jul 18 23:59:16 2019 +0000
Avoid logging traceback when detach device not found
We use the oslo.utils save_and_ reraise_ exception context manager in our and_reraise_ exception context manager logs an ERROR traceback of
detach device code and catch specific exceptions that mean 'not found'
and raise DeviceNotFound instead. When we do that, the
save_
the original exception, for informational purposes. This is misleading
when trying to debug other issues, as it makes it look like the caught
exception caused a problem.
This passes the reraise=False keyword arg to the context manager and
sets the 'reraise' attribute to True only if we are not going to raise
a different exception.
Related-Bug: #1836212
Change-Id: Icce1e31fe3ebcb f9e4897bbfa57b7 f3d1fba67a3