On 04/23/2013 08:52 AM, Laine Stump wrote:
Yesterday for the first time I consciously noticed the
virNodeDeviceDettach and virNodeDeviceReAttach APIs, and found that they
are hardcoded to bind to/unbind from the pci-stub driver for qemu, and
the "pciback" driver for Xen. If we want these APIs to be useful for
VFIO, they will need to bind to the vfio driver instead, but there is
currently no method in those APIs to specify which driver to bind to.
I guess we could do this with new virNodeDeviceDetachFlags() and
virNodeDeviceReAttachFlags() APIs which have a flag to indicate vfio,
but before going to that trouble I'd like to know if these APIs are
actually used or if they are deprecated (they don't seem to be of any
use if the hostdev devices you're assigning have "managed='yes'" -
as
far as I can see, setting managed='yes' just makes the bind/unbind from
the stub driver an automatic part of assigning/un-assigning the device
to a guest).
We can't take away the existing functionality, but you may be right that
managed='yes' has made the need for these functions less common, at
which point we don't need to worry about VFIO handling.
But even if we don't expose a flag for VFIO, I can't help but wonder if
now would be a good time to round out a *Flags() API for ALL api that is
currently missing one, as it seems that every couple releases we run
into yet another command that would benefit from the conversion.
There's not much time before a 1.0.5 freeze if we want to make that
addition.
(Beyond that, this would be exposing a lower level of detail in the APIs
than the original functions, and I'm not sure if it's appropriate - the
choice of stub driver was previously hidden in each hypervisor driver).
I'm not sure on the best approach here, but having a *Flags() API, even
if we don't use any flags yet, can't hurt.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org