Extend handle_pyerror() to generate a crash dump. Pass some additional
context through from the callers (including the ability to not generate
a crash dump in the CLI handler case).
Extra crash dump fields look like so:
"backtrace": [
" File \"/home/sage/src/ceph/src/pybind/mgr/balancer/module.py\", line 652, in serve\n self.ifail()",
" File \"/home/sage/src/ceph/src/pybind/mgr/balancer/module.py\", line 648, in ifail\n raise RuntimeError('test')",
],
"mgr_module": "balancer",
"mgr_module_caller": "PyModuleRunner::serve",
"mgr_python_exception": "RuntimeError",
Notably, the backtrace deliberately excludes the 'value' of the exception,
as that may leak identifying information about the system. Instead, we
only include the exception *type* and the portion of the traceback that
identifies the call path (where in the code we crashed).
Also note: a side-effect of this change is that module exceptions will
trigger cluster health warnings about daemon crashes.