nodedev: fix hang when destroying an mdev in use
nodedev: fix hang when destroying an mdev in use

Calling `mdevctl stop` for a mediated device that is in use by an active
domain will block until that vm exits (or the vm closes the device).
Since the nodedev driver cannot query the hypervisor driver to see
whether any active domains are using the device, we resort to a
workaround that relies on the fact that a vfio group can only be opened
by one user at a time. If we get an EBUSY error when attempting to open
the group file, we assume the device is in use and refuse to try to
destroy that device.

Signed-off-by: Jonathon Jongsma <c7254805a17bd5c41e24c3a278fcbf3afcdfb0fa@redhat.com>
Reviewed-by: Erik Skultety <2c14d38fa47c8799f1b9c16280abe27f8edfec6e@redhat.com>

jfehlig/libvirt,crobinso/libvirt,zippy2/libvirt,zippy2/libvirt,libvirt/libvirt,zippy2/libvirt,olafhering/libvirt,crobinso/libvirt,crobinso/libvirt,nertpinx/libvirt,libvirt/libvirt,olafhering/libvirt,zippy2/libvirt,libvirt/libvirt,nertpinx/libvirt,olafhering/libvirt,nertpinx/libvirt,nertpinx/libvirt,libvirt/libvirt,crobinso/libvirt,nertpinx/libvirt,jfehlig/libvirt,jfehlig/libvirt,jfehlig/libvirt,olafhering/libvirt