错误:无法从错误附加设备:内部错误:没有更多可用的PCI插槽
假设
- 访客VM已安装。
- 访客VM正在运行:
virsh start< vm_domain_name>
。 - 使用
virsh列表进行验证-All
- 目标PCI设备已用
virsh nodedev-detach< pci_< domain> _ _ _ bus> >
。可以通过验证virsh nodedev-list
的输出来查看PCI目标列表。可以看到标签格式(< pci_ _>)可能与此处的示例有所不同。
问题描述
error: Failed to attach device from add_pci_vf.xml
error: internal error: No more available PCI slots
尝试将多个PCI设备添加到访客虚拟机中时出现此错误。
如果只需要添加一个PCI设备,那么以下命令就足以启用其PCI通行证:
virsh attach decter-device ubuntu-guest add_pci_vf.xml-live
option live
live
live
在命令末尾允许PCI通行直接立即生效。访问访客并运行lspci -nn
断言该设备现在可以由来宾看到。
解决方案
如果一个人希望添加其他设备,则必须替换- live
by - config
。更改不会立即生效。按照下面的食谱添加多个PCI设备,并避免上述错误。
virsh attach-device <vm_domain_name> <pci_device_0.xml> --config
virsh attach-device <vm_domain_name> <pci_device_1.xml> --config
virsh attach-device <vm_domain_name> <pci_device_2.xml> --config
virsh destroy <vm_domain_name>
virsh start <vm_domain_name>
PCI_DEVICE的语法_?。
<hostdev mode='subsystem' type='pci' managed='yes'>
<driver name='vfio' />
<source>
<address domain='0x0000' bus='0x6b' slot='0x00' function='0x01' />
</source>
</hostdev>
注意:根据我的经验,属性管理='是'是必不可少的。
Assumptions
- Guest VM has been installed.
- Guest VM is running:
virsh start <vm_domain_name>
. - Verify it with
virsh list --all
- Target PCI devices have been detached from the host with
virsh nodedev-detach <pci_<domain>_<bus>_<slot>_<function>>
. One can see a list of PCI targets by verifying the output ofvirsh nodedev-list
. One can see that the tag format (<pci__>) may differ from the example here.
Problem Description
error: Failed to attach device from add_pci_vf.xml
error: internal error: No more available PCI slots
This error appears when trying to add multiple PCI devices to a guest virtual machine.
If one just needs to add a single PCI device, then the following command suffice to enable its PCI passthrough:
virsh attach-device ubuntu-guest add_pci_vf.xml --live
The option --live
at the end of the command allows the PCI passthrough to be effective immediately. Access the guest and run lspci -nn
to assert that the device can now be seen by the guest.
Solution
If one wish to add additional devices, one must replace --live
by --config
. The changes will not be effective immediately. Follow the recipe below to add multiple PCI devices and avoid the aforementioned error.
virsh attach-device <vm_domain_name> <pci_device_0.xml> --config
virsh attach-device <vm_domain_name> <pci_device_1.xml> --config
virsh attach-device <vm_domain_name> <pci_device_2.xml> --config
virsh destroy <vm_domain_name>
virsh start <vm_domain_name>
The syntax of pci_device_?.xml files should look like the following (may vary depending on the target co-processor):
<hostdev mode='subsystem' type='pci' managed='yes'>
<driver name='vfio' />
<source>
<address domain='0x0000' bus='0x6b' slot='0x00' function='0x01' />
</source>
</hostdev>
Note: The attribute managed='yes' is essential as per my experience.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
原始帖子中描述的解决方案对我有用。由于我很难在网上找到它,因此我将其发布在此处,为其他面临类似问题的其他人发布。
摘要
一一添加设备(VFS)。
然后,
pci_device的语法_?。XML文件类似于:
The solution described in the original post worked for me. Since I had trouble finding it online, I am posting it here for others facing similar issues.
Summary
Add the devices (VFs) one by one.
Then,
The syntax of pci_device_?.xml files is similar to: