Method _ensure_default_security_group wasn't atomic as it first tries to get
default SG and if that not exists in DB, it tries to create it.
It may happend, like e.g. in Calico plugin that between
get_default_sg_id method and create_security_group method, this default
SG will be created by other neutron worker. And in such case there will
be Duplicate entry exception raised.
So this patch is adding handling of such exception.
Conflicts: neutron/db/securitygroups_db.py
Change-Id: I515c310f221e7d9ae3be59a26260538d1bc591c2
Closes-Bug: #1883730
(cherry picked from commit 7019c5cf50bc4ad97b302220664a26efaf81a7fd)
Reviewed: https:/ /review. opendev. org/737704 /git.openstack. org/cgit/ openstack/ neutron/ commit/ ?id=0cc3032edc7 d1cd533789453d1 9b2a1b2d193d38
Committed: https:/
Submitter: Zuul
Branch: stable/queens
commit 0cc3032edc7d1cd 533789453d19b2a 1b2d193d38
Author: Slawek Kaplonski <email address hidden>
Date: Thu Jun 18 23:18:07 2020 +0200
Make _ensure_ default_ security_ group method atomic
Method _ensure_ default_ security_ group wasn't atomic as it first tries to get
default SG and if that not exists in DB, it tries to create it.
It may happend, like e.g. in Calico plugin that between default_ sg_id method and create_ security_ group method, this default
get_
SG will be created by other neutron worker. And in such case there will
be Duplicate entry exception raised.
So this patch is adding handling of such exception.
Conflicts:
neutron/ db/securitygrou ps_db.py
Change-Id: I515c310f221e7d 9ae3be59a262605 38d1bc591c2 97b302220664a26 efaf81a7fd)
Closes-Bug: #1883730
(cherry picked from commit 7019c5cf50bc4ad