Force service provider relationships to load
A race condition was exposed in the LBaaS V2 db layer that was caused by a hack to get around this issue. The real issue is that since the ProviderResourceAssociation is inserted independently, any models that were created before this insert will not have their relationship with the ProviderResourceAssocation loaded. Using the session.expire_all method will force the session to retrieve all new data and load this relationship for any resource that uses this relationship. Change-Id: I940b541f4ef9c489126cd2d215b1d857f0624de0 Closes-Bug: #1504465
This commit is contained in:
parent
c51f56f57b
commit
f218929bc5
@ -93,6 +93,14 @@ class ServiceTypeManager(object):
|
||||
assoc = ProviderResourceAssociation(provider_name=provider_name,
|
||||
resource_id=resource_id)
|
||||
context.session.add(assoc)
|
||||
# NOTE(blogan): the ProviderResourceAssociation relationship will not
|
||||
# be populated if a resource was created before this. The expire_all
|
||||
# will force the session to go retrieve the new data when that
|
||||
# resource will be read again. It has been suggested that we can
|
||||
# crawl through everything in the mapper to find the resource with
|
||||
# the ID that matches resource_id and expire that one, but we can
|
||||
# just start with this.
|
||||
context.session.expire_all()
|
||||
|
||||
def del_resource_associations(self, context, resource_ids):
|
||||
if not resource_ids:
|
||||
|
Loading…
Reference in New Issue
Block a user