Changes subnet selection to reduce deadlocks

RM10449

Updates the subnet selection logic in IPAM in several places to account
for accidentally locking the subnets table as a side-effect when selecting
  IP addresses.
Merge pull request #276 from Cerberus98/RM10449_upstream

Changes subnet selection to reduce deadlocks