]> 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)
committerwatanabe.isao <zou.yun@jp.fujitsu.com>
Thu, 23 Apr 2015 03:23:00 +0000 (12:23 +0900)
commit0c1f96ad5a6606c1205bd50ea944c3a383892cde
tree2367e982ee38cc4e87f8924796de639182f6d6a6
parentc48ba4c7b0c7d56fb29b5fe2a9856dbf3f08a7c9
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
neutron/db/db_base_plugin_v2.py
neutron/tests/unit/db/test_db_base_plugin_v2.py