Merge lp:~soren/nova/only-start-one-dnsmasq into lp:~hudson-openstack/nova/trunk

Proposed by Soren Hansen
Status: Merged
Approved by: Vish Ishaya
Approved revision: 839
Merged at revision: 842
Proposed branch: lp:~soren/nova/only-start-one-dnsmasq
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 10 lines (+1/-0)
1 file modified
nova/network/linux_net.py (+1/-0)
To merge this branch: bzr merge lp:~soren/nova/only-start-one-dnsmasq
Reviewer Review Type Date Requested Status
Vish Ishaya (community) Approve
Matt Dietz (community) Approve
Review via email: mp+54169@code.launchpad.net

Commit message

Wrap update_dhcp in utils.synchronized.

Description of the change

From the linked bug:

"When I reinstall my test environment and start running instances on it, usually only one of the first batch succeeds, the rest are stuck in "networking" state. After that everything is fine and I can run many concurrent RunInstances calls.

I'm not completely sure, but my working hypothesis is each thread finds that dnsmasq isn't running, and then tries to start it, all at roughly the same time. Only one succeeds, though, because only one process can listen on the socket at any given time."

The hypothesis held up, adding this lock has completely solved the problem.

This change is crucial for the automated integration tests to be integrated into the patch acceptance workflow. Without it, the first round of tests after a clean install will fail.

To post a comment you must log in.
Revision history for this message
Matt Dietz (cerberus) wrote :

Makes sense to me.

review: Approve
Revision history for this message
Vish Ishaya (vishvananda) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nova/network/linux_net.py'
2--- nova/network/linux_net.py 2011-03-18 13:56:05 +0000
3+++ nova/network/linux_net.py 2011-03-21 09:08:37 +0000
4@@ -557,6 +557,7 @@
5 # NOTE(ja): Sending a HUP only reloads the hostfile, so any
6 # configuration options (like dchp-range, vlan, ...)
7 # aren't reloaded.
8+@utils.synchronized('dnsmasq_start')
9 def update_dhcp(context, network_id):
10 """(Re)starts a dnsmasq server for a given network
11