PCI passthrough of host network interface into a guest VM

Hi All,

I am trying to directly attach a host NIC to a guest VM.

I did enable IOMMU at the host, and adjusted the filters at /var/lib/one/remotes/etc/im/kvm-probes.d/pci.conf so as to be able to view the detected PCI devices at the host PCI tab.

When I try to attach a NIC using a PCI NIC device I get the error ATTACHNIC: Missing VN_MAD, BRIDGE, TARGET or MAC in VM NIC at the VM logs. This seems that I need to provide more information when defining the network but I am not sure what I am missing, since I just need to passthrough the device to the VM without defining any VLAN IDs or bridges. How can one attach such a physical device through the Sunstone UI? Is this only possible through raw xml injection into the VM template?

I am attempting this from the Sunstone UI at 6.8.0 OpenNebula version with a single KVM host.

Thanks,
Alex

Versions of the related components and OS (frontend, hypervisors, VMs):
Host OS: 22.04.4 LTS (where Opennebula runs also)
Opennebula: 6.8.0
VM: Windows 11 64 bit

Steps to reproduce:
Enable PCI detection at the host and try to attach one NIC directly to the guest VM as using a passthrough NIC device.

Current results:
The NIC is not attached at the VM giving the error ATTACHNIC: Missing VN_MAD, BRIDGE, TARGET or MAC in VM NIC
Expected results:

Seems that one needs only to manually select the passthrough device using the short name of the specific interface, in case of multi-port NICs, and do this only while the VM is shutdown. I encountered a different bug though which seems to have been fixed at 6.8.2. VM deployment fails with an error "XML error: Invalid PCI address 0000:01:01.0. slot must be <= 0" if MACHINE=q35 · Issue #6492 · OpenNebula/one · GitHub

Hi Alex,

Thanks for updating :slight_smile: So did you solve the issue? As for the other part, yes PCI attach is not supported while running so this needs to be at instantiation or in poweroff state (we have added recently this option for GPU’s as well).

Cheers

Thanks Ruben for asking. I did not solve the issue at the moment. I will need to wait when 6.8.2 or upper (which include the bug fix) is available for the CE edition as currently I am evaluating CE edition.