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.
Related-Bug: #1836212
Change-Id: Icce1e31fe3ebcbf9e4897bbfa57b7f3d1fba67a3
(cherry picked from commit 738774b942dab21d8c03c70b4e74b6a487515ff5)
(cherry picked from commit d83342226470e1957525978d7bec7d98db9bb695)
Reviewed: https:/ /review. opendev. org/674068 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=3a1be7afd0f 11a2123c59b0dde a63f08bb4436ce
Committed: https:/
Submitter: Zuul
Branch: stable/rocky
commit 3a1be7afd0f11a2 123c59b0ddea63f 08bb4436ce
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 d8c03c70b4e74b6 a487515ff5) 57525978d7bec7d 98db9bb695)
(cherry picked from commit 738774b942dab21
(cherry picked from commit d83342226470e19