openstack的实例记录在nova数据库的instances表中,最简单的方式就是删除该记录。
解除绑定
nova remove-floating-ip vm_name xx.xx.xx.xx
放入ip池
nova floating-ip-delete xx.xx.xx.xx
默认mysql会开启外键关联,直接删除被关联的数据会产生如下错误
Cannot delete or update a parent row: a foreign key constraint fails
可通过关闭(SET FOREIGN_KEY_CHECKS=0;)来消除错误,删除完毕后在开启(SET FOREIGN_KEY_CHECKS=1;)。
use nova;
select id,display_name,uuid from instances;
set FOREIGN_KEY_CHECKS=0;
delete from instances where id=‘...‘;
set FOREIGN_KEY_CHECKS=1;
即不关闭外键关联,在删除实例记录之前,先删除所有有关的数据。
select id,display_name,uuid from instances;
delete from security_group_instance_association where instance_uuid=‘...‘;
delete from instance_info_caches where id=...;
delete from block_device_mapping where instance_uuid=‘...‘;
delete from where id=‘...‘;
本文出自 “破万卷书” 博客,请务必保留此出处http://powanjuanshu.blog.51cto.com/9779836/1627715
原文地址:http://powanjuanshu.blog.51cto.com/9779836/1627715