Skip to content

Commit

Permalink
Fix race when running initialize_gateway_device()
Browse files Browse the repository at this point in the history
If multiple calls that result in initialize_gateway_device() being
run occur at roughly the same time then there is a race between the
ip route commands being run at the same time. This will cause
instances to go into an error state. This commit adds a global lock
to the initialize_gateway_device() method to prevent it from being
run at the same time to avoid this issue.

The race condition is not directly testable in unit tests because it
requires a multithreaded environment to run
initialize_gateway_device() at the same time. It was uncovered
with tempest in parallel.

Fixes bug 1217163

Change-Id: Ib750381636d1341062928d0abc8d3518e327935e
  • Loading branch information
Matthew Treinish committed Aug 28, 2013
1 parent 1d6044f commit 7baa526
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions nova/network/linux_net.py
Expand Up @@ -804,6 +804,7 @@ def clean_conntrack(fixed_ip):
LOG.exception(_('Error deleting conntrack entries for %s'), fixed_ip)


@utils.synchronized('lock_gateway', external=True)
def initialize_gateway_device(dev, network_ref):
if not network_ref:
return
Expand Down

0 comments on commit 7baa526

Please sign in to comment.