Do not retry default security group creation
No need to retry creation of a default security group - it will always fail with DBDuplicate. The patch opens a transaction before calling to create_security_group() when creating default security group, thus avoiding db retries. Closes-Bug: #1625557 Change-Id: Id15b55b097641325ac68275fe4bb3ebe93718cdd
This commit is contained in:
parent
a0d1487cda
commit
09d1185d24
|
@ -671,8 +671,11 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase):
|
|||
'tenant_id': tenant_id,
|
||||
'description': _('Default security group')}
|
||||
}
|
||||
return self.create_security_group(
|
||||
context, security_group, default_sg=True)['id']
|
||||
# starting a transaction before create to avoid db retries
|
||||
with context.session.begin(subtransactions=True):
|
||||
sg_id = self.create_security_group(
|
||||
context, security_group, default_sg=True)['id']
|
||||
return sg_id
|
||||
|
||||
def _get_security_groups_on_port(self, context, port):
|
||||
"""Check that all security groups on port belong to tenant.
|
||||
|
|
Loading…
Reference in New Issue