背景说明:
将一台kvm宿主机上的镜像,迁移到另外一台宿主机,启动时报错:
[root@YinHe-KVM-01 vms]# virsh start mycentos
error: Failed to start domain mycentos
error: the CPU is incompatible with host CPU: Host CPU does not provide required features: fma, x2apic, movbe, aes, fsgsbase, bmi1, avx2, smep, bmi2, erms, invpcid
说明:
这是因为两台宿主机的CPU类型不一致导致的,解决方法也很简单,将xml文件中的CPU类型改为与当前宿主机一致即可。
解决方法:
1. 查看当前宿主机的CPU类型
[root@YinHe-KVM-02 home]# virsh capabilities
<capabilities>
<host>
<uuid>4c4c4544-0000-0010-8000-80c04f000000</uuid>
<cpu>
<arch>x86_64</arch>
<model>Nehalem-IBRS</model> # 当前宿主机CPU类型
<vendor>Intel</vendor>
<microcode version='39'/>
<counter name='tsc' frequency='3092837000' scaling='no'/>
<topology sockets='1' cores='4' threads='1'/>
2. 修改xml文件的CPU类型(可以自己创建一个新的虚拟机,看配置文件取替换最为保险)
<cpu mode='custom' match='exact' check='partial'>
<model fallback='allow'>Nehalem-IBRS</model> # 修改CPU类型
3. 重新注册并启动虚拟机
[root@YinHe-KVM-01 vms]# virsh undefine mycentos
Domain mycentos has been undefined
[root@YinHe-KVM-01 vms]# virsh define mycentos.xml
Domain mycentos defined from mycentos.xml
[root@YinHe-KVM-01 vms]# virsh start mycentos
Domain mycentos started