openstack-nova-主机无法删除问题

由于各种原因,主机状态为error,而且无法通过控制台或者命令行删除,这时候就只能从数据库删除了

首先登陆到该计算节点通过:virsh list|grep UUID 来查看该主机是否存在,存在则通过virsh destroy 销毁

然后在控制节点登陆数据库按顺序删除该主机有关信息:

1
2
3
4
5
6
7
8
9
10
delete from instance_info_caches where instance_uuid='8082e0be-8b49-4412-a280-875c69114ad7';
delete from block_device_mapping where instance_uuid='8082e0be-8b49-4412-a280-875c69114ad7';
select id,instance_uuid from instance_actions where instance_uuid='8082e0be-8b49-4412-a280-875c69114ad7';
delete from instance_actions_events where action_id=''; #上一命令查询出的id
delete from instance_actions where instance_uuid='8082e0be-8b49-4412-a280-875c69114ad7';
delete from instance_faults where instance_uuid='8082e0be-8b49-4412-a280-875c69114ad7';
delete from instance_extra where instance_uuid='8082e0be-8b49-4412-a280-875c69114ad7';
delete from instance_info_caches where instance_uuid='8082e0be-8b49-4412-a280-875c69114ad7';
delete from instance_system_metadata where instance_uuid='8082e0be-8b49-4412-a280-875c69114ad7';
delete from instances where uuid='8082e0be-8b49-4412-a280-875c69114ad7';