Based on the description of the notify_on_api_faults config option [1]
and the code that uses it [2] nova sends and api.fault notification
if the nova-api service encounters an unhandle exception.
There is a FaultWrapper class [3] added to the pipeline of the REST
request which catches every exception and calls the notification sending.
Based on some debugging in devstack this FaultWrapper never catches any
exception. Every REST API method is decorated with expected_errors
decorator [5] which as a last resort translate the unexpected exception
to HTTPInternalServerError. In the wsgi stack the actual REST api call is
guarded with ResourceExceptionHandler context manager [7] which translates
HTTPException to a Fault [8]. Then Fault is catched and translated to
the REST response [7]. This way the exception never propagates back to
the FaultWrapper and therefore the api.fault notification is never emitted.
Based on the git history of the expected_errors decorator this notification
was never emitted for v2.1 API and as the v2.0 API now supported with the
same codebase than v2.1 it is not emitted for v2.0 calls either. As nobody
reported a bug I assume that nobody tried to use this notification for a very
long time. Therefore instead of fixing this bug this patch propses to remove
the dead code.
See a bit more detailed description on the ML [9].
[1] 0aeaa2bce8/nova/conf/notifications.py (L49)
[2] 0aeaa2bce8/nova/notifications/base.py (L84)
[3] 0aeaa2bce8/nova/api/openstack/__init__.py (L78)
[5] 0aeaa2bce8/nova/api/openstack/extensions.py (L325)
[7] 0aeaa2bce8/nova/api/openstack/wsgi.py (L637)
[8] 0aeaa2bce8/nova/api/openstack/wsgi.py (L418)
[9] http://lists.openstack.org/pipermail/openstack-dev/2017-June/118639.html
Change-Id: I608b6ebdc69d31eb2a11ac6479fa4f2e8c20f7d1
Closes-Bug: #1699115