On 10/29/2013 06:01 PM, Laine Stump wrote:
On Thu, Oct 24, 2013 at 09:52:31AM +0300, Niilona wrote:
> There is a behavior effecting virtfn -entries in sysfs, when amount of
> them increases over 10.
> Run VM's through LIBVIRT -> QEMU/KVM, this causes :
> - MAC address setting by LIBVIRT disordered ie. setting targeted to wrong VF.
> - VLAN setting by LIBVIRT overall failed
To fix this we need to modify virPCIGetVirtualFunctions to gather all
virtfn%d entries in the PF's directory and sort them numerically (right
now we just grab them in whatever order readdir() provides and put them
in the list in that order). This will automatically fix
virPCIGetVirtualFunctionIndex() and coincidentally make the ordering in
nodedev-dumpxml "proper".
Of course even this will only work as long as lists of virtual functions
are guaranteed to never be "sparse" (e.g. there can't be a virtfn22
unless there is also a virtfn21). My guess is that this is always true,
but we should check for that in the new function and log an appropriate
error in the case that we encounter a sparse list.
I've implemented such a patch, and have posted it to libvir-list:
https://www.redhat.com/archives/libvir-list/2013-November/msg00125.html
Please try it out and post feedback to that thread.
Thanks for persevering enough to make me see the problem! :-)