为了保证虚拟机在不同宿主机之间迁移的时候的兼容性,Libvirt对CPU提炼出标准的几种类型,在/usr/share/libvirt/cpu_map.xml中可以查到。cpu_map.xml不仅是CPU型号,还有生产商信息、每种型号的CPU特性定义等信息,如下所示:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
<cpus>
<arch name= 'x86' >
<!-- vendor definitions -->
<vendor name= 'Intel' string= 'GenuineIntel' />
<vendor name= 'AMD' string= 'AuthenticAMD' />
<!-- standard features, EDX -->
<feature name= 'fpu' > <!-- CPUID_FP87 -->
<cpuid function = '0x00000001' edx= '0x00000001' />
< /feature >
<feature name= 'vme' > <!-- CPUID_VME -->
<cpuid function = '0x00000001' edx= '0x00000002' />
< /feature >
<feature name= 'de' > <!-- CPUID_DE -->
<cpuid function = '0x00000001' edx= '0x00000004' />
< /feature >
<feature name= 'pse' > <!-- CPUID_PSE -->
<cpuid function = '0x00000001' edx= '0x00000008' />
< /feature >
<feature name= 'tsc' > <!-- CPUID_TSC -->
<cpuid function = '0x00000001' edx= '0x00000010' />
< /feature >
<feature name= 'msr' > <!-- CPUID_MSR -->
<cpuid function = '0x00000001' edx= '0x00000020' />
< /feature >
...
<!-- models -->
<model name= '486' >
<feature name= 'fpu' />
<feature name= 'vme' />
<feature name= 'pse' />
< /model >
...
<!-- Intel CPU models -->
<model name= 'Conroe' >
<model name= 'pentiumpro' />
<vendor name= 'Intel' />
<feature name= 'mtrr' />
<feature name= 'mca' />
<feature name= 'pse36' />
<feature name= 'clflush' />
<feature name= 'pni' />
<feature name= 'ssse3' />
<feature name= 'syscall' />
<feature name= 'nx' />
<feature name= 'lm' />
<feature name= 'lahf_lm' />
< /model >
|
Centos6.6所带的Libvirt主要规定了以下几种CPU型号:'486','pentium','pentium2','pentium3','pentiumpro','coreduo'
CPU模式配置
1)custom模式
xml配置文件如下:
1 2 3 |
<cpu mode= 'custom' match= 'exact' >
<model fallback= 'allow' >kvm64< /model >
< /cpu >
|
2)host-model模式
根据物理CPU的特性,选择一个最靠近的标准CPU型号。如果没有指定CPU模式,默认也是使用这种模式,xml配置文件如下:
1 |
<cpu mode= 'host-model' />
|
3)host-passthrough模式
直接将物理CPU暴露给虚拟机使用,在虚拟机上完全可以看到的就是物理CPU的型号,xml配置文件如下:
1 |
<cpu mode= 'host-passthrough' />
|
注意:使用host-model模式,Libvirt会根据物理CPU的型号,从规定的CPU中选择一种最接近的CPU型号,而使用host-passthrough模式直接看到的就是物理CPU的型号
CPU host-passthrough技术的应用场景
HOST技术使用于以下场景
1)需要将物理CPU的一些特性传给虚拟机使用,比如使用虚拟机嵌套的nested技术的时候
2)需要在虚拟机里面看到和物理CPU一模一样的CPU品牌型号,这个在公有云很有意义,用户体验比较好
注意:使用CPU host-passthrough技术需要注意,不同型号的CPU宿主机之间虚拟机不能迁移
标签:0x00000001,passthrough,虚拟机,host,型号,CPU From: https://www.cnblogs.com/SunShine110/p/16805448.html