Keep context for logging intact in greenthreads

* fixes bug 942918

Change-Id: Ia0fcf459c53b95a8675472adcfbba08014e34e5b
This commit is contained in:
Vishvananda Ishaya 2012-03-15 13:02:07 -07:00
parent 97eb92880e
commit 4012a3f792
4 changed files with 7 additions and 3 deletions

View File

@ -81,7 +81,10 @@ class RequestContext(object):
self.request_id = request_id
self.auth_token = auth_token
if overwrite or not hasattr(local.store, 'context'):
local.store.context = self
self.update_store()
def update_store(self):
local.store.context = self
def to_dict(self):
return {'user_id': self.user_id,

View File

@ -283,6 +283,7 @@ class S3ImageService(object):
def delayed_create():
"""This handles the fetching and decrypting of the part files."""
context.update_store()
log_vars = {'image_location': image_location,
'image_path': image_path}
metadata['properties']['image_state'] = 'downloading'

View File

@ -244,7 +244,7 @@ class ProxyCallback(object):
"""Thread that magically looks for a method on the proxy
object and calls it.
"""
ctxt.update_store()
try:
node_func = getattr(self.proxy, str(method))
node_args = dict((str(k), v) for k, v in args.iteritems())

View File

@ -283,7 +283,7 @@ class AdapterConsumer(Consumer):
"""Thread that magically looks for a method on the proxy
object and calls it.
"""
ctxt.update_store()
node_func = getattr(self.proxy, str(method))
node_args = dict((str(k), v) for k, v in args.iteritems())
# NOTE(vish): magic is fun!