Hi,
I have a PoC that enables partial coldplug assignment of
multifunction
PCI devices with managed mode. At this moment, Libvirt can't
handle
this scenario - the code will detach only the hostdevs from the
XML,
when in fact the whole IOMMU needs to be detached. This can be
verified by the fact that Libvirt handles the unmanaged scenario
well, as long as the user detaches the whole IOMMU beforehand.
I have played with 2 approaches. The one I am planning to
contribute
back is a change inside virHostdevGetPCIHostDeviceList(), that
adds the extra PCI devices for detach/re-attach in case a PCI
Multifunction device in managed mode is presented in the XML.
Now, there's a catch. Inside both virHostdevPreparePCIDevices()
and virHostdevReAttachPCIDevices() there are code to
save/restore
the network configuration for SR-IOV devices. These
functions iterates
in the hostdevs list, instead of the pcidevs list I'm changing.
The final
result, given that the current conditions used for SR-IOV matches
the
conditions for multifunction PCI devices as well, is that not all
virtual
functions will get their network configuration saved/restored.
For example, a guest that uses 3 of 4 functions of a PCI
MultiFunction
card, let's say functions 0,1 and 3. The code will handle the
detach
of all the IOMMU, including the function 2 that isn't declared in
the
XML. However, since function 2 isn't a hostdev, its network config
will not be restored after the VM shutdown.
Now comes the question: how much effort should be spent into
making
the network config of all the functions be restored? Is this a
blocker
for the whole code to be accepted or, given it is proper
documented
somewhere, it can be done later on?
Thanks,
DHB