Skip to content

Instantly share code, notes, and snippets.

@mancdaz
Created September 19, 2012 10:39
Show Gist options
  • Save mancdaz/3748933 to your computer and use it in GitHub Desktop.
Save mancdaz/3748933 to your computer and use it in GitHub Desktop.
force remove instance from nova database (including all foreign key constraints)
USE nova;
SET @uuid = '0b8f832f-f013-441a-9f37-51b68f755359';
UPDATE floating_ips SET fixed_ip_id=NULL,host=NULL WHERE fixed_ip_id IN ( SELECT id FROM fixed_ips WHERE instance_id IN ( SELECT id FROM instances WHERE uuid = @uuid ) );
UPDATE fixed_ips SET updated_at=NULL,deleted_at=NULL,deleted=0,instance_id=NULL,allocated=0,leased=0,reserved=0,virtual_interface_id=NULL,host=NULL WHERE instance_id IN ( SELECT id FROM instances WHERE uuid = @uuid );
DELETE FROM security_group_instance_association WHERE instance_id IN ( SELECT id FROM instances WHERE uuid = @uuid );
DELETE FROM instance_info_caches WHERE instance_id IN ( SELECT id FROM instances WHERE uuid = @uuid );
DELETE FROM instances WHERE uuid = @uuid;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment