技术杂谈 · 2023年3月18日 0

【openstack】服务器故障,虚拟机迁移处理

1、查找虚拟机所在节点

ansible compute -m shell -a "virsh list --all |grep instance-000003c4"

如上图,确认该虚拟机实例在该台服务器上。

2、修改虚拟机状态

nova reset-state --active 1bae0e52-fc16-4d21-88db-b667ee3a1c46

3、数据库查询虚拟机信息

mysql
show databases;
select * from nova.instances where uuid='1bae0e52-fc16-4d21-88db-b667ee3a1c46';

4、修改nova.instances表里host、node字段内容

update nova.instances set host='region1-node-172-18-0-105',node='region1-node-172-18-0-105' where uuid='1bae0e52-fc16-4d21-88db-b667ee3a1c46';

5、查询端口ID

neutron port-list |grep 172.18.12.67(内网IP)

6、数据库查询port信息

select * from neutron.ml2_port_bindings where  port_id='9e16c26a-118b-4c1b-90bc-3cbefc419b99';

7、修改neutron.ml2_port_bindings表里host字段

update neutron.ml2_port_bindings set host='region1-node-172-18-0-105' where port_id='9e16c26a-118b-4c1b-90bc-3cbefc419b99';

8、验证

nova show 1bae0e52-fc16-4d21-88db-b667ee3a1c46