Do not release DHCP lease when no client ID is set on port
The DHCP agent has a really strict enforcement of client ID, which
is part of the DHCP extra options. If a VM advertises a client ID,
DHCP agent will automatically release it's lease whenever *any* other
port is updated/deleted, even if no client ID is set on the port,
because it thinks the client ID has changed.
When reload_allocations() is called, the DHCP agent parses the leases
and hosts files, and gets the list of all the ports in the network from the
DB, computing 3 different sets. The set from the leases file (v4_leases)
could have a client ID, but the set from the port DB and hosts file will
have None.
As a result, the set subtraction does not filter out the entry,
and all ports that have an active lease with a client ID are released.
The Client ID should only be enforced and leases released
if it's actually set in the port DB's DHCP extra Opts.
In that case it means someone knows what they are doing,
and we want to check for a mismatch. If the client ID on a port is
empty, it should not be treated like an unused lease.
We can't expect end users that just create VMs with auto created ports
to know/care about DHCP client IDs, then manually update ports or
change app templates.
Reviewed: https:/ /review. openstack. org/643443 /git.openstack. org/cgit/ openstack/ neutron/ commit/ ?id=ce037876a75 98bd270e26bca96 955c38036b2206
Committed: https:/
Submitter: Zuul
Branch: stable/rocky
commit ce037876a7598bd 270e26bca96955c 38036b2206
Author: Arjun Baindur <email address hidden>
Date: Wed Dec 5 12:43:05 2018 -0800
Do not release DHCP lease when no client ID is set on port
The DHCP agent has a really strict enforcement of client ID, which
is part of the DHCP extra options. If a VM advertises a client ID,
DHCP agent will automatically release it's lease whenever *any* other
port is updated/deleted, even if no client ID is set on the port,
because it thinks the client ID has changed.
When reload_ allocations( ) is called, the DHCP agent parses the leases
and hosts files, and gets the list of all the ports in the network from the
DB, computing 3 different sets. The set from the leases file (v4_leases)
could have a client ID, but the set from the port DB and hosts file will
have None.
As a result, the set subtraction does not filter out the entry,
and all ports that have an active lease with a client ID are released.
The Client ID should only be enforced and leases released
if it's actually set in the port DB's DHCP extra Opts.
In that case it means someone knows what they are doing,
and we want to check for a mismatch. If the client ID on a port is
empty, it should not be treated like an unused lease.
We can't expect end users that just create VMs with auto created ports
to know/care about DHCP client IDs, then manually update ports or
change app templates.
In some cases, like Windows VMs, the client ID is advertised as the MAC by default. /support. microsoft. com/en- us/help/ 3004537/ dhcp-client- always- includes- option- 61-in-the- dhcp-request- in-windows- 8
In fact, there is a Windows bug which prevents you from even turning this off:
https:/
Linux VMs don't have this on by default, but it may be enabled
in some templates unknown to users.
Change-Id: I8021f740bd78e6 54915337bd3287b 45b2c422e95 14099966ad724e9 a4bd604c18)
Closes-Bug: #1806770
(cherry picked from commit f2111e035424bf7