On 5/19/21 1:38 PM, Simon Fairweather wrote:
Thanks, I will raise an issue and look to see if I can raise a
patch.
Regards
Simon
On Wed, May 19, 2021 at 11:38 AM Michal Prívozník <mprivozn(a)redhat.com>
wrote:
> On 5/17/21 8:36 PM, Simon Fairweather wrote:
>> I am looking to be able to check if a specific PCI device is allocated
> to a
>> guest.
>>
>> An error is produced if a domain is started and the device is in use
> within
>> another domain via this function.
>>
>> I cannot see a publicly available function to use to get this
> information,
>> is there one available or is there another way to check the state of the
>> PCI device.
>>
>
> Yeah, there's no public API. So far we recommended mgmt apps to track
> the usage themselves, however I don't see why we shouldn't have a new
> API, say:
>
> int virNodeDeviceGetUsed(virNodeDevicePtr dev, char **drvname, char
> **domname);
Just a note - of course I forgot the mandatory flags argument, so this
can be:
int virNodeDeviceGetUsed(virNodeDevicePtr dev, char **drvname, char
**domname, unsigned int flags);
Even though we don't have any flags to pass yet the argument needs to be
there as it ensures future extension.
In general this is a good start:
https://libvirt.org/api_extension.html
Michal