这篇文章将为大家详细讲解有关openstack如何删除一个实例,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
从dashboard页面上terminate instance
1.删除配置文件
/etc/libvirt/qemu/instance-0000000*.xml
2.删除响应的文件目录
/var/lib/nova/instances/instance-0000000*
3.
修改数据库
1)instance表中修改deleted_at,deleted,vm_state,terminated_at字段。没有修改手工操作中power_state,root_device_name,task_state 三个字段。
手工操作如下:
update instances set
deleted_at = updated_at,
deleted = 1,
power_state = 0,
vm_state = "deleted",
terminated_at = updated_at,
root_device_name = NULL,
task_state = NULL
where id = 9;
2)virtual_interfaces 表中响应的instanceid的记录删除。手工操作如下:
delete from virtual_interfaces where instance_id=9;
3) instance_info_caches 表中修改deleted_at 和deleted字段。 手工操作如下
update instance_info_caches set
deleted_at = updated_at,
deleted = 1
where instaceid = 9;
4)fixed_ips 表中修改instance_id,allocated,virtual_interface_id ,leased字段。手工操作如下
update fixed_ips set
instance_id = NULL,
allocated = 0,
leased= 0,
virtual_interface_id = NULL
where instanceid = 9;
注意:
创建一个instance时fixed_ip表的变化
fixed_ips 表中修改instance_id,allocated,virtual_interface_id 字段。instance_id
allocated=1
leased=1
virtual_interface_id=select id from virtual_interfaces where instance_id=9
手工操作如下
update fixed_ips set
instance_id = instanceid,
allocated = 1,
leased = 1,
virtual_interface_id = select id from virtual_interfaces where instance_id=9
where id = 9;
5)security_group_instance_association表中deleted_at deleted两个字段
注意:
创建一个instance时security_group_instance_association表的变化
insert into `nova`.`security_group_instance_association`
(`created_at`,
`deleted`,
`id`,
`security_group_id`,
`instance_id`)
values ('created_at',
'0',
'id',
'1',
'9');`
关于“openstack如何删除一个实例”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。