]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Restrict subnet create/update to avoid DHCP resync
authorwatanabe.isao <zou.yun@jp.fujitsu.com>
Wed, 15 Apr 2015 06:48:08 +0000 (15:48 +0900)
committerAkihiro Motoki <motoki@da.jp.nec.com>
Thu, 23 Apr 2015 05:57:06 +0000 (14:57 +0900)
commit0536ec113bc438265ba547bb8a8006aa96e646e3
tree9a6556f23dac26a94407f76031f7e5822395f38b
parenta0d896328672ae9e1ac948320bbbe89345696e62
Restrict subnet create/update to avoid DHCP resync

As we know, IPs in subnet CIDR are used for
1) Broadcast port
2) Gateway port
3) DHCP port if enable_dhcp is True, or update to True
4) Others go into allocation_pools
Above 1) to 3) are created by default, which means if CIDR doesn't
have that much of IPs, subnet create/update will cause a DHCP resync.

This fix is to add some restricts to the issue:
A) When subnet create, if enable_dhcp is True, /31 and /32
   cidrs are forbidden for IPv4 subnets while /127 and /128 cidrs are
   forbidden for IPv6 subnets.
B) When subnet update, if enable_dhcp is changing to True and there are no
   more IPs in allocation_pools, the request should be denied.

Change-Id: I2e4a4d5841b9ad908f02b7d0795cba07596c023d
Co-authored-by: Andrew Boik <dboik@cisco.com>
Closes-Bug: #1443798
(cherry picked from commit 0c1f96ad5a6606c1205bd50ea944c3a383892cde)
neutron/db/db_base_plugin_v2.py
neutron/tests/unit/db/test_db_base_plugin_v2.py