Ensure non-overlapping cidrs in subnetpools without galera
_get_allocated_cidrs[1] locks only allocated subnets in a subnetpool
(with mysql/postgresql at least). It ensures we don't allocate a cidr
overlapping with existent cidrs but nothing disallows a concurrent
subnet allocation to create a subnet in the same subnetpool.
This change replaces the lock on subnetpool subnets by a lock on the
subnetpool itself. It disallows to allocate concurrently 2 subnets in
the same subnetpool and ensure non-overlapping cidrs in the same
subnetpool.
Moreover this change solves a trouble with postgresql which disallows
to lock an empty select with an outer join: it happens on first subnet
allocation in a subnetpool when no specific cidr is provided. Moving
the lock ensures the lock is done on a non-empty select.
But this change does not ensure non-overlapping cidrs in subnetpools
with galera because galera doesn't support SELECT FOR UPDATE locks. A
follow-up change will (try to?) remove locks from subnet allocation[1]
in order to ensure non-overlapping cidrs in subnetpools also with galera.
Reviewed: https:/ /review. openstack. org/179955 /git.openstack. org/cgit/ openstack/ neutron/ commit/ ?id=3682e3391f1 88845d0c7f382f0 ccd4b38db3904e
Committed: https:/
Submitter: Jenkins
Branch: master
commit 3682e3391f18884 5d0c7f382f0ccd4 b38db3904e
Author: Cedric Brandily <email address hidden>
Date: Mon May 4 23:36:19 2015 +0200
Ensure non-overlapping cidrs in subnetpools without galera
_get_ allocated_ cidrs[1] locks only allocated subnets in a subnetpool
(with mysql/postgresql at least). It ensures we don't allocate a cidr
overlapping with existent cidrs but nothing disallows a concurrent
subnet allocation to create a subnet in the same subnetpool.
This change replaces the lock on subnetpool subnets by a lock on the
subnetpool itself. It disallows to allocate concurrently 2 subnets in
the same subnetpool and ensure non-overlapping cidrs in the same
subnetpool.
Moreover this change solves a trouble with postgresql which disallows
to lock an empty select with an outer join: it happens on first subnet
allocation in a subnetpool when no specific cidr is provided. Moving
the lock ensures the lock is done on a non-empty select.
But this change does not ensure non-overlapping cidrs in subnetpools
with galera because galera doesn't support SELECT FOR UPDATE locks. A
follow-up change will (try to?) remove locks from subnet allocation[1]
in order to ensure non-overlapping cidrs in subnetpools also with galera.
[1] in neutron. ipam.subnet_ alloc.SubnetAll ocator
Closes-Bug: #1451558 21ae0d89c5dc489 3ccc16d07e4
Partial-Bug: #1451576
Change-Id: I73854f9863f446