So in my case the port is stale in DHCP agent because it is in NetworkCache.deleted_ports set.
The fun fact is that those problematic ports never hit NetworkCache.put_port() function. I added extra debug message in this function but I have no messages with those problematic ports (I have messages with other ports).
For example port dbe7ba5a-7340-428c-a6a6-bda7843dede8.
The port has been created around 07:23:39 by Nova.
The port has been deleted around 07:28:46 by Nova after 300 sec timeout.
Log from neutron-server.log:
2018-04-04 07:23:39.071 33 DEBUG neutron.db.provisioning_blocks [req-de2bd147-5db1-435a-864b-c10b63a79c1f aae866ac58414f81953c57df2494eaf9 579ef78d275a4019865bca2057af3caf - default default] Transition to ACTIVE for port object dbe7ba5a-7340-428c-a6a6-bda7843dede8 will not be triggered until provisioned by entity DHCP. add_provisioning_component /var/lib/kolla/venv/local/lib/python2.7/site-packages/neutron/db/provisioning_blocks.py:73
So in my case the port is stale in DHCP agent because it is in NetworkCache. deleted_ ports set.
The fun fact is that those problematic ports never hit NetworkCache. put_port( ) function. I added extra debug message in this function but I have no messages with those problematic ports (I have messages with other ports).
For example port dbe7ba5a- 7340-428c- a6a6-bda7843ded e8.
The port has been created around 07:23:39 by Nova.
The port has been deleted around 07:28:46 by Nova after 300 sec timeout.
Log from neutron-server.log:
2018-04-04 07:23:39.071 33 DEBUG neutron. db.provisioning _blocks [req-de2bd147- 5db1-435a- 864b-c10b63a79c 1f aae866ac58414f8 1953c57df2494ea f9 579ef78d275a401 9865bca2057af3c af - default default] Transition to ACTIVE for port object dbe7ba5a- 7340-428c- a6a6-bda7843ded e8 will not be triggered until provisioned by entity DHCP. add_provisionin g_component /var/lib/ kolla/venv/ local/lib/ python2. 7/site- packages/ neutron/ db/provisioning _blocks. py:73
DHCP agent logs on ctrl3:
grep -B1 dbe7ba5a- 7340-428c- a6a6-bda7843ded e8 neutron- dhcp-agent. log
2018-04-04 07:29:35.504 7 DEBUG neutron. agent.dhcp. agent [req-de2bd147- 5db1-435a- 864b-c10b63a79c 1f aae866ac58414f8 1953c57df2494ea f9 579ef78d275a401 9865bca2057af3c af - - -] PMDEBUG is_port_ message_ stale: port in deleted_ports is_port_ message_ stale /var/lib/ kolla/venv/ local/lib/ python2. 7/site- packages/ neutron/ agent/dhcp/ agent.py: 624 agent.dhcp. agent [req-de2bd147- 5db1-435a- 864b-c10b63a79c 1f aae866ac58414f8 1953c57df2494ea f9 579ef78d275a401 9865bca2057af3c af - - -] Discarding stale port update: admin_state_ up=True, allowed_ address_ pairs=[ ], binding:host_id=, binding:profile=, binding: vif_details= , binding: vif_type= unbound, binding: vnic_type= normal, created_ at=2018- 04-04T07: 23:38Z, description=, device_ id=74ec5382- 110f-4590- a897-2ecdd46bcf 4f, device_owner=, extra_dhcp_opts=[], fixed_ips= [{u'subnet_ id': u'bd145992- d7fe-4fc8- acc7-ba510f8388 e6', u'ip_address': u'10.7.0.26'}], id=dbe7ba5a- 7340-428c- a6a6-bda7843ded e8, mac_address= fa:16:3e: eb:f2:64, name=, network_ id=b86c5078- 65fe-480c- b658-300274dba0 a2, port_security_ enabled= True, project_ id=579ef78d275a 4019865bca2057a f3caf, revision_number=3, security_ groups= [u'b165182d- cd0f-42a5- b5d4-5434b9079a a8'], status=DOWN, tags=[], tenant_ id=579ef78d275a 4019865bca2057a f3caf, updated_ at=2018- 04-04T07: 23:38Z port_update_end /var/lib/ kolla/venv/ local/lib/ python2. 7/site- packages/ neutron/ agent/dhcp/ agent.py: 409 agent.dhcp. agent [req-fc24211e- 33ef-4dcb- 8104-8442dcbfe6 f1 2f1c221e2bfb476 bb9949244268b95 96 fecb9ee2da694ab eb723e2068b29ac 3e - - -] PMDEBUG is_port_ message_ stale: port in deleted_ports is_port_ message_ stale /var/lib/ kolla/venv/ local/lib/ python2. 7/site- packages/ neutron/ agent/dhcp/ agent.py: 624 agent.dhcp. agent [req-fc24211e- 33ef-4dcb- 8104-8442dcbfe6 f1 2f1c221e2bfb476 bb9949244268b95 96 fecb9ee2da694ab eb723e2068b29ac 3e - - -] Discarding stale port update: admin_state_ up=True, allowed_ address_ pairs=[ ], binding: host_id= cds-compute11, binding:profile=, binding: vif_details= , binding: vif_type= unbound, binding: vnic_type= normal, created_ at=2018- 04-04T07: 23:38Z, description=, device_ id=74ec5382- 110f-4590- a897-2ecdd46bcf 4f, device_ owner=compute: nova, extra_dhcp_opts=[], fixed_ips= [{u'subnet_ id': u'bd145992- d7fe-4fc8- acc7-ba510f8388 e6', u'ip_address': u'10.7.0.26'}], id=dbe7ba5a- 7340-428c- a6a6-bda7843ded e8, mac_address= fa:16:3e: eb:f2:64, name=, network_ id=b86c5078- 65fe-480c- b658-300274dba0 a2, port_security_ enabled= True, project_ id=579ef78d275a 4019865bca2057a f3caf, revision_number=4, security_ groups= [u'b165182d- cd0f-42a5- b5d4-5434b9079a a8'], status=DOWN, tags=[], tenant_ id=579ef78d275a 4019865bca2057a f3caf, updated_ at=2018- 04-04T07: 23:39Z port_update_end /var/lib/ kolla/venv/ local/lib/ python2. 7/site- packages/ neutron/ agent/dhcp/ agent.py: 409 agent.dhcp. agent [req-fc24211e- 33ef-4dcb- 8104-8442dcbfe6 f1 2f1c221e2bfb476 bb9949244268b95 96 fecb9ee2da694ab eb723e2068b29ac 3e - - -] PMDEBUG is_port_ message_ stale: port in deleted_ports is_port_ message_ stale /var/lib/ kolla/venv/ local/lib/ python2. 7/site- packages/ neutron/ agent/dhcp/ agent.py: 624 agent.dhcp. agent [req-fc24211e- 33ef-4dcb- 8104-8442dcbfe6 f1 2f1c221e2bfb476 bb9949244268b95 96 fecb9ee2da694ab eb723e2068b29ac 3e - - -] Discarding stale port update: admin_state_ up=True, allowed_ address_ pairs=[ ], binding: host_id= cds-compute11, binding:profile=, binding: vif_details= datapath_ type=system, ovs_hybrid_ plug=True, port_filter=True, binding: vif_type= ovs, binding: vnic_type= normal, created_ at=2018- 04-04T07: 23:38Z, description=, device_ id=74ec5382- 110f-4590- a897-2ecdd46bcf 4f, device_ owner=compute: nova, extra_dhcp_opts=[], fixed_ips= [{u'subnet_ id': u'bd145992- d7fe-4fc8- acc7-ba510f8388 e6', u'ip_address': u'10.7.0.26'}], id=dbe7ba5a- 7340-428c- a6a6-bda7843ded e8, mac_address= fa:16:3e: eb:f2:64, name=, network_ id=b86c5078- 65fe-480c- b658-300274dba0 a2, port_security_ enabled= True, project_ id=579ef78d275a 4019865bca2057a f3caf, revision_number=5, security_ groups= [u'b165182d- cd0f-42a5- b5d4-5434b9079a a8'], status=DOWN, tags=[], tenant_ id=579ef78d275a 4019865bca2057a f3caf, updated_ at=2018- 04-04T07: 23:40Z port_update_end /var/lib/ kolla/venv/ local/lib/ python2. 7/site- packages/ neutron/ agent/dhcp/ agent.py: 409
2018-04-04 07:29:35.504 7 DEBUG neutron.
--
2018-04-04 07:29:35.512 7 DEBUG neutron.
2018-04-04 07:29:35.513 7 DEBUG neutron.
--
2018-04-04 07:29:35.517 7 DEBUG neutron.
2018-04-04 07:29:35.517 7 DEBUG neutron.
DHCP agent logs on ctrl2 (4 minutes later???):
grep -B1 dbe7ba5a- 7340-428c- a6a6-bda7843ded e8 neutron- dhcp-agent. log
2018-04-04 07:33:55.460 7 DEBUG neutron. agent.dhcp. agent [req-de2bd147- 5db1-435a- 864b-c10b63a79c 1f aae866ac58414f8 1953c57df2494ea f9 579ef78d275a401 9865bca2057af3c af - - -] PMDEBUG is_port_ message_ stale: port in deleted_ports is_port_ message_ stale /var/lib/ kolla/venv/ local/lib/ python2. 7/site- packages/ neutron/ agent/dhcp/ agent.py: 624 agent.dhcp. agent [req-de2bd147- 5db1-435a- 864b-c10b63a79c 1f aae866ac58414f8 1953c57df2494ea f9 579ef78d275a401 9865bca2057af3c af - - -] Discarding stale port update: admin_state_ up=True, allowed_ address_ pairs=[ ], binding:host_id=, binding:profile=, binding: vif_details= , binding: vif_type= unbound, binding: vnic_type= normal, created_ at=2018- 04-04T07: 23:38Z, description=, device_ id=74ec5382- 110f-4590- a897-2ecdd46bcf 4f, device_owner=, extra_dhcp_opts=[], fixed_ips= [{u'subnet_ id': u'bd145992- d7fe-4fc8- acc7-ba510f8388 e6', u'ip_address': u'10.7.0.26'}], id=dbe7ba5a- 7340-428c- a6a6-bda7843ded e8, mac_address= fa:16:3e: eb:f2:64, name=, network_ id=b86c5078- 65fe-480c- b658-300274dba0 a2, port_security_ enabled= True, project_ id=579ef78d275a 4019865bca2057a f3caf, revision_number=3, security_ groups= [u'b165182d- cd0f-42a5- b5d4-5434b9079a a8'], status=DOWN, tags=[], tenant_ id=579ef78d275a 4019865bca2057a f3caf, updated_ at=2018- 04-04T07: 23:38Z port_update_end /var/lib/ kolla/venv/ local/lib/ python2. 7/site- packages/ neutron/ agent/dhcp/ agent.py: 409 agent.dhcp. agent [req-fc24211e- 33ef-4dcb- 8104-8442dcbfe6 f1 2f1c221e2bfb476 bb9949244268b95 96 fecb9ee2da694ab eb723e2068b29ac 3e - - -] PMDEBUG is_port_ message_ stale: port in deleted_ports is_port_ message_ stale /var/lib/ kolla/venv/ local/lib/ python2. 7/site- packages/ neutron/ agent/dhcp/ agent.py: 624 agent.dhcp. agent [req-fc24211e- 33ef-4dcb- 8104-8442dcbfe6 f1 2f1c221e2bfb476 bb9949244268b95 96 fecb9ee2da694ab eb723e2068b29ac 3e - - -] Discarding stale port update: admin_state_ up=True, allowed_ address_ pairs=[ ], binding: host_id= cds-compute11, binding:profile=, binding: vif_details= , binding: vif_type= unbound, binding: vnic_type= normal, created_ at=2018- 04-04T07: 23:38Z, description=, device_ id=74ec5382- 110f-4590- a897-2ecdd46bcf 4f, device_ owner=compute: nova, extra_dhcp_opts=[], fixed_ips= [{u'subnet_ id': u'bd145992- d7fe-4fc8- acc7-ba510f8388 e6', u'ip_address': u'10.7.0.26'}], id=dbe7ba5a- 7340-428c- a6a6-bda7843ded e8, mac_address= fa:16:3e: eb:f2:64, name=, network_ id=b86c5078- 65fe-480c- b658-300274dba0 a2, port_security_ enabled= True, project_ id=579ef78d275a 4019865bca2057a f3caf, revision_number=4, security_ groups= [u'b165182d- cd0f-42a5- b5d4-5434b9079a a8'], status=DOWN, tags=[], tenant_ id=579ef78d275a 4019865bca2057a f3caf, updated_ at=2018- 04-04T07: 23:39Z port_update_end /var/lib/ kolla/venv/ local/lib/ python2. 7/site- packages/ neutron/ agent/dhcp/ agent.py: 409 agent.dhcp. agent [req-fc24211e- 33ef-4dcb- 8104-8442dcbfe6 f1 2f1c221e2bfb476 bb9949244268b95 96 fecb9ee2da694ab eb723e2068b29ac 3e - - -] PMDEBUG is_port_ message_ stale: port in deleted_ports is_port_ message_ stale /var/lib/ kolla/venv/ local/lib/ python2. 7/site- packages/ neutron/ agent/dhcp/ agent.py: 624 agent.dhcp. agent [req-fc24211e- 33ef-4dcb- 8104-8442dcbfe6 f1 2f1c221e2bfb476 bb9949244268b95 96 fecb9ee2da694ab eb723e2068b29ac 3e - - -] Discarding stale port update: admin_state_ up=True, allowed_ address_ pairs=[ ], binding: host_id= cds-compute11, binding:profile=, binding: vif_details= datapath_ type=system, ovs_hybrid_ plug=True, port_filter=True, binding: vif_type= ovs, binding: vnic_type= normal, created_ at=2018- 04-04T07: 23:38Z, description=, device_ id=74ec5382- 110f-4590- a897-2ecdd46bcf 4f, device_ owner=compute: nova, extra_dhcp_opts=[], fixed_ips= [{u'subnet_ id': u'bd145992- d7fe-4fc8- acc7-ba510f8388 e6', u'ip_address': u'10.7.0.26'}], id=dbe7ba5a- 7340-428c- a6a6-bda7843ded e8, mac_address= fa:16:3e: eb:f2:64, name=, network_ id=b86c5078- 65fe-480c- b658-300274dba0 a2, port_security_ enabled= True, project_ id=579ef78d275a 4019865bca2057a f3caf, revision_number=5, security_ groups= [u'b165182d- cd0f-42a5- b5d4-5434b9079a a8'], status=DOWN, tags=[], tenant_ id=579ef78d275a 4019865bca2057a f3caf, updated_ at=2018- 04-04T07: 23:40Z port_update_end /var/lib/ kolla/venv/ local/lib/ python2. 7/site- packages/ neutron/ agent/dhcp/ agent.py: 409
2018-04-04 07:33:55.461 7 DEBUG neutron.
--
2018-04-04 07:33:55.469 7 DEBUG neutron.
2018-04-04 07:33:55.469 7 DEBUG neutron.
--
2018-04-04 07:33:55.473 7 DEBUG neutron.
2018-04-04 07:33:55.473 7 DEBUG neutron.
No other logs from DHCP agents about this port! Look like they missed create port event?
I spawned 100 VMs: 95 OK, 5 ERROR.