Remove failing VMs in OpenStack

Occasionally OpenStack VMs fail to spawn or fail to terminate and cannot be removed from the VM list. Deleting the VM using the command line or web interface has no effect, they are stuck in the “spawning” or “deleting” state. To get rid of these zombie entries I remove them from the database using the following bash script (pass the machine UUID as parameter):


#!/bin/bash
mysql -uroot -ppassword << EOF
use nova;
DELETE a FROM nova.security_group_instance_association AS a INNER JOIN nova.instances AS b ON a.instance_id=b.id where b.uuid='$1';
DELETE FROM nova.instance_info_caches WHERE instance_id='$1';
DELETE FROM nova.instances WHERE uuid='$1';
EOF


Posted

in

by

Tags:

Comments

6 responses to “Remove failing VMs in OpenStack”

  1. jhalter

    Thanks, this saved me a lot of time!

  2. askstack

    thanks! I spend at least 4 hours on this problem.

  3. davidpc

    thanks for sharing!

  4. love_essex

    thanks a lot

  5. jeff

    thank you!

  6. Max

    Thank you very much! Helped a lot