ggiamarchi / vagrant-openstack-provider

Use Vagrant to manage OpenStack Cloud instances.
MIT License
245 stars 102 forks source link

Floating IP Reallocate Fails When Using Pool ID #325

Open EricHorton opened 7 years ago

EricHorton commented 7 years ago

vagrant: v1.9.1 vagrant-openstack-provider: v0.9.0

When configuring os.floating_ip_pool, vagrant-openstack-provder correctly allocates a new floating ip if it is provided with the pool's id. However, even with os.floating_ip_pool_always_allocate = false, it does not correctly reuse floating ips that have already been allocated but are not attached to an instance.

I believe the issue is with search_free_ip, which appears to be using string.include? to check if the ip name matches the pool id. This works correctly if the pool name is used instead.

Because of the way include? is used, it may also be possible to construct a case where an incorrect ip is used if two pools have similar names. For instance, if the correct pool name is a substring of the other, although I have not tried this.