Use Subnet pools to avoid cidr concurrency issues
This patch removes the tobiko.openstack.neutron._cidr module that was used to generate CIDRs whenever tobiko was going to create a new subnet. That method had problems when several tobiko workers running in parallel tried to create subnets. Collisions happened sometimes, resulting in the creation of two subnets with a common CIDR that could fail if they were connected to a common router. This patch uses the neutron subnet pool feature [1]. When Tobiko creates a subnet, it will not calculate a free IPv4/IPv6 CIDR, but will associate that subnet to common Subnet Pools, shared by the different tests. When the subnet is created, it is neutron responsibiltiy to allocate a free CIDR for that subnet, based on the created Subnet Pools. The method that creates the Subnet Pools uses an @oslo_concurrency.lockutils.synchronized decorator to guarantee that two Tobiko workers do not create the same Subnet Pool at the same time. [1] https://docs.openstack.org/neutron/latest/admin/config-subnet-pools.html Change-Id: I3b09e468310e06f8c4b7d7dbec02e4b2e6f67530
This commit is contained in:
@@ -27,17 +27,13 @@ parameters:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
ipv4_cidr:
|
||||
description: IPv4 subnet CIDR to be assigned to new network
|
||||
subnet_pool_ipv4_id:
|
||||
description: IPv4 Subnet Pool ID
|
||||
type: string
|
||||
constraints:
|
||||
- custom_constraint: net_cidr
|
||||
|
||||
ipv6_cidr:
|
||||
description: IPv6 subnet CIDR to be assigned to new network
|
||||
subnet_pool_ipv6_id:
|
||||
description: IPv6 Subnet Pool ID
|
||||
type: string
|
||||
constraints:
|
||||
- custom_constraint: net_cidr
|
||||
|
||||
ipv4_dns_nameservers:
|
||||
description: IPv4 nameservers IP addresses
|
||||
@@ -125,7 +121,7 @@ resources:
|
||||
properties:
|
||||
network: {get_resource: _network}
|
||||
ip_version: 4
|
||||
cidr: {get_param: ipv4_cidr}
|
||||
subnetpool: {get_param: subnet_pool_ipv4_id}
|
||||
dns_nameservers: {get_param: ipv4_dns_nameservers}
|
||||
|
||||
_ipv6_subnet:
|
||||
@@ -134,7 +130,7 @@ resources:
|
||||
properties:
|
||||
network: {get_resource: _network}
|
||||
ip_version: 6
|
||||
cidr: {get_param: ipv6_cidr}
|
||||
subnetpool: {get_param: subnet_pool_ipv6_id}
|
||||
dns_nameservers: {get_param: ipv6_dns_nameservers}
|
||||
ipv6_address_mode: {get_param: ipv6_address_mode}
|
||||
ipv6_ra_mode: {get_param: ipv6_ra_mode}
|
||||
|
||||
Reference in New Issue
Block a user