diff --git a/neutron_lib/context.py b/neutron_lib/context.py index 750f9b572..f323222ea 100644 --- a/neutron_lib/context.py +++ b/neutron_lib/context.py @@ -15,6 +15,7 @@ import collections import copy import datetime +import warnings from oslo_context import context as oslo_context from oslo_db.sqlalchemy import enginefacade @@ -145,6 +146,11 @@ class Context(ContextBaseWithSession): # TODO(akamyshnikova): checking for session attribute won't be needed # when reader and writer will be used if hasattr(super(Context, self), 'session'): + if self._session: + warnings.warn('context.session is used with and without ' + 'new enginefacade. Please update the code to ' + 'use new enginefacede consistently.', + DeprecationWarning) return super(Context, self).session if self._session is None: self._session = db_api.get_writer_session()