libvirt qemu-system-arm,错误:XML错误:没有可用的PCI总线 [英] libvirt qemu-system-arm, error: XML error: No PCI buses available
问题描述
我正在尝试使用libvirt运行用buildroot创建的linux映像.
I am trying to run a linux image i created with buildroot with libvirt.
如果我直接使用qemu-system-arm,一切都会按预期进行:
If i use qemu-system-arm directly, everything works as intended:
/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时,它会失败:
However, when i try to create the xml from my qemu cmdline, it fails:
$ virsh domxml-from-native qemu-argv qemu.args
error: XML error: No PCI buses available
我也尝试手工创建基本的XML:
I also tried to create a basic XML by hand:
<?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>
失败,并出现相同错误:
which fails with the same error:
$ 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,但没有成功
I already tried with the brand-new and latest libvirt-3.0.0, without any success
我需要在cmdline/xml中进行哪些更改?
What do i need to change in my cmdline/xml?
推荐答案
virsh domxml-from-native问题
domxml-from-native
命令不起作用的原因是因为进行解析的libvirt中的基础代码期望 qemu-system-
的后缀为是规范体系结构名称,而 arm
不是.在您的情况下,您似乎希望 arm
映射到 armv7l
,这是一个规范的体系结构名称.您可以通过创建一个指向您系统的 qemu-system-arm
的软链接 qemu-system-armv7l
,然后在您的系统中使用该软链接的位置来实现此目的. qemu.args
virsh domxml-from-native issue
The reason why the domxml-from-native
command does not work is because the underlying code in libvirt that does the parsing expects the suffix of qemu-system-
to be a canonical architecture name, and arm
is not. In your case it would seem you want arm
to map to armv7l
which is a cannonical architecture name. You can pull this of by creating a soft-link qemu-system-armv7l
that points you your system's qemu-system-arm
and then use the location of the softlink in your 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由于多种不相关的原因而给您同样的错误.在 os
下的 type
元素中,您需要指定 arch ="armv7l"
(或其他一些规范的手臂弓形名称).还要注意, kernel
和 dtb
引用必须是绝对路径或以.
为前缀.最后,您拥有的某些设备需要PCI总线,并且无法与您要使用的计算机一起使用.考虑以下替代方法.
Your xml is giving you the same error for multiple unrelated reasons. In the type
element under os
you need to specify arch="armv7l"
(or some other canonical arm arch name). Note also that the kernel
and dtb
references need to be absolute paths or prefixed with a .
. Finally some of the devices you have require a PCI bus and will not work with the machine you are going for. Consider the following alternative.
<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总线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!