mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
virHostdevPreparePCIDevices: Construct pcidevs list earlier
There's no need to translate virDomainHostdevDef-s into virPCIDevice-s with locked list of PCI devices. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
11fa712c26
commit
bf450f5b3d
@ -639,12 +639,12 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
|
|||||||
if (!nhostdevs)
|
if (!nhostdevs)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (!(pcidevs = virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs)))
|
||||||
|
return -1;
|
||||||
|
|
||||||
virObjectLock(mgr->activePCIHostdevs);
|
virObjectLock(mgr->activePCIHostdevs);
|
||||||
virObjectLock(mgr->inactivePCIHostdevs);
|
virObjectLock(mgr->inactivePCIHostdevs);
|
||||||
|
|
||||||
if (!(pcidevs = virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs)))
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
/* Detaching devices from the host involves several steps; each
|
/* Detaching devices from the host involves several steps; each
|
||||||
* of them is described at length below.
|
* of them is described at length below.
|
||||||
*
|
*
|
||||||
@ -912,9 +912,9 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virObjectUnref(pcidevs);
|
|
||||||
virObjectUnlock(mgr->activePCIHostdevs);
|
virObjectUnlock(mgr->activePCIHostdevs);
|
||||||
virObjectUnlock(mgr->inactivePCIHostdevs);
|
virObjectUnlock(mgr->inactivePCIHostdevs);
|
||||||
|
virObjectUnref(pcidevs);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user