Currently, there is no dns servers prioritization for subnets
for Neutron.
Generally speaking, it is useful to keep the order of dns
nameservers consistent. Add a new column named 'order' in table
'dnsnameservers' and add nameserver into DB one by one.
Closes-Bug: #1218629
Implements: blueprint keep-dns-nameserver-orderconsistency
Change-Id: Id937aea411397d39370368a4eb45be26c4eefa9e
Introduces new Pluggable IPAM backend.
IP/subnet allocation calls are sent to IPAM driver.
Calls to IPAM Driver are considered as call to third-party
environment, so if any action fails, rollback action is called.
Removes associate_neutron_subnet step from interface and reference
driver. It is not needed any more because foreign key relationship
between IPAM subnet and neutron subnet was removed.
So IPAM subnet can store id of neutron subnet,
which is not created yet.
For now only reference IPAM driver is available.
Temporarily disabled test_ipam_pluggable_backend from
gate-neutron-python34. Current patch adds executing
parts of test_db_base_plugin_v2, which is not py34 compatible yet.
Might be enabled back once 204791 is merged.
Partially-Implements: blueprint neutron-ipam
Change-Id: Ic18461cf19d2eebf8fad5535eee0eb034959800e
Changed inheritance chain for NeutronDbPluginV2 to allow switching from
non-pluggable to pluggable IPAM implementation.
IpamNonPluggableBackend methods are called on it's instance,
instead of previous way where IpamNonPluggableBackend was parent for
NeutronDbPluginV2.
It allows switching IPAM implementation in set_ipam_backend
(IpamNonPluggableBackend to IpamPluggableBackend).
All methods that became public in IpamNonPluggableBackend were renamed.
This is refactoring step before Pluggable IPAM can be applied.
Partially-Implements: blueprint neutron-ipam
Change-Id: I81806a43ecc6f0a7b293ce3e70d09d1e266b9f02
To keep pluggable and non-pluggable ipam implementation consistent
non-pluggable one has to be switched to track allocation_pools and
gateway_ip using SubnetRequests.
SubnetRequest requires allocation_pools to be list of IPRanges.
Previously allocation_pools were tracked as list of dicts.
So allocation_pools generating and validating was moved before
SubnetRequest is created.
Partially-Implements: blueprint neutron-ipam
Change-Id: I8d2fec3013b302db202121f946b53a0610ae8321
This reverts commit 1d61c5f736,
which reverted ee51ef72d3 due
to an issue with the allocation pools being mis-aligned with
the last address of a v6 subnet.
IPv6 does not have a subnet broadcast address so the last IP
address can be used as a regular address. This patch tweaks the
automatic allocation pool generation to include that last address
on v6 networks.
This was found because
NetworksTestDHCPv6.test_dhcp_stateful_fixedips_outrange makes the
assumption that the default generated pools cover the entire usable
address space.
Related-Bug: #1466322
Closes-Bug: #1468163
Change-Id: I5a2518c819757cd1fb43244901fe3e2f6c576b34
Moved allocation pool generation and validation into separate method.
Partially-Implements: blueprint neutron-ipam
Change-Id: Ibe241c7b6389e444145b0600f8fcee28e478bc62
ipam_backend_mixin contains methods common for both backends:
pluggable and non-pluggable, so moving methods to make them accessible
by backends.
Next methods were moved from db_base_plugin_v2.py to
ipam_backend_mixin.py:
- _validate_subnet_cidr
- _validate_network_subnetpools
- _allocate_pools_for_subnet
- _save_subnet
This commit moves methods without any internal changes.
All future changes and decomposition of these methods will be handled in
next commits.
Partially-Implements: blueprint neutron-ipam
Change-Id: I1ec786754467fc9039d2276f084f1bceaab15635
Original algorithm to calculate added/removed ips had O(n^2) complexity.
Using sets achieves O(n) for average case.
After refactoring input is no longer affected,
updated tests to reflect that.
However, dataset is too small to get any significant performance
improvement.
Using sets requires additional preparation and post operations:
- converting 'original_ips' and 'new_ips' to sets from ip_addresses
- building map(dict) for storing reference from ip_address to 'ips'
element
- converting calculated add/orignal/remove sets back to list of dicts
using map (dict of references).
Partially-Implements: blueprint neutron-ipam
Change-Id: Iecddc406f7b91cfdfb976882504113734e19b565
Moved validations into separate methods:
- _validate_pools_with_subnetpool
Verifies that allocation pools are set only for specific subnet request.
For any subnet request allocation pools can not be set manually
- _validate_ip_version_with_subnetpool
Verifies that subnet has the same ip version as subnet pool
Partially-Implements: blueprint neutron-ipam
Change-Id: I63f6aa2a0c94c3437fa624ac800943976f4fc50f
Pluggable ipam implementation will do additional actions on port
deletion (deallocate ip using ipam driver).
Existing _delete_port code will be resused.
Moving _delete_port to ipam_backend_mixin to make this code
accessible and extendable by both backends (pluggable and non
pluggable).
This commit is a preparation step before pluggable ipam implementation
can be used.
Partially-Implements: blueprint neutron-ipam
Change-Id: If6cd623aad9e5501a26e5fb8cdecd5f55e85cd05
This commit is a preparation step for using pluggable IPAM.
1. Moved get_subnets functionality to db_base_plugin_common to make it
accessible by ipam backends.
2. Reworked update_subnet routine:
- moved db part into update_db_subnet;
Partially-Implements: blueprint neutron-ipam
Change-Id: Idb8f54d9fccaad1137222d156590c37d86aa576b
Moved _update_subnet_allocation_pools to ipam_backend_mixin.py.
Call _rebuild_availability_ranges with self to make it overridable
on upper level (from non-pluggable backend).
Partially-Implements: blueprint neutron-ipam
Change-Id: If7b1e720f88a2f0177b6772a015ae216f19ee22d
This commit is a preparation step for using pluggable IPAM.
- moved validations into _validate_port_for_update;
- updating ip addresses for port is backend specific, so
moved into _update_port_with_ips in ipam_non_pluggable_backend;
- writing port changes to db is common for both backends, so
moved into _update_db_port in ipam_backend_mixin;
- updated to use namedtuple to track add/original/remove ips;
- added _make_fixed_ip_dict to exclude keys other than
ip_address and subnet_id;
Partially-Implements: blueprint neutron-ipam
Change-Id: I1110e88f372b1d0cc7ec72049ba69a6d548da867
This commit is a preparation step for using pluggable IPAM.
_update_ips_for_port was refactored and split into two methods:
- _get_changed_ips_for_port
This method contains calculations common for pluggable and
non-pluggable IPAM implementation, was moved to ipam_backend_mixin.
- _update_ips_for_port
This method is specific for non-pluggable IPAM implementation, so it
was moved to ipam_non_pluggable_backend_common.
Other changes:
- _update_ips_for_port now returns namedtuple with added, removed, original
ips (previously added and original ips were returned).
List of removed ips is required by pluggable IPAM implementaion
to apply rollback-on-failure logic;
- removed unused port_id argument from _update_ips_for_port argument list;
Partially-Implements: blueprint neutron-ipam
Change-Id: Id50b6227c8c2d94c35473aece080a6f106a5dfd8
This patch contains method moving with minor modifications like updating
class names. IPAM specific methods were moved into ipam_backend_mixin and
ipam_non_pluggable_backend.
ipam_backend_mixin - contains code common for both backends (pluggable and
non-pluggable).
ipam_non_pluggable_backend - contains code specific for non-pluggable
IPAM implementation.
Partially-Implements: blueprint neutron-ipam
Change-Id: I6d68e4066ca472107def197c5a5afccbb6886a0e