Remove RequestContext.instance_lock_checked

This was initially added in change I1127e31d86a061a93a64ee1eb4a4d900d8bf49b5
but is no longer used anywhere in nova since change
Ic18017a16c5bffee85a43db65ff17283599a27ba.

Anyway, this change still allows it to be passed as a kwarg for now but will
emit a UserWarning if it is, and then we can make it a hard failure starting
in the S release.

Change-Id: Ib0b23a47c2e833073108af6700b16f8026631a83
This commit is contained in:
Matt Riedemann 2018-03-19 19:08:57 -04:00
parent cc5ac1e41f
commit 28f29ca3df
2 changed files with 11 additions and 7 deletions

View File

@ -19,6 +19,7 @@
from contextlib import contextmanager
import copy
import warnings
import eventlet.queue
import eventlet.timeout
@ -89,7 +90,7 @@ class RequestContext(context.RequestContext):
def __init__(self, user_id=None, project_id=None, is_admin=None,
read_deleted="no", remote_address=None, timestamp=None,
quota_class=None, service_catalog=None,
instance_lock_checked=False, user_auth_plugin=None, **kwargs):
user_auth_plugin=None, **kwargs):
""":param read_deleted: 'no' indicates deleted records are hidden,
'yes' indicates deleted records are visible,
'only' indicates that *only* deleted records are visible.
@ -97,6 +98,9 @@ class RequestContext(context.RequestContext):
:param overwrite: Set to False to ensure that the greenthread local
copy of the index is not overwritten.
:param instance_lock_checked: This is not used and will be removed
in a future release.
:param user_auth_plugin: The auth plugin for the current request's
authentication data.
"""
@ -105,6 +109,12 @@ class RequestContext(context.RequestContext):
if project_id:
kwargs['project_id'] = project_id
if kwargs.pop('instance_lock_checked', None) is not None:
# TODO(mriedem): Let this be a hard failure in 19.0.0 (S).
warnings.warn("The 'instance_lock_checked' kwarg to "
"nova.context.RequestContext is no longer used and "
"will be removed in a future version.")
super(RequestContext, self).__init__(is_admin=is_admin, **kwargs)
self.read_deleted = read_deleted
@ -124,8 +134,6 @@ class RequestContext(context.RequestContext):
# if list is empty or none
self.service_catalog = []
self.instance_lock_checked = instance_lock_checked
# NOTE(markmc): this attribute is currently only used by the
# rs_limits turnstile pre-processor.
# See https://lists.launchpad.net/openstack/msg12200.html
@ -181,8 +189,6 @@ class RequestContext(context.RequestContext):
'user_name': getattr(self, 'user_name', None),
'service_catalog': getattr(self, 'service_catalog', None),
'project_name': getattr(self, 'project_name', None),
'instance_lock_checked': getattr(self, 'instance_lock_checked',
False)
})
# NOTE(tonyb): This can be removed once we're certain to have a
# RequestContext contains 'is_admin_project', We can only get away with
@ -207,7 +213,6 @@ class RequestContext(context.RequestContext):
timestamp=values.get('timestamp'),
quota_class=values.get('quota_class'),
service_catalog=values.get('service_catalog'),
instance_lock_checked=values.get('instance_lock_checked', False),
)
def elevated(self, read_deleted=None):

View File

@ -181,7 +181,6 @@ class ContextTestCase(test.NoDBTestCase):
values2 = ctx.to_dict()
expected_values = {'auth_token': None,
'domain': None,
'instance_lock_checked': False,
'is_admin': False,
'is_admin_project': True,
'project_id': 222,