mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-09 09:14:57 +00:00
This patch makes sure that each network device ("interface") of type='hostdev' appears on both the hostdevs list and the nets list of the virDomainDef, and it modifies the qemu driver startup code so that these devices will be presented to qemu on the commandline as hostdevs rather than as network devices. It does not add support for hotplug of these type of devices, or code to honor the <mac address> or <virtualport> given in the config (both of those will be done in separate patches). Once each device is placed on both lists, much of what this patch does is modify places in the code that traverse all the device lists so that these hybrid devices are only acted on once - either along with the other hostdevs, or along with the other network interfaces. (In many cases, only one of the lists is traversed / a specific operation is performed on only one type of device. In those instances, the code can remain unchanged.) There is one special case - when building the commandline, interfaces are allowed to proceed all the way through networkAllocateActualDevice() before deciding to skip the rest of netdev-specific processing - this is so that (once we have support for networks with pools of hostdev devices) we can get the actual device allocated, then rely on the loop processing all hostdevs to generate the correct commandline. (NB: <interface type='hostdev'> is only supported for PCI network devices that are SR-IOV Virtual Functions (VF). Standard PCI[e] and USB devices, and even the Physical Functions (PF) of SR-IOV devices can only be assigned to a guest using the more basic <hostdev> device entry. This limitation is mostly due to the fact that non-SR-IOV ethernet devices tend to lose mac address configuration whenever the card is reset, which happens when a card is assigned to a guest; SR-IOV VFs fortunately don't suffer the same problem.)
7 lines
358 B
Plaintext
7 lines
358 B
Plaintext
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S \
|
|
-M pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -monitor \
|
|
unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
|
|
-hda /dev/HostVG/QEMUGuest1 -usb \
|
|
-device pci-assign,host=03:07.1,id=hostdev0,bus=pci.0,addr=0x3 \
|
|
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
|