Actions
Bug #20475
closedImplement Random DB IPAM
Description
Default implementation of DB IPAM increases numbers which creates lot of chances for race conditions when provisioning multiple hosts.
We should provide a random implementation that will randomize assigned IPs. It's not bullet-proof solution to the issue, but chances are much lower.
Workaround:
diff --git a/app/services/ipam/db.rb b/app/services/ipam/db.rb index 87291ab3c..d7adff9f6 100644 --- a/app/services/ipam/db.rb +++ b/app/services/ipam/db.rb @@ -6,7 +6,7 @@ module IPAM subnet_range = IPAddr.new("#{subnet.network}/#{subnet.mask}", subnet.family).to_range from = subnet.from.present? ? IPAddr.new(subnet.from) : subnet_range.first(2).last to = subnet.to.present? ? IPAddr.new(subnet.to) : IPAddr.new(subnet_range.last.to_i - 2, subnet.family) - (from..to).each do |address| + (from..to).to_a.shuffle.each do |address| ip = address.to_s if !subnet.known_ips.include?(ip) && !excluded_ips.include?(ip) logger.debug("Found #{ip}")
Edit: This workaround does not work properly, can lead to huge allocation ending with OOM kill for larger subnets. This needs a proper patch.
Updated by Lukas Zapletal over 7 years ago
- Related to Bug #20474: Multiple free IPs returned after record deletion added
Updated by The Foreman Bot over 7 years ago
- Status changed from New to Ready For Testing
- Assignee set to Lukas Zapletal
- Pull request https://github.com/theforeman/foreman/pull/4716 added
Updated by Timo Goebel over 7 years ago
- Translation missing: en.field_release set to 240
Updated by Lukas Zapletal over 7 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset c84389de67e968f21fc18b83e21de4036f494a42.
Actions