[libvirt] [PATCH 05/21] qemu_hotplug: eliminate multiple identical qemuDomainDetachHost*Device() functions

Laine Stump laine at laine.org
Fri Mar 22 13:10:12 UTC 2019


On 3/22/19 4:27 AM, Peter Krempa wrote:
> On Thu, Mar 21, 2019 at 18:28:45 -0400, Laine Stump wrote:
>> There are separate Detach functions for PCI, USB, SCSI, Vhost, and
>> Mediated hostdevs, but the functions are all 100% the same code,
>> except that the PCI function checks for the guest side of the device
>> being a PCI Multifunction device, while the other 4 check that the
>> device's alias != NULL.
>>
>> The check for multifunction PCI devices should be done for *all*
>> devices that are connected to the PCI bus in the guest, not just PCI
>> hostdevs, and qemuIsMultiFunctionDevice() conveniently returns false
>> if the queried device doesn't connect with PCI, so it is safe to make
>> this check for all hostdev devices. (It also needs to be done for many
>> other device types, but that will be addressed in a future patch).
>>
>> Likewise, since all hostdevs are detached by calling
>> qemuDomainDeleteDevice(), which requires the device's alias, checking
>> for a valid alias is a reasonable thing for PCI hostdevs too (NB:
>> you'd think that we could rely on every device having a valid alias,
>> but unfortunately when you run virsh qemu-attach on a qemu process
> We also need to do something about qemu-attach ...


In the just-now-invented-by-me "Urban Programmers Dictionary", "We also 
need" is defined as "I volunteer". :-)





More information about the libvir-list mailing list