关于虚拟化:KVM和libvirt:虚拟主机中的CPU类型错误

KVM and libvirt: wrong CPU type in virtual host

我们在6核(12 HT核)计算机上使用KVM和libvirt进行虚拟化。

问题:虚拟主机中的CPU类型错误。

使用的KVM,libvirt,内核版本:

1
2
3
4
libvirt version: 0.9.8
QEMU emulator version 1.0 (qemu-kvm-1.0), Copyright (c) 2003-2008 Fabrice Bellard
Ubuntu 12.04.1 LTS
kernel: 3.2.0-32-generic x86_64

/usr/share/libvirt/cpu_map.xml不支持比Westmare更多的最新cpu类型。

我是否完全需要对CPU进行这种虚拟化?由于某些原因,我们需要在虚拟主机中获得最大的cpu性能。我的虚拟机中可以使用服务器的i7-3930K [email protected]的某些内核。

也许我们也做过muczh虚拟化...?

我的虚拟主机的xml如下:在哪里可以设置cpu -host标志?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<domain type='kvm'>
  <name>myVirtualServer</name>
  <uuid>2344481d-f455-455e-9558</uuid>
  <description>Test-Server</description>
  <memory>4194304</memory>
  <currentMemory>4194304</currentMemory>
  <vcpu>2</vcpu>
  <cpu match='exact'>
    <model>Westmere</model>
    <vendor>Intel</vendor>
  </cpu>
  <os>
    <type arch='x86_64' machine='pc-1.0'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
   
   
    <pae/>
  </features>

$ lscpu的具有HT的6(12)个内核的物理服务器

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                12
On-line CPU(s) list:   0-11
Thread(s) per core:    2
Core(s) per socket:    6
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 45
Stepping:              7
CPU MHz:               1200.000
BogoMIPS:              6400.05
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              12288K
NUMA node0 CPU(s):     0-11

$ lscpu虚拟服务器(错误的CPU类型,错误的L2-Cache,错误的MHz)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                2
On-line CPU(s) list:   0,1
Thread(s) per core:    1
Core(s) per socket:    1
Socket(s):             2
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 15
Stepping:              11
CPU MHz:               3200.012
BogoMIPS:              6400.02
Virtualisation:        VT-x
Hypervisor vendor:     KVM
Virtualisation type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              4096K
NUMA node0 CPU(s):     0,1


客户端xml中的

1
2
3
4
<cpu mode='custom' match='exact'>
    <model fallback='allow'>core2duo</model>
    <feature policy='require' name='vmx'/>
</cpu>

为例。 virsh编辑,然后重新启动guest虚拟机。

编辑。忽略这个。我刚刚重新阅读了您的问题,而您已经在这样做了。