对要冷迁移的云主机进行关机:

查看调度到的计算节点:
当前实例被调度到了compute-1计算节点上。
查看原计算节点KVM实例:

拷贝云主机实例文件到可用计算计算节点:
[root@compute-1 ~]# scp -r /var/lib/nova/instances/d59bb100-aa10-41fb-9c6f-3c45408eb92a compute-2:/var/lib/nova/instances[root@compute-2 ~]# chown nova:nova /var/lib/nova/instances/d59bb100-aa10-41fb-9c6f-3c45408eb92a
控制节点修改数据库:
通过dashboard找到要冷迁移实例的UUID值,然后在数据库中匹配这个UUID。然后修改node与host字段为compute-2节点的主机名。[root@controller ~]# mysql -uroot -predhat
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 675
Server version: 10.1.20-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
MariaDB [(none)]> use nova
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [nova]> update instances set host='compute-2',node='compute-2' where uuid='d59bb100-aa10-41fb-9c6f-3c45408eb92a';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
重启nova-compute服务:
[root@compute-2 ~]# systemctl restart openstack-nova-compute启动冷迁移后的云主机:

查看compute-2节点KVM实例:

冷迁移后查看寄生主机节点:


原计算节点日志故障:
这是因为云主机迁移后在被删除了,但是原计算节点还有这台云主机的数据,然后执行KVM命令删除该实例就可以了。根本问题就是当前计算节点认为自己还拥有aa这台云主机,但是在实例目录数据文件却检测不到数据了。

解决:
[root@compute-1 ~]# virsh list --allId Name State
----------------------------------------------------
- instance-0000000e shut off
[root@compute-1 ~]# virsh undefine instance-0000000e
Domain instance-0000000e has been undefined

