Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate IP assignment #895

Open
rarenerd opened this issue Jun 4, 2020 · 0 comments
Open

Duplicate IP assignment #895

rarenerd opened this issue Jun 4, 2020 · 0 comments

Comments

@rarenerd
Copy link
Contributor

rarenerd commented Jun 4, 2020

When deploying multiple VMs in a network with a small amount of IP addresses available, there is a chance that an address gets assigned twice.

The current implementation of acquiring guest IP addresses looks up a list of all available addresses (using a database query) and uses java.util.Random to randomly pick an entry from that list.

return NetUtils.long2Ip(array[_rand.nextInt(array.length)]);

After this a validation process follows, the NIC object gets populated with various fields and it gets persisted in the database.

This can take a second or 2 to complete.

With tools like terraform it has become very easy to deploy multiple VMs at the same time, sometimes within milliseconds of each other. So within this window we've seen that the same IP address gets picked for different requests, and it will always happen when there is only a single address left in the pool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant