diff --git a/cinder/context.py b/cinder/context.py index e5a1eb79f73..88139ad61f2 100644 --- a/cinder/context.py +++ b/cinder/context.py @@ -24,7 +24,6 @@ from oslo_log import log as logging from oslo_utils import timeutils from cinder.i18n import _ -from cinder.openstack.common import local from cinder import policy @@ -74,8 +73,6 @@ class RequestContext(context.RequestContext): timestamp = timeutils.parse_strtime(timestamp) self.timestamp = timestamp self.quota_class = quota_class - if overwrite or not hasattr(local.store, 'context'): - self.update_store() if service_catalog: # Only include required parts of service_catalog @@ -109,9 +106,6 @@ class RequestContext(context.RequestContext): read_deleted = property(_get_read_deleted, _set_read_deleted, _del_read_deleted) - def update_store(self): - local.store.context = self - def to_dict(self): default = super(RequestContext, self).to_dict() extra = {'user_id': self.user_id, @@ -123,7 +117,8 @@ class RequestContext(context.RequestContext): 'remote_address': self.remote_address, 'timestamp': timeutils.strtime(self.timestamp), 'quota_class': self.quota_class, - 'service_catalog': self.service_catalog} + 'service_catalog': self.service_catalog, + 'request_id': self.request_id} return dict(default.items() + extra.items()) @classmethod diff --git a/cinder/openstack/common/local.py b/cinder/openstack/common/local.py deleted file mode 100644 index 0819d5b97cb..00000000000 --- a/cinder/openstack/common/local.py +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright 2011 OpenStack Foundation. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -"""Local storage of variables using weak references""" - -import threading -import weakref - - -class WeakLocal(threading.local): - def __getattribute__(self, attr): - rval = super(WeakLocal, self).__getattribute__(attr) - if rval: - # NOTE(mikal): this bit is confusing. What is stored is a weak - # reference, not the value itself. We therefore need to lookup - # the weak reference and return the inner value here. - rval = rval() - return rval - - def __setattr__(self, attr, value): - value = weakref.ref(value) - return super(WeakLocal, self).__setattr__(attr, value) - - -# NOTE(mikal): the name "store" should be deprecated in the future -store = WeakLocal() - -# A "weak" store uses weak references and allows an object to fall out of scope -# when it falls out of scope in the code that uses the thread local storage. A -# "strong" store will hold a reference to the object so that it never falls out -# of scope. -weak_store = WeakLocal() -strong_store = threading.local() diff --git a/openstack-common.conf b/openstack-common.conf index 72f96339157..00f22d387be 100644 --- a/openstack-common.conf +++ b/openstack-common.conf @@ -7,7 +7,6 @@ module=fileutils module=gettextutils module=imageutils module=install_venv_common -module=local module=loopingcall module=middleware module=periodic_task