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 c7d07b7421
)
This commit is contained in:
parent
583aed50b4
commit
3a37c95075
@ -47,7 +47,17 @@ class TagPlugin(tagging.TagPluginBase):
|
||||
def _extend_tags_dict(response_data, db_data):
|
||||
if not directory.get_plugin(tagging.TAG_PLUGIN_TYPE):
|
||||
return
|
||||
tags = [tag_db.tag for tag_db in db_data.standard_attr.tags]
|
||||
try:
|
||||
tags = [tag_db.tag for tag_db in db_data.standard_attr.tags]
|
||||
except AttributeError:
|
||||
# NOTE(ralonsoh): this method 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.
|
||||
# https://bugs.launchpad.net/neutron/+bug/2078787
|
||||
tags = []
|
||||
response_data['tags'] = tags
|
||||
|
||||
@db_api.CONTEXT_READER
|
||||
|
Loading…
Reference in New Issue
Block a user