summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNaveed Massjouni <naveedm9@gmail.com>2012-01-13 19:38:51 +0000
committerNaveed Massjouni <naveedm9@gmail.com>2012-01-13 19:43:09 +0000
commit0b08cab1d52ee0149fec03baa9b6086b52847b74 (patch)
tree96c5d5fed7c082fe1fdb42ea4f711469b13e6b27
parent6c898e6abf44caa176790e9cd4505aeed145397c (diff)
downloadnova-0b08cab1d52ee0149fec03baa9b6086b52847b74.tar.gz
nova-0b08cab1d52ee0149fec03baa9b6086b52847b74.tar.xz
nova-0b08cab1d52ee0149fec03baa9b6086b52847b74.zip
Fixing a bug that was causing the logging to display the context info
for the wrong user. bug: 915608 Change-Id: I5addd27c3c864333a98e454ecb5bc44836912e8a
-rw-r--r--nova/rpc/impl_carrot.py10
-rw-r--r--nova/rpc/impl_kombu.py10
2 files changed, 16 insertions, 4 deletions
diff --git a/nova/rpc/impl_carrot.py b/nova/rpc/impl_carrot.py
index ee6bac1e5..bfd48773e 100644
--- a/nova/rpc/impl_carrot.py
+++ b/nova/rpc/impl_carrot.py
@@ -42,6 +42,7 @@ import greenlet
from nova import context
from nova import exception
from nova import flags
+from nova import local
from nova.rpc import common as rpc_common
from nova.rpc.common import RemoteError, LOG
from nova.testing import fake
@@ -253,6 +254,10 @@ class AdapterConsumer(Consumer):
Example: {'method': 'echo', 'args': {'value': 42}}
"""
+ # It is important to clear the context here, because at this point
+ # the previous context is stored in local.store.context
+ if hasattr(local.store, 'context'):
+ del local.store.context
LOG.debug(_('received %s') % message_data)
# This will be popped off in _unpack_context
msg_id = message_data.get('_msg_id', None)
@@ -485,8 +490,9 @@ def _unpack_context(msg):
value = msg.pop(key)
context_dict[key[9:]] = value
context_dict['msg_id'] = msg.pop('_msg_id', None)
- LOG.debug(_('unpacked context: %s'), context_dict)
- return RpcContext.from_dict(context_dict)
+ ctx = RpcContext.from_dict(context_dict)
+ LOG.debug(_('unpacked context: %s'), ctx.to_dict())
+ return ctx
def _pack_context(msg, context):
diff --git a/nova/rpc/impl_kombu.py b/nova/rpc/impl_kombu.py
index f0a8bc61e..1b0d79e06 100644
--- a/nova/rpc/impl_kombu.py
+++ b/nova/rpc/impl_kombu.py
@@ -33,6 +33,7 @@ import kombu.connection
from nova import context
from nova import exception
from nova import flags
+from nova import local
from nova.rpc import common as rpc_common
FLAGS = flags.FLAGS
@@ -695,6 +696,10 @@ class ProxyCallback(object):
Example: {'method': 'echo', 'args': {'value': 42}}
"""
+ # It is important to clear the context here, because at this point
+ # the previous context is stored in local.store.context
+ if hasattr(local.store, 'context'):
+ del local.store.context
LOG.debug(_('received %s') % message_data)
ctxt = _unpack_context(message_data)
method = message_data.get('method')
@@ -741,8 +746,9 @@ def _unpack_context(msg):
value = msg.pop(key)
context_dict[key[9:]] = value
context_dict['msg_id'] = msg.pop('_msg_id', None)
- LOG.debug(_('unpacked context: %s'), context_dict)
- return RpcContext.from_dict(context_dict)
+ ctx = RpcContext.from_dict(context_dict)
+ LOG.debug(_('unpacked context: %s'), ctx.to_dict())
+ return ctx
def _pack_context(msg, context):