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

Conflicts:
    neutron/services/segments/db.py

Change-Id: Ib19dacf886486876237ed1157fb95ae157ed430e
(cherry picked from commit d89d7bd5e6)
This commit is contained in:
Rodolfo Alonso Hernandez 2022-05-14 16:55:33 +00:00
parent c9a0dc9f4a
commit 874bccaae4
1 changed files with 0 additions and 6 deletions

View File

@ -326,12 +326,6 @@ def _add_segment_host_mapping_for_segment(resource, event, trigger,
payload=None):
context = payload.context
segment = payload.latest_state
if not context.session.is_active:
# 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()