From 2784fff6300d79d7100e6413f0c3120970134b86 Mon Sep 17 00:00:00 2001 From: Haiwei Xu Date: Tue, 5 Mar 2013 03:52:37 +0000 Subject: Return error details to users in "dns-create-private-domain" Fixes bug 1135539 When SysLogHandler is configured in UDP socket mode, the user who doesn't have the admin privilege got the unexpecting internal server error(HTTP 500) in "nova dns-create-private-domain" command. This bug occurs as the call graph drew below: |--ProxyCallback._process_data():amqp.py |--LOG.exception() | : | |--BaseHub.switch():hub.py | |-- clear_sys_exc_info() | |--ctxt.reply(None, sys.exc_info(),..) | : | |--serialize_remote_exception():common.py |--failure_info#(None,None,None) The sys.exc_info() is cleared by the clear_sys_exc_info(), but it is called again by the ctxt.reply(). This patch prevents the internal error and returns the details of the forbidden error(HTTP 403) which is expected. Change-Id: I76d4a938e66bfaf44423f7586e00db2caf9f5dde --- nova/openstack/common/rpc/amqp.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nova/openstack/common/rpc/amqp.py b/nova/openstack/common/rpc/amqp.py index 3f25eed67..19d919d87 100644 --- a/nova/openstack/common/rpc/amqp.py +++ b/nova/openstack/common/rpc/amqp.py @@ -406,9 +406,11 @@ class ProxyCallback(_ThreadPoolWithWait): connection_pool=self.connection_pool, log_failure=False) except Exception: - LOG.exception(_('Exception during message handling')) - ctxt.reply(None, sys.exc_info(), - connection_pool=self.connection_pool) + # sys.exc_info() is deleted by LOG.exception(). + exc_info = sys.exc_info() + LOG.error(_('Exception during message handling'), + exc_info=exc_info) + ctxt.reply(None, exc_info, connection_pool=self.connection_pool) class MulticallProxyWaiter(object): -- cgit