libvirt qemu-system-arm,错误:XML错误:没有可用的PCI总线
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了libvirt qemu-system-arm,错误:XML错误:没有可用的PCI总线相关的知识,希望对你有一定的参考价值。
我正在尝试使用libvirt运行使用buildroot创建的linux映像。
如果我直接使用qemu-system-arm,一切都按预期工作:
/usr/bin/qemu-system-arm
-M versatilepb
-kernel output/images/zImage
-dtb output/images/versatile-pb.dtb
-drive index=0,file=output/images/rootfs.ext2,if=scsi,format=raw
-append "root=/dev/sda console=ttyAMA0,115200"
-net nic,model=rtl8139
-net user
-nographic
但是,当我尝试从qemu cmdline创建xml时,它会失败:
$ virsh domxml-from-native qemu-argv qemu.args
error: XML error: No PCI buses available
我还试图手工创建一个基本的XML:
<?xml version='1.0'?>
<domain type='qemu'>
<name>Linux ARM</name>
<uuid>ce1326f0-a9a0-11e3-a5e2-0800200c9a66</uuid>
<memory>131072</memory>
<currentMemory>131072</currentMemory>
<vcpu>1</vcpu>
<os>
<type machine='versatilepb'>hvm</type>
<kernel>zImage</kernel>
<cmdline>root=/dev/sda console=ttyAMA0,115200</cmdline>
<dtb>versatile-pb.dtb</dtb>
</os>
<devices>
<disk type='file' device='disk'>
<source file='rootfs.ext2'/>
<target dev="sda" bus="scsi"/>
</disk>
<interface type='network'>
<source network='default'/>
</interface>
</devices>
</domain>
失败并出现同样的错误:
$ virsh create guest-test.xml
error: Failed to create domain from guest-test.xml
error: XML error: No PCI buses available
我已经尝试使用全新的和最新的libvirt-3.0.0,但没有任何成功
我的cmdline / xml需要更改什么?
virsh domxml-from-native issue
domxml-from-native
命令不起作用的原因是因为libvirt中进行解析的底层代码需要qemu-system-
的后缀为canonical architecture name,而arm
则不是。在你的情况下,你似乎希望arm
映射到armv7l
这是一个建筑名称。你可以通过创建一个软链接qemu-system-armv7l
来指出你的系统的qemu-system-arm
,然后使用你的qemu.args
中的软链接的位置
代码参考
- https://github.com/libvirt/libvirt/blob/v4.0.0/src/qemu/qemu_parse_command.c#L1906
- https://github.com/libvirt/libvirt/blob/v4.0.0/src/util/virarch.c#L135
xml issues
由于多个不相关的原因,您的xml会给出相同的错误。在type
下的os
元素中,您需要指定arch="armv7l"
(或其他一些规范的臂拱名称)。另请注意,kernel
和dtb
引用必须是绝对路径或以.
为前缀。最后,您需要的某些设备需要PCI总线,并且无法使用您要使用的机器。考虑以下替代方案。
<domain type='qemu'>
<name>Linux ARM</name>
<uuid>ce1326f0-a9a0-11e3-a5e2-0800200c9a66</uuid>
<memory>131072</memory>
<currentMemory>131072</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="armv7l" machine='versatilepb'>hvm</type>
<kernel>/path/to/zImage</kernel>
<cmdline>root=/dev/sda console=ttyAMA0,115200</cmdline>
<dtb>/path/to/versatile-pb.dtb</dtb>
</os>
<devices>
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"></driver>
<source file="/path/to/root.qcow2"></source>
<target dev="sda" bus="sd"></target>
</disk>
<serial type="tcp">
<source mode="bind" host="localhost" service="4000"></source>
<protocol type="telnet"></protocol>
</serial>
</devices>
</domain>
以上是关于libvirt qemu-system-arm,错误:XML错误:没有可用的PCI总线的主要内容,如果未能解决你的问题,请参考以下文章
qemu 生成 qemu-arm 和 qemu-system-arm
ubuntu下使用qemu-system-arm模拟arm环境
QEMU KVM Libvirt手册(10):Managing Virtual Machines with libvirt