Using virt-manager in RHEL/SLES...
Is there a way to find out if a VF (virtual function) is already attached/consumed by a VM without powering it on?
Does the driver and or kernel report this somewhere?
The only mechanism I found was to dump and parse the xml of each VM. I'm still in the process of writing this code. This is a pita and imho think there might be a better way...
Code:
virsh dumpxml rhel7.4
or for a quick view I can dump the xml and use xmllint to check:
Code:
virsh dumpxml rhel7.4 | xmllint --xpath '//hostdev' -
If you do a 'lspci -ks 0000:6d:01.1' for example the 'Kernel driver in use' is the driver that is installed on the host. The second you power on the VM this get switched to 'vfio-pci'. This tells me this VF is in use, but I dont think I should be forced to power on my VM until I'm ready.
Context: I created a bash script to add X number of VFs to a VM (vfs must already be spawned). The issue is that the same VF gets added to multiple VM's. I don't know there is an issue until I power on the VM.
Thanks!
*Not sure if this should be here or in the programming section, please forgive.