mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemuIsMultiFunctionDevice: return early for non-PCI addresses
There is no point in iterating over all devices if none of them could possibly match.
This commit is contained in:
parent
67486bb295
commit
8a0d84e25b
@ -3751,6 +3751,9 @@ static int qemuComparePCIDevice(virDomainDefPtr def ATTRIBUTE_UNUSED,
|
|||||||
static bool qemuIsMultiFunctionDevice(virDomainDefPtr def,
|
static bool qemuIsMultiFunctionDevice(virDomainDefPtr def,
|
||||||
virDomainDeviceInfoPtr dev)
|
virDomainDeviceInfoPtr dev)
|
||||||
{
|
{
|
||||||
|
if (dev->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (virDomainDeviceInfoIterate(def, qemuComparePCIDevice, dev) < 0)
|
if (virDomainDeviceInfoIterate(def, qemuComparePCIDevice, dev) < 0)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
@ -4852,8 +4855,7 @@ int qemuDomainDetachControllerDevice(virQEMUDriverPtr driver,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (detach->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
|
if (qemuIsMultiFunctionDevice(vm->def, &detach->info)) {
|
||||||
qemuIsMultiFunctionDevice(vm->def, &detach->info)) {
|
|
||||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||||
_("cannot hot unplug multifunction PCI device: %s"),
|
_("cannot hot unplug multifunction PCI device: %s"),
|
||||||
dev->data.disk->dst);
|
dev->data.disk->dst);
|
||||||
|
Loading…
Reference in New Issue
Block a user