starting dnsmasq should be protected by semaphore

Bug #977875 reported by Mandar Vaze
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Mandar Vaze

Bug Description

Scenario :
========

while enable_dhcp() method in nova/network/quantum/manager.py is protected using @utils.synchronized decorator, update_dhcp() is NOT.

Thus multiple update_dhcp and a enable_dhcp method could be executed on same time. This could cause problem when starting dnsmasq

Following steps are done in both enable_dhcp() and update_dhcp()
1) update_dhcp_hostfile_with_texts
2) kill_dhcp (only in update_dhcp - Not done in enable_dhcp)
3) restart_dhcp

Steps 1,2,3 should be executed atomically.

Proposed Solution :
================

Create new private method inside update_dhcp:

@utils.synchronized('quantum-update-dhcp')
def _safe_restart_dhcp(self, dev, hosts,network_ref)
    self.driver.update_dhcp_hostfile_with_text(dev, hosts)
    # Restart dnsmasq
    self.driver.kill_dhcp(dev)
    self.driver.restart_dhcp(context, dev, network_ref)

Now Invoke the above method from update_dhcp() instead of three separate steps.

Mandar Vaze (mandarvaze)
Changed in nova:
assignee: nobody → Mandar Vaze (mandarvaze)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/6481

Changed in nova:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/6481
Committed: http://github.com/openstack/nova/commit/72d0299d438b9bb25fba3fe4a2f5ade8544055ae
Submitter: Jenkins
Branch: master

commit 72d0299d438b9bb25fba3fe4a2f5ade8544055ae
Author: Mandar Vaze <email address hidden>
Date: Thu Apr 12 05:45:24 2012 -0700

    Introduced _atomic_restart_dhcp() Fixes Bug 977875

    Introduced a new method which executes update_dhcp_text_file
    and restart_dhcp as one atomic unit - to avoid race between these
    steps.

    Change-Id: I6fda9fbfcaf59fa6a4859b361574d98e16331882

Changed in nova:
status: In Progress → Fix Committed
Mandar Vaze (mandarvaze)
tags: added: essex-backport
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/essex)

Fix proposed to branch: stable/essex
Review: https://review.openstack.org/7268

Devin Carlen (devcamcar)
Changed in nova:
importance: Undecided → Medium
milestone: none → folsom-1
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: folsom-1 → 2012.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.