问题
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:
- 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]
- I shutdown MyVM and delete it
- 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
- 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