[DVR] Add lock during creation of FIP agent gateway port
In case when new external network is set as gateway network for
dvr router, neutron tries to create floating IP agent gateway port.
There should be always max 1 such port per network per L3 agent but
sometimes when there are 2 requests to set external gateway for 2
different routers executed almost in same time it may happend that
there will be 2 such ports created.
That will cause error with configuration of one of routers on L3 agent
and this will cause e.g. problems with access from VMs to metadata
service.
Such issues are visible in DVR CI jobs from time to time. Please check
related bug for details.
This patch adds lock mechanism during creation of such FIP gateway port.
Such solution isn't fully solving exising race condition as if 2
requests will be processed by api workers running on 2 different nodes
than this race can still happend.
But this should mitigate the issue a bit and solve problem in U/S gates
at least.
For proper fix we should probably add some constraint on database level
to prevent creation of 2 such ports for one network and one host but
such solution will not be easy to backport to stable branches so I would
prefer first to go with this easy workaround.
Conflicts: neutron/db/l3_dvr_db.py
Change-Id: Iabab7e4d36c7d6a876b2b74423efd7106a5f63f6
Related-Bug: #1830763
(cherry picked from commit 7b81c1bc67d2d85e03b4c96a8c1c558a2f909836)
(cherry picked from commit f7532f0c927a551ea40e81a35818eb83faba4b5a)
(cherry picked from commit 5c1afcaf2b9cb1bd09267a26dd4f5d7f7e99bf85)
Reviewed: https:/ /review. opendev. org/675846 /git.openstack. org/cgit/ openstack/ neutron/ commit/ ?id=99602ab15b7 7e8cc8641dc8a6a d760ddb04c3028
Committed: https:/
Submitter: Zuul
Branch: stable/queens
commit 99602ab15b77e8c c8641dc8a6ad760 ddb04c3028
Author: Slawek Kaplonski <email address hidden>
Date: Mon Jul 29 18:15:33 2019 +0200
[DVR] Add lock during creation of FIP agent gateway port
In case when new external network is set as gateway network for
dvr router, neutron tries to create floating IP agent gateway port.
There should be always max 1 such port per network per L3 agent but
sometimes when there are 2 requests to set external gateway for 2
different routers executed almost in same time it may happend that
there will be 2 such ports created.
That will cause error with configuration of one of routers on L3 agent
and this will cause e.g. problems with access from VMs to metadata
service.
Such issues are visible in DVR CI jobs from time to time. Please check
related bug for details.
This patch adds lock mechanism during creation of such FIP gateway port.
Such solution isn't fully solving exising race condition as if 2
requests will be processed by api workers running on 2 different nodes
than this race can still happend.
But this should mitigate the issue a bit and solve problem in U/S gates
at least.
For proper fix we should probably add some constraint on database level
to prevent creation of 2 such ports for one network and one host but
such solution will not be easy to backport to stable branches so I would
prefer first to go with this easy workaround.
Conflicts:
neutron/ db/l3_dvr_ db.py
Change-Id: Iabab7e4d36c7d6 a876b2b74423efd 7106a5f63f6 e03b4c96a8c1c55 8a2f909836) ea40e81a35818eb 83faba4b5a) d09267a26dd4f5d 7f7e99bf85)
Related-Bug: #1830763
(cherry picked from commit 7b81c1bc67d2d85
(cherry picked from commit f7532f0c927a551
(cherry picked from commit 5c1afcaf2b9cb1b