In our highly fluid demo environment we learned that when you delete a project without deleting the floating IP address associated with a now defunct instance, that floating IP address goes into no-mans land. Hopefully this will be changed at some point to automatically release them. But for now, it doesn't. Since we're a but crunched for public floating IP addresses in our environment, reclaiming these orphans is not just a noble cause, but also an imperative!
Bill Harper on my team shared a few thoughts on how to do this and I added my own to his instructions. We came up with a way to find these lost souls. It would be easy to script this, but in our usual slothfulness, we're just putting the manual instructions here so you don't need to trust everything you download from the internet... even if it is a Cisco site!
Step 0: Set environment to execute commands as an administrator!
These steps can only be done if you are an administrator as other accounts don't have this privilege.
Step 1 - List all the floating IP addresses
Using the floating-ip-bulk-list command we can see all of the floating IP addresses in the system. Some of these may be assigned, others may not be.
This is our first place to start finding the lost IPs!
Step 2 - run a command looking for IP address attached to projects that are not on the system (keystone).
This handy set of pipes will show us which tenant doesn't exist by referencing the project_id with the floating IP addresses. You'll get some output of something like:
So now we just need to find all the IP addresses in this project/tenant!
Step 3 - Pinpoint the invalid project
This will give us a list of all the IP addresses that were once part of this once great now defunct project that we can reclaim. Suppose one of our addresses is 220.127.116.11. Let's get it back.
Step 4. Get the address in question:
First, delete the IP address.
Step 5. Now add the address back into the pool:
Next,we add it back in:
Notice that I used the --pool demo1 flag to put this back in the demo1 group. You will probably have another pool that you saw when you ran the command in step 1. You probably will want to put it back into that same pool!
Repeat steps 4 & 5 for the other IP addresses you found in step 3 and there are as good as new.