We were unnecessarily checking whether or not an IP was actually
allocated in the subnet_find_allocation_count check. The reality is we
only care if the IP has been generated before, not whether or not it's
actually been allocated. The reason is by the time check the counts in
the database, we've already failed our attempt to reallocate from one of
the subnets. If we assume that no IPs are available for reallocation,
the next step is finding a subnet we can generate a new IP address in.
Also, adds checking to ensure we never accidentally reassign an
incorrectly generated IP address. Additionally, the patch takes the
proactive step of deleting the offending IP address altogether. Note
that it only touches deallocated and available IPs.
For reference, this is one of those "Should never happen, but we've seen it happen in Melange" cases. Just attempting to be proactive about it instead.
We were unnecessarily checking whether or not an IP was actually allocated in the subnet_find_allocation_count check. The reality is we only care if the IP has been generated before, not whether or not it's actually been allocated. The reason is by the time check the counts in the database, we've already failed our attempt to reallocate from one of the subnets. If we assume that no IPs are available for reallocation, the next step is finding a subnet we can generate a new IP address in.
Also, adds checking to ensure we never accidentally reassign an incorrectly generated IP address. Additionally, the patch takes the proactive step of deleting the offending IP address altogether. Note that it only touches deallocated and available IPs.