Add warning output if failed to rebuild exception when deserialize

In some specific cases, the middleware would fail to rebuild
the original exception, see bug [1] below. Adding this output
may help locate the root cause quickly.

[1]: https://bugs.launchpad.net/cinder/+bug/1728826

Change-Id: Ia9304bda4e515812b146885f830e70f28a285f2d
This commit is contained in:
TommyLike 2018-06-06 13:59:36 +08:00
parent 7e4ca449a0
commit 7188835890
1 changed files with 4 additions and 2 deletions

View File

@ -27,7 +27,7 @@ import six
import oslo_messaging
from oslo_messaging._i18n import _
from oslo_messaging._i18n import _LE
from oslo_messaging._i18n import _LE, _LW
from oslo_messaging import _utils as utils
LOG = logging.getLogger(__name__)
@ -229,7 +229,9 @@ def deserialize_remote_exception(data, allowed_remote_exmods):
raise TypeError("Can only deserialize Exceptions")
failure = klass(*failure.get('args', []), **failure.get('kwargs', {}))
except (AttributeError, TypeError, ImportError):
except (AttributeError, TypeError, ImportError) as error:
LOG.warning(_LW("Failed to rebuild remote exception due to error: %s"),
six.text_type(error))
return oslo_messaging.RemoteError(name, failure.get('message'), trace)
ex_type = type(failure)