Last active
August 29, 2015 14:19
-
-
Save abelboldu/9fd84ca856468d98f435 to your computer and use it in GitHub Desktop.
Delete instance in nova
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The usage quotas for the tenant are updated after deleting or creating a new instance | |
read -s -p "MySQL Password: " pw | |
vm_uuid=$1 | |
mysql -D nova -p$pw -e "update instances set deleted='1', vm_state='deleted',deleted_at='now()' where uuid='$vm_uuid' limit 1;" | |
sleep 1 | |
mysql -D nova -p$pw -e "delete from instance_faults where instance_faults.instance_uuid = '$vm_uuid';" | |
mysql -D nova -p$pw -e "delete from instance_id_mappings where instance_id_mappings.uuid = '$vm_uuid';" | |
mysql -D nova -p$pw -e "delete from instance_info_caches where instance_info_caches.instance_uuid = '$vm_uuid';" | |
mysql -D nova -p$pw -e "delete from instance_system_metadata where instance_system_metadata.instance_uuid = '$vm_uuid';" | |
mysql -D nova -p$pw -e "delete from security_group_instance_association where security_group_instance_association.instance_uuid = '$vm_uuid';" | |
mysql -D nova -p$pw -e "delete from block_device_mapping where block_device_mapping.instance_uuid = '$vm_uuid';" | |
mysql -D nova -p$pw -e "delete from fixed_ips where fixed_ips.instance_uuid = '$vm_uuid';" | |
mysql -D nova -p$pw -e "delete from instance_actions_events where instance_actions_events.action_id in (select id from instance_actions where instance_actions.instance_uuid = '$vm_uuid');" | |
mysql -D nova -p$pw -e "delete from instance_actions where instance_actions.instance_uuid = '$vm_uuid';" | |
mysql -D nova -p$pw -e "delete from virtual_interfaces where virtual_interfaces.instance_uuid = '$vm_uuid';" | |
mysql -D nova -p$pw -e "delete from instances where instances.uuid = '$vm_uuid';" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment