Skip to content

Commit bb9a433

Browse files
committed
Protect the "standardattr" retrieval from a concurrent deletion
The method ``_extend_tags_dict`` can be called from a "list" operation. If one resource and its "standardattr" register is deleted concurrently, the "standard_attr" field retrieval will fail. The "list" operation is protected with a READER transaction context; however this is failing with the DB PostgreSQL backend. Closes-Bug: #2078787 Change-Id: I55142ce21cec8bd8e2d6b7b8b20c0147873699da (cherry picked from commit c7d07b7)
1 parent 33f1d27 commit bb9a433

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

neutron/services/tag/tag_plugin.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,17 @@ def __new__(cls, *args, **kwargs):
4747
def _extend_tags_dict(response_data, db_data):
4848
if not directory.get_plugin(tagging.TAG_PLUGIN_TYPE):
4949
return
50-
tags = [tag_db.tag for tag_db in db_data.standard_attr.tags]
50+
try:
51+
tags = [tag_db.tag for tag_db in db_data.standard_attr.tags]
52+
except AttributeError:
53+
# NOTE(ralonsoh): this method can be called from a "list"
54+
# operation. If one resource and its "standardattr" register is
55+
# deleted concurrently, the "standard_attr" field retrieval will
56+
# fail.
57+
# The "list" operation is protected with a READER transaction
58+
# context; however this is failing with the DB PostgreSQL backend.
59+
# https://bugs.launchpad.net/neutron/+bug/2078787
60+
tags = []
5161
response_data['tags'] = tags
5262

5363
@db_api.CONTEXT_READER

0 commit comments

Comments
 (0)