Reuse detached floating IPs in OpenStack

491 views Asked by At

Is there any command to get already created floating IPs from a pool and which aren't assigned anymore to any VM instance ?

That's my use case:

  1. I create a floating IP and assign it to a VM with these commands:
    • nova floating-ip create [MyPool]
    • nova add-floating-ip [MyVM] [created_ip]
  2. I shutdown MyVM and delete it
  3. I do 1 and 2 in a loop and at a given time I use up all the available floating IPs in the pool and get the following error message:
    • No more floating ips in pool MyPool
  4. Question: how to automatically reuse detached floating IPs that aren't in the floating pool anymore ?
2

There are 2 answers

2
Carolinne Torres On

I haven't use nova to manage floating IPs only neutron.

neutron floatingip-list

But actually I ran nova help and there are options to get them ( I think now all the floating ip options with nova are deprecated). So you can try:

nova floating-ip-list

and then:

nova floating-ip-associate

0
abhilash_goyal On
openstack floating ip list -f json | jq  '.[] | select(.["Fixed IP Address"] == null ) | .["Floating IP Address"] '

This may work. I got this command from StackOverflow itself. Kindly check, if working, well and good, else Python code will do the magic required.