Fix race condition in dhcp agent
Fix race condition in dhcp agent

This patch fixes a race condition that can happen in the dhcp agent when
a subnet is created and then a host route is then immediately added to that
subnet following a subnet.update.end notification. The race condition occurs
in refresh_dhcp_helper() where self.enable_dhcp_helper() gets called twice
since the first call had not completed self.cache.put(network). This same race
condition can also occur in the other events so lockutils.synchronized() is
added to synchronize those code segments as well.

Fixes bug 1155748

Change-Id: I2ff52adc3dfebddd6d9c15d5dc79aa65be107179

adelina-t/neutron,armando-migliaccio/neutron,Juniper/contrail-dev-neutron,waltBB/neutron_read,vbannai/neutron,rdo-management/neutron,cisco-openstack/neutron,yamahata/tacker,miyakz1192/neutron,klmitch/neutron,silenci/neutron,openstack/neutron,mandeepdhami/neutron,zhhf/charging,JianyuWang/neutron,leeseuljeong/leeseulstack_neutron,pnavarro/neutron,rickerc/neutron_audit,CiscoSystems/quantum,leeseulstack/openstack,yamt/neutron,vbannai/neutron,eayunstack/neutron,kaiweifan/neutron,watonyweng/neutron,cernops/neutron,noironetworks/neutron,ykaneko/quantum,glove747/liberty-neutron,leeseuljeong/leeseulstack_neutron,wolverineav/neutron,mahak/neutron,apporc/neutron,NeCTAR-RC/neutron,Juniper/contrail-dev-neutron,dims/neutron,CiscoSystems/vespa,mandeepdhami/neutron,wenhuizhang/neutron,vivekanand1101/neutron,dims/neutron,CiscoSystems/neutron,jumpojoy/neutron,suneeth51/neutron,zhhf/charging,jacknjzhou/neutron,Juniper/contrail-dev-neutron,Comcast/neutron,ykaneko/quantum,virtualopensystems/neutron,CiscoSystems/neutron,paninetworks/neutron,armando-migliaccio/neutron,openstack/neutron,mahak/neutron,swdream/neutron,CiscoSystems/quantum,tpaszkowski/quantum,rickerc/neutron_audit,vveerava/Openstack,citrix-openstack-build/neutron,ntt-sic/neutron,alexandrucoman/vbox-neutron-agent,SmartInfrastructures/neutron,eonpatapon/neutron,neoareslinux/neutron,antonioUnina/neutron,barnsnake351/neutron,yamt/neutron,chitr/neutron,dhanunjaya/neutron,CiscoSystems/vespa,javaos74/neutron,jerryz1982/neutron,vbannai/neutron,virtualopensystems/neutron,MaximNevrov/neutron,netscaler/neutron,igor-toga/local-snat,silenci/neutron,igor-toga/local-snat,yamahata/tacker,gkotton/neutron,kaiweifan/vse-lbaas-plugin-poc,beagles/neutron_hacking,takeshineshiro/neutron,takeshineshiro/neutron,ntt-sic/neutron,liqin75/vse-vpnaas-plugin,liqin75/vse-vpnaas-plugin,MaximNevrov/neutron,bigswitch/neutron,vveerava/Openstack,sasukeh/neutron,kaiweifan/vse-lbaas-plugin-poc,openstack/neutron,beagles/neutron_hacking,cernops/neutron,Stavitsky/neutron,liqin75/vse-vpnaas-plugin,CiscoSystems/neutron,mattt416/neutron,pnavarro/neutron,redhat-openstack/neutron,vijayendrabvs/ssl-neutron,shahbazn/neutron,ntt-sic/neutron,Metaswitch/calico-neutron,oeeagle/quantum,vijayendrabvs/hap,sajuptpm/neutron-ipam,wenhuizhang/neutron,Brocade-OpenSource/OpenStack-DNRM-Neutron,suneeth51/neutron,neoareslinux/neutron,citrix-openstack-build/neutron,virtualopensystems/neutron,redhat-openstack/neutron,magic0704/neutron,yamt/neutron,noironetworks/neutron,jumpojoy/neutron,klmitch/neutron,vijayendrabvs/hap,asgard-lab/neutron,adelina-t/neutron,kaiweifan/vse-lbaas-plugin-poc,JioCloud/neutron,SamYaple/neutron,yamt/neutron,bigswitch/neutron,kaiweifan/vse-lbaas-plugin-poc,javaos74/neutron,CiscoSystems/quantum,infobloxopen/neutron,watonyweng/neutron,ykaneko/quantum,sebrandon1/neutron,yuewko/neutron,vijayendrabvs/ssl-neutron,ykaneko/neutron,cisco-openstack/neutron,rickerc/neutron_audit,Brocade-OpenSource/OpenStack-DNRM-Neutron,bgxavier/neutron,mattt416/neutron,beagles/neutron_hacking,alexandrucoman/vbox-neutron-agent,cloudbase/neutron-virtualbox,magic0704/neutron,rdo-management/neutron,yanheven/neutron,gopal1cloud/neutron,vijayendrabvs/hap,armando-migliaccio/neutron,bgxavier/neutron,Juniper/neutron,sajuptpm/neutron-ipam,tpaszkowski/quantum,gkotton/neutron,vivekanand1101/neutron,liqin75/vse-vpnaas-plugin,huntxu/neutron,gopal1cloud/neutron,yamahata/tacker,infobloxopen/neutron,JianyuWang/neutron,aristanetworks/neutron,jerryz1982/neutron,sasukeh/neutron,projectcalico/calico-neutron,blueboxgroup/neutron,apporc/neutron,huntxu/neutron,aristanetworks/neutron,oeeagle/quantum,mahak/neutron,kaiweifan/neutron,chitr/neutron,armando-migliaccio/neutron,miyakz1192/neutron,cloudbase/neutron-virtualbox,leeseuljeong/leeseulstack_neutron,leeseulstack/openstack,vijayendrabvs/ssl-neutron,dhanunjaya/neutron,citrix-openstack-build/neutron,cloudbase/neutron,yanheven/neutron,asgard-lab/neutron,projectcalico/calico-neutron,netscaler/neutron,Stavitsky/neutron,yamahata/neutron,Brocade-OpenSource/OpenStack-DNRM-Neutron,wolverineav/neutron,gkotton/neutron,tpaszkowski/quantum,eayunstack/neutron,yamahata/neutron,SmartInfrastructures/neutron,waltBB/neutron_read,shahbazn/neutron,Metaswitch/calico-neutron,ykaneko/quantum,sebrandon1/neutron,jacknjzhou/neutron,CiscoSystems/vespa,barnsnake351/neutron,JioCloud/neutron,antonioUnina/neutron,yamahata/neutron,Comcast/neutron,ykaneko/neutron,sajuptpm/neutron-ipam,mmnelemane/neutron,tpaszkowski/quantum,blueboxgroup/neutron,swdream/neutron,glove747/liberty-neutron,Juniper/neutron,eonpatapon/neutron,zhhf/charging,leeseulstack/openstack,NeCTAR-RC/neutron,cloudbase/neutron,mmnelemane/neutron,paninetworks/neutron,yuewko/neutron,skyddv/neutron,netscaler/neutron,ykaneko/neutron,blueboxgroup/neutron,Comcast/neutron,SamYaple/neutron,Juniper/neutron,skyddv/neutron,vveerava/Openstack,kaiweifan/neutron