Skip to content

synchronize lookup and assignment of floating ip#27

Merged
hartmantis merged 1 commit intotest-kitchen:masterfrom
jgawor:ip_pool_mutex
Oct 15, 2013
Merged

synchronize lookup and assignment of floating ip#27
hartmantis merged 1 commit intotest-kitchen:masterfrom
jgawor:ip_pool_mutex

Conversation

@jgawor
Copy link
Copy Markdown
Contributor

@jgawor jgawor commented Oct 15, 2013

Test kitchen can be run in parallel mode (-p option). When the driver is configured with floating_ip_pool option, it might try to assign the same floating ip address to two or more instances (and that might cause for two different tests to run on the same instance at the same time).
The problem here is really a combination of issues. First is that the attach_ip_from_pool when executed at the same time can return the same free_addrs (and so that two threads will end up trying to associate the same address). Second, is that the server.associate_address address doesn't really return an error if the association fails. And, third, as far as I know the only way to verify the address assignment is to poll (e.g. by checking compute.addresses).

Since polling can be expensive and take some time or until somebody can suggest a better approach, for now I propose to synchronize the attach_ip_from_pool() method. That should at least ensure that the driver will not attempt to assign the same address twice. Obviously, this is not a foolproof solution as some other process might steal the address as the test kitchen runs but it makes the driver work a little better.

@hartmantis
Copy link
Copy Markdown
Contributor

Ewww, that does sound ugly. The intra-process fix looks good; I'm just poking around in Fog a little, hoping to find a magical solution to the cross-process race condition. We hadn't hit it yet at $workplace, but surely will as all our cookbook tests are moved onto TK.

@hartmantis
Copy link
Copy Markdown
Contributor

Looks like the associate_address limitations are how the OpenStack API works. It's doing an assignment and returning a 202 regardless of whether the IP was associated with another server beforehand or not. Even if polling happened here, it would still be possible to start up a dozen build processes and have them all fight over the same IP.

...unless there's something I missed, which I reeeaaally hope is the case, but going ahead and merging this.

hartmantis added a commit that referenced this pull request Oct 15, 2013
synchronize lookup and assignment of floating ip
@hartmantis hartmantis merged commit c93148f into test-kitchen:master Oct 15, 2013
@jgawor jgawor deleted the ip_pool_mutex branch October 15, 2013 19:47
@jgawor
Copy link
Copy Markdown
Contributor Author

jgawor commented Oct 15, 2013

Thanks. I hope OpenStack will handle this better in the future.

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

Successfully merging this pull request may close these issues.

2 participants