Revert "Remove warning message when using old and new engine facade"

Partial revert. We made a mistake including this log message every
time this condition happens. Now the Neutron server debug logs are
polluted with this message.

This reverts commit 77b761dfe4.

Change-Id: I86366a151f132d59f250368e4e206509c1a45d3d
This commit is contained in:
Rodolfo Alonso Hernandez 2020-03-05 09:32:34 +00:00
parent 77b761dfe4
commit cbd4e77dac
1 changed files with 6 additions and 7 deletions

View File

@ -15,18 +15,15 @@
import collections
import copy
import datetime
import warnings
from oslo_context import context as oslo_context
from oslo_db.sqlalchemy import enginefacade
from oslo_log import log as logging
from neutron_lib.db import api as db_api
from neutron_lib.policy import _engine as policy_engine
LOG = logging.getLogger(__name__)
class ContextBase(oslo_context.RequestContext):
"""Security context and request information.
@ -150,9 +147,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'):
LOG.debug('context.session is used with and without new '
'enginefacade. Please update the code to use new '
'enginefacede consistently.')
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()