1

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 ?
user1027336
  • 101
  • 1
  • 2
  • 10

2 Answers2

1

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

  • Thanks for your answer. These commands give the list of existing IPs, even the associated ones. What I need is only one IP which isn't associated. – user1027336 Jan 04 '18 at 04:51
  • not sure about the command, but an easy python code will do the work. Set A = openstack floating ip list, Set B = openstack floating ip list -- status "active" + openstack floating ip list --status "down". Then A - B will give floating IPs not associated. – abhilash_goyal Jan 15 '18 at 11:56
1
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.

abhilash_goyal
  • 711
  • 1
  • 10
  • 31