neutron/neutron/tests/unit/agent
Arjun Baindur ce037876a7 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.
In fact, there is a Windows bug which prevents you from even turning this off:
https://support.microsoft.com/en-us/help/3004537/dhcp-client-always-includes-option-61-in-the-dhcp-request-in-windows-8

Linux VMs don't have this on by default, but it may be enabled
in some templates unknown to users.

Change-Id: I8021f740bd78e654915337bd3287b45b2c422e95
Closes-Bug: #1806770
(cherry picked from commit f2111e0354)
2019-03-14 19:28:43 +00:00
..
common Remove deprecated IVS interface driver 2018-04-26 20:15:46 +00:00
dhcp Switch isolated metadata proxy to bind to 169.254.169.254 2019-02-12 10:30:25 +00:00
l2 Clear residual qos rules after l2-agent restarts. 2019-01-22 12:59:24 +00:00
l3 Merge "Spawn metadata proxy on dvr ha standby routers" into stable/rocky 2019-03-12 23:45:34 +00:00
linux Do not release DHCP lease when no client ID is set on port 2019-03-14 19:28:43 +00:00
metadata Switch isolated metadata proxy to bind to 169.254.169.254 2019-02-12 10:30:25 +00:00
ovsdb Merge "Kill _connection_to_manager_uri dummy" 2018-02-22 00:30:24 +00:00
windows Fix neutron-openvswitch-agent Windows support 2018-08-28 06:53:11 +00:00
__init__.py Empty files should not contain copyright or license 2014-10-20 00:50:32 +00:00
test_agent_extensions_manager.py Refactoring config options for l2 agent ext opts 2016-11-21 19:45:04 +00:00
test_resource_cache.py Merge "Fix race condition with enabling SG on many ports at once" 2018-01-27 10:36:37 +00:00
test_rpc.py Add binding activation to OVS agent 2018-07-18 11:59:33 -05:00
test_securitygroups_rpc.py Adopt hacking 1.1.0 2018-07-05 11:31:40 +09:00