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/737702 /git.openstack. org/cgit/ openstack/ neutron/ commit/ ?id=13f8296d5c1 bf0e2bc90ee689a 4825ec9acf8881
Committed: https:/
Submitter: Zuul
Branch: stable/stein
commit 13f8296d5c1bf0e 2bc90ee689a4825 ec9acf8881
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