Merge "create_security_group: Expunge an object selectively"

This commit is contained in:
Zuul 2017-10-21 00:55:40 +00:00 committed by Gerrit Code Review
commit e86dfc9272
1 changed files with 2 additions and 1 deletions

View File

@ -121,7 +121,8 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase):
# of the SG. It would add SG object to the session.
# Expunge it to ensure the following get_object doesn't
# use the instance.
context.session.expunge_all()
context.session.expunge(model_query.get_by_id(
context, sg_models.SecurityGroup, sg.id))
sg = sg_obj.SecurityGroup.get_object(context, id=sg.id)
secgroup_dict = self._make_security_group_dict(sg)
kwargs['security_group'] = secgroup_dict