Eduardo Olivares a6e7a522df 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
2023-04-21 10:05:09 +02:00

37 lines
1.1 KiB
YAML

---
- name: "cleanup Loadbalancers created by Tobiko tests"
shell: |
source {{ stackrc_file }}
openstack loadbalancer list -f value -c 'name' | \
grep "^tobiko\." | \
xargs -r openstack loadbalancer delete --cascade --wait
ignore_errors: yes
- name: "cleanup Heat stacks created by Tobiko tests"
shell: |
source {{ stackrc_file }}
openstack stack list -f value -c 'Stack Name' | \
grep "^tobiko\." | \
xargs -r timeout 180 openstack stack delete -y --wait
register: result
retries: 5
delay: 5
until: result.rc == 0
ignore_errors: yes
- name: "cleanup subnet pools created by Tobiko tests"
shell: |
source {{ stackrc_file }}
openstack subnet pool list -f value -c 'Name' | \
grep "^tobiko\." | \
xargs -r openstack subnet pool delete
ignore_errors: yes
- name: "cleanup Glance images created by Tobiko tests"
shell: |
source {{ stackrc_file }}
openstack image list -f value -c 'Name' | \
grep "^tobiko\." | \
xargs -r openstack image delete
ignore_errors: yes