[DHCP] AgentBinding for network will be created no matter the state

Bug #1911864 reported by LIU Yulong on 2021-01-15
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

Neutron creates N NetworkDhcpAgentBindings (N is equal to dhcp_agents_per_network) for network even if the subnets disabled the dhcp. This means no matter the DHCP state, the dhcp_scheduler will schedule the network anyway.

Reproduce steps:
$ source demo_rc
$ openstack network create 111
$ openstack subnet create --no-dhcp --subnet-range --network 871c588b-2582-4a08-bff7-d92e1590eecd 111-subnet

$ source admin_rc
$ openstack network agent list --network 871c588b-2582-4a08-bff7-d92e1590eecd
| ID | Agent Type | Host | Availability Zone | Alive | State | Binary |
| c9921687-30ee-470e-813f-6e45247b57f1 | DHCP agent | network2 | nova | :-) | UP | neutron-dhcp-agent |

Then this behavior has a result is that HA network for HA routers will also have such bindings.

Because the external network will not have VM created normally, so its subnets' enable_dhcp are all disabled. Again, the bindings are created.

Good news is that in DHCP agent side dhcp-namespace and dnsmasq are not created.

So, basically this is inconsitent between neutron server side and DHCP agent side.

So, I have some thoughts about this is to add config option to disable some types of network's dhcp agent binding.

Miguel Lavalle (minsel) wrote :

I'm classifying this as RFE.

Changed in neutron:
importance: Undecided → Wishlist
status: New → Triaged
tags: added: rfe-triaged
Oleg Bondarev (obondarev) wrote :

I think this was done just for simplicity, to not handle many events when needed to schedule/unschedule a net. What's wrong with having bindings in DB (even if net doesn't have dhcp enabled subnets yet)?

Slawek Kaplonski (slaweq) wrote :

Do we really need new config option just to avoid some entries in the db? There are no dhcp ports created in such case, so there is no any IP consumed for that.
TBH I agree with Oleg's comment here that this isn't big problem really. Or am I missing something?

tags: added: rfe
removed: rfe-triaged
LIU Yulong (dragon889) wrote :

This is inconsistent between neutron-server and agent side. The network has no enabled DHCP subnets. It should not be scheduled. This issue is asked from our customers.

We have noticed an extrem case, the user's external network has subnets with dhcp enabled. The external network's scheduled host has tons of dvr local router. After some invesgate, we believe that the external gateways from tons of routers were all treated as "connected to" this external network. Then DVR local router created for them. The host is basically dead.

So, another config option is that maybe add config options to diable external network, HA network's DHCP fundamentally by default, since no VM will be booted from the external network or HA network.

Oleg Bondarev (obondarev) wrote :

I know cases when VMs are created on external network - disabling this ability will affect users.

So in described case subnets were dhcp enabled - and were scheduled as expected, but I think current bug is about dhcp-disabled nets, right?
For the dvr local routers there was a fix: https://review.opendev.org/c/openstack/neutron/+/364793/ - doesn't it help?

I'm still not sure what is user impact of dhcp agent binding record in DB.

Slawek Kaplonski (slaweq) wrote :

After some more thinking about it, I don't think it is really RFE. Let's treat it as "regular bug".

tags: added: l3-ipam-dhcp
removed: rfe
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers