使用 libvirt 管理的 kvm 64 主机上的 win7 64 客户机的最佳设置

使用 libvirt 管理的 kvm 64 主机上的 win7 64 客户机的最佳设置

我正在使用 libvirt 来控制运行 Debian Squeeze amd64 的较新的 (core i3) 主机上的 kvm。主机和 Linux 客户机工作正常,感觉速度很快且响应迅速。只需使用适用于 Windows7 的 virt-manager 标准配置文件安装 Win7 就需要很长时间。我主要将此归咎于磁盘 io,但 Windows 通常似乎不如 Linux 客户机响应迅速。

您对 kvm 上 Win7 客户机的性能最佳设置有什么提示吗?

(抱歉,有这么多垃圾信息,但我认为它们可以作为参考。)

主机配置:

kvm: Version: 1:0.12.5+dfsg-5+squeeze8
libvirt-bin: Version: 0.8.3-5+squeeze2

virsh dumpxml:

<domain type='kvm' id='27'>
  <name>win7-template</name>
  <uuid>a4eb05fa-0d4e-5ced-2ff1-e15507795d1b</uuid>
  <memory>2097152</memory>
  <currentMemory>2097152</currentMemory>
  <vcpu>2</vcpu>
  <os>
    <type arch='x86_64' machine='pc-0.12'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='localtime'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/win7-template.img'/>
      <target dev='hda' bus='ide'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/isos/de_windows_7_professional_with_sp1_x64_dvd.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <alias name='ide0-1-0'/>
      <address type='drive' controller='0' bus='1' unit='0'/>
    </disk>
    <controller type='ide' index='0'>
      <alias name='ide0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:af:89:f2'/>
      <source network='default'/>
      <target dev='vnet2'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/5'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/5'>
      <source path='/dev/pts/5'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='tablet' bus='usb'>
      <alias name='input0'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5902' autoport='yes'/>
    <video>
      <model type='vga' vram='9216' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </memballoon>
  </devices>
</domain>

cat /proc/cpuinfo (片段)

processor   : 3
vendor_id   : GenuineIntel
cpu family  : 6
model       : 37
model name  : Intel(R) Core(TM) i3 CPU         540  @ 3.07GHz
stepping    : 2
cpu MHz     : 3058.386
cache size  : 4096 KB
physical id : 0
siblings    : 4
core id     : 2
cpu cores   : 2
apicid      : 5
initial apicid  : 5
fpu     : yes
fpu_exception   : yes
cpuid level : 11
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm arat tpr_shadow vnmi flexpriority ept vpid
bogomips    : 6117.86
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual

答案1

  1. 使用 virtio 作为磁盘和网络。
  2. 对于保存图像和 iso 的挂载点,使用 noatime 和 nodiratime 选项
  3. 使用主机上的截止期限调度程序
  4. 使用 spice/qxl 来获得正确的视频性能

答案2

我刚刚安装了 Windows 7,然后在安装后更改了磁盘以使用 virtio。

为了加载驱动程序,我添加了一个临时的 virtio 设备 (1G),然后重新启动了客户机。然后,通过设备管理器加载了 virtio 的 Windows 驱动程序。

然后,关闭客户机,将主磁盘从 IDE 更改为 virtio。由于 Windows 7 已经从我的临时设备加载了 virtio 驱动程序,因此它可以很好地应对 IDE 磁盘更改为 virtio。

相关内容