Reuse detached floating IPs in OpenStack

≡放荡痞女 提交于 2021-01-28 06:47:59

问题


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 ?

回答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




回答2:


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.



来源:https://stackoverflow.com/questions/47974059/reuse-detached-floating-ips-in-openstack

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!