Fix race condition by using lock on enable_radvd

For an HA Router, radvd is spawned only in the Master Node.
KeepalivedStateChangeHandler after receiving the state notification
on the unix domain socket, would either enable/disable the radvd
process depending on the state of the HA Router. In parallel, if
there is a request to add an interface to the router, router.process()
would try to enable radvd in parallel. So there is a possible race
condition as two threads try to enable radvd in parallel. This patch
uses appropriate locking mechanism to prevent this race condition.

Closes-Bug: #1466663
Change-Id: I40df78cc57fcde5512336d9dfef88b3b06a69bcb
(cherry picked from commit 27503dad33)
This commit is contained in:
sridhargaddam 2015-06-19 16:17:01 +00:00 committed by Sridhar Gaddam
parent c95f3ac67f
commit 1a1cc3d44b
1 changed files with 1 additions and 0 deletions

View File

@ -364,6 +364,7 @@ class HaRouter(router.RouterInfo):
if self.ha_port:
self.enable_keepalived()
@common_utils.synchronized('enable_radvd')
def enable_radvd(self, internal_ports=None):
if (self.keepalived_manager.get_process().active and
self.ha_state == 'master'):