如何使用virsh edit或virt-manager将Qemu KVM机器架构从440fx更改为q35

仍然试图让GPU直通工作,并决定改变机器types从旧的440FX到Q35即PC-Q35,但如果我做了virshconfiguration编辑它拒绝保存说“PCI桥不支持”…由当前qemu二进制。 我需要在虚拟机xml文件中修复/更改什么?

经过一些研究似乎Q35只允许PCIexpress PCIe,而不是PCI,但我不知道如何改变我的XML文件,以便VIRSH停止抱怨,并接受从440FX到Q35的变化。

这是在Debian Jessie上:uname -a Linux vmserver 3.16.0-customvmkernel#1 SMP Sun Sep 28 00:34:42 PDT 2014 x86_64 GNU / Linux

kvm –version QEMU模拟器版本2.1.0(Debian 2.1 + dfsg-4)

这是我目前使用440fx的虚拟机文件,我想要更改为q35:

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'> <name>Win7enterprise32bit</name> <uuid>77599af9-35a3-45e1-9fce-74304f7d7a9c</uuid> <memory unit='KiB'>1048576</memory> <currentMemory unit='KiB'>1048576</currentMemory> <vcpu placement='static'>1</vcpu> <os> <type arch='i686' machine='pc-i440fx-2.1'>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='vmdk'/> <source file='/mount/ssd/VirtWin7-clone.vmdk'/> <target dev='vdb' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> </disk> <controller type='usb' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> <controller type='ide' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> <controller type='pci' index='0' model='pci-root'/> <interface type='bridge'> <mac address='52:54:00:9e:f5:11'/> <source bridge='br0'/> <model type='rtl8139'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> <serial type='pty'> <target port='0'/> </serial> <console type='pty'> <target type='serial' port='0'/> </console> <input type='tablet' bus='usb'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'/> <sound model='ac97'> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </sound> <video> <model type='cirrus' vram='9216' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </memballoon> </devices> <qemu:commandline> <qemu:arg value='-nodefaults'/> <qemu:arg value='-vga'/> <qemu:arg value='none'/> <qemu:arg value='-device'/> <qemu:arg value='ioh3420,bus=pci.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1'/> <qemu:arg value='-device'/> <qemu:arg value='vfio-pci,host=04:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on,rombar=0'/> <qemu:arg value='-device'/> <qemu:arg value='vfio-pci,host=04:00.1,bus=root.1,addr=00.1'/> <qemu:arg value='-bios'/> <qemu:arg value='/usr/share/seabios/bios.bin'/> <qemu:arg value='-cpu'/> <qemu:arg value='host,kvm=off'/> </qemu:commandline> </domain> 

最新的virt-manager (1.1.0)支持在虚拟机创build上设置体系结构。 你以后不能改变它。

随着virsh edit ,我猜测了一下,但我会尝试删除PCI控制器和所有总线相关的参数(如<address />

<type arch='i686' machine='pc-i440fx-2.1'>hvm</type>

<type arch='i686' machine='pc-q35'>hvm</type>

通常我会提供这个评论,因为它更多的猜测,但它太长了。 如果它不起作用,我会删除它。

顺便说一句。 最后那些<qemu:arg />也可能造成麻烦。 如果遇到问题,请尝试删除这些问题。

有一个补丁可用于解决底层问题(即QEMU不允许绑定到Q35上Windows客户机所需的PCIe根总线):

http://lists.nongnu.org/archive/html/qemu-devel/2015-10/msg05385.html

试试而不是上面的pc-i440fx-2.1

请参阅https://gist.github.com/lyarbean/7036986上的示&#x4F8B;

我会用-M q35或-M手动运行qemu。 检查你已经安装的版本真的支持它

心连心

我今天就这么做了 – 就像“Fox”所描述的一样,除了改变pci控制器的入口而不是删除它 – 把“pci-root”改成“pcie-root”

然后它会抱怨与巴士有关的任何参数 – 我认为你可以离开物品,但删除规范。 我也不得不删除USB相关的条目(piix3集成控制器需要一个PCI总线,或者这个效果)。

不知道你是否还在努力做到这一点 – 但我想我会把它放在那里寻找这个的其他人。