Libvirt的三种CPU配置模式
CPU配置模式可以有以下几种模式
1. custom模式
<cpu mode='custom' match='exact'>
<modelfallback='allow'>kvm64</model>
...
<featurepolicy='require' name='monitor'/>
</cpu>
2. host-model 模式
根据物理CPU的特性,选择一个最靠近的标准CPU型号,如果没有指定CPU模式,默认也是使用这种模式,xml配置文件为:
<cpu mode='host-model' />
3. host-passthrough 模式
直接将物理CPU 暴露给虚拟机使用,在虚拟机上完全可以看到的就是物理CPU的型号,xml配置文件为:
<cpu mode='host-passthrough'/>
使用host-model看到的VCPU:
processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 44
model name : WestmereE56xx/L56xx/X56xx (Nehalem-C)
...
使用host-passthrough看到的VCPU:
processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 44
model name : Intel(R)Xeon(R) CPU X5650 @ 2.67GHz
可以看到,使用host-model模式,Libvir会根据物理CPU的型号,从规定的CPU中选择一种最接近的CPU型号,而使用host-passthrough模式直接看到的就物理CPU的型号。