Today I had a problem with my CI. Basically, one of my compute nodes went down, and all the VM’s created in that compute node stop work (of course!). Since I hate to do a nova list and see a lot of VM’s in ERROR instance and I wasn’t being able to create new ones because the number of instances reach the limit for my tenant nor delete the instances since the scheduler couldn’t reach the compute node to send the RPC call saying "hey you, delete this instances right now!" All the left was look in google how to delete instances directly from database.

Then I found this post with a cool script! But since the post is from 2012, a lot of stuff change in OpenStack, so I had to make some changes.

The first one, I don’t want to access the database machine and run the commands directly from there, so I add the mysql host, mysql username and mysql password in the script.

Second, as I mention before, a lot of stuff change, mainly in database, newly constraints were created, so I add a few more DELETE statements.

Feel free to use the new script.

Usage: script.sh mysql_host mysql_username mysql_password your_vm_impossible_to_delete


By the way, I need to figure out how to refresh the number of instances, I had to increase, because openstack continue to say that I reach the limit.