Fix security groups ext_properties loading

Commit I123ae390bec489a931180a2e33f4bf7b1d51edb2 broke the extended
security group code, by removing the 'is_default' attribute from the
list of fields that should have been updated in the DB.
Not sure exactly why it broke us.

Change-Id: I891bc792e62ac90683ce8745f98a3139c9ffd3d9
This commit is contained in:
Adit Sarfaty 2018-03-12 12:34:28 +02:00
parent 5a25e38e8b
commit f9071f3f9f

View File

@ -102,6 +102,11 @@ class ExtendedSecurityGroupPropertiesMixin(object):
context, id=s.get('id') or uuidutils.generate_uuid(), context, id=s.get('id') or uuidutils.generate_uuid(),
description=s.get('description', ''), project_id=tenant_id, description=s.get('description', ''), project_id=tenant_id,
name=s.get('name', ''), is_default=default_sg) name=s.get('name', ''), is_default=default_sg)
# Note(asarfaty): for unknown reason, removing the 'is_default'
# here allows the loading of the ext_properties of the security
# group. If not - we will get DetachedInstanceError
if 'is_default' in sg.fields_no_update:
sg.fields_no_update.remove('is_default')
sg.create() sg.create()
secgroup_dict = self._make_security_group_dict(sg) secgroup_dict = self._make_security_group_dict(sg)