neutron/neutron
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
..
agent Do not release DHCP lease when no client ID is set on port 2019-03-14 19:28:43 +00:00
api Block port update from unbound DHCP agent 2018-12-18 11:11:35 +00:00
cmd Secure dnsmasq process against external abuse 2019-02-01 09:07:14 +00:00
common Always fill UDP checksums in DHCPv6 replies 2019-02-01 23:23:06 +00:00
conf Implement filter validation 2018-07-19 04:13:43 +00:00
core_extensions Refactor duplicated implementation of _get_policy_obj 2018-06-20 09:51:02 +08:00
db Fix notification about arp entries for dvr routers 2019-02-15 16:03:28 +00:00
debug Fix all pep8 E265 errors 2018-04-30 16:35:52 -04:00
extensions [server side] Expose port forwardings in FIP API 2018-07-27 17:25:10 +08:00
hacking use sqla functions from neutron-lib 2018-07-25 21:04:20 +00:00
ipam Fetch specific columns rather than full ORM entities 2018-09-27 16:28:37 +00:00
locale Imported Translations from Zanata 2018-11-30 09:16:33 +00:00
notifiers Fix W503 pep8 warnings 2018-04-17 14:22:58 +00:00
objects Merge "Fix performance regression adding rules to security groups" into stable/rocky 2019-02-09 10:38:17 +00:00
pecan_wsgi Implement filter validation 2018-07-19 04:13:43 +00:00
plugins Change duplicate OVS bridge datapath-ids 2019-02-01 08:36:24 +00:00
privileged Remove a bare raise noticed by the linter 2019-01-30 20:14:58 +03:00
quota Fetch specific columns rather than full ORM entities 2018-09-27 16:28:37 +00:00
scheduler Fetch specific columns rather than full ORM entities 2018-09-27 16:28:37 +00:00
server Allow neutron-api load config from WSGI process 2018-07-25 15:22:14 +07:00
services Do not delete trunk bridges if service port attached 2018-12-17 12:18:44 +00:00
tests Do not release DHCP lease when no client ID is set on port 2019-03-14 19:28:43 +00:00
__init__.py
_i18n.py Make code follow log translation guideline 2017-08-14 02:01:48 +00:00
auth.py Use oslo.context class method to construct context object 2017-03-23 09:02:46 +00:00
manager.py Implement filter validation 2018-07-19 04:13:43 +00:00
neutron_plugin_base_v2.py Do not load default service plugins if core plugin is not DB based 2017-11-09 20:34:52 +00:00
opts.py Merge "Remove deprecated cache_url" 2018-01-03 06:35:59 +00:00
policy.py Add ext_parent policy check 2018-08-01 02:45:42 +08:00
service.py Allow neutron-api load config from WSGI process 2018-07-25 15:22:14 +07:00
version.py
worker.py replace WorkerSupportServiceMixin with neutron-lib's WorkerBase 2017-06-14 06:56:48 -06:00
wsgi.py Fix all pep8 E265 errors 2018-04-30 16:35:52 -04:00