Remove session active check in "_add_segment_host_mapping_for_segment"

Method ``_add_segment_host_mapping_for_segment`` is called by the event
(resources.SEGMENT, events.PRECOMMIT_CREATE), from
``SegmentDbMixin._create_segment_db``, and is called inside a database
writer context. That means it is irrelevant to check if the session is
active (must be always).

Closes-Bug: #1975542
Change-Id: Ib19dacf886486876237ed1157fb95ae157ed430e
This commit is contained in:
Rodolfo Alonso Hernandez 2022-05-14 16:55:33 +00:00 committed by Rodolfo Alonso
parent bdea142584
commit d89d7bd5e6
1 changed files with 0 additions and 7 deletions

View File

@ -30,7 +30,6 @@ from oslo_db import exception as db_exc
from oslo_log import helpers as log_helpers
from oslo_utils import uuidutils
from neutron.common import utils
from neutron.db import segments_db as db
from neutron import manager
from neutron.objects import base as base_obj
@ -327,12 +326,6 @@ def _add_segment_host_mapping_for_segment(resource, event, trigger,
payload=None):
context = payload.context
segment = payload.latest_state
if not utils.is_session_active(context.session):
# The session might be in partial rollback state, due to errors in
# peer callback. In that case, there is no need to add the mapping.
# Just return here.
return
if not segment.physical_network:
return
cp = directory.get_plugin()