mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
virHostdevReAttachPCIDevices: 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
bf450f5b3d
commit
b2985cfe33
@ -963,16 +963,16 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr mgr,
|
||||
if (!nhostdevs)
|
||||
return;
|
||||
|
||||
virObjectLock(mgr->activePCIHostdevs);
|
||||
virObjectLock(mgr->inactivePCIHostdevs);
|
||||
|
||||
if (!(pcidevs = virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs))) {
|
||||
VIR_ERROR(_("Failed to allocate PCI device list: %s"),
|
||||
virGetLastErrorMessage());
|
||||
virResetLastError();
|
||||
goto cleanup;
|
||||
return;
|
||||
}
|
||||
|
||||
virObjectLock(mgr->activePCIHostdevs);
|
||||
virObjectLock(mgr->inactivePCIHostdevs);
|
||||
|
||||
/* Reattaching devices to the host involves several steps; each
|
||||
* of them is described at length below */
|
||||
|
||||
@ -1088,10 +1088,9 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr mgr,
|
||||
virPCIDeviceGetName(actual));
|
||||
}
|
||||
|
||||
cleanup:
|
||||
virObjectUnref(pcidevs);
|
||||
virObjectUnlock(mgr->activePCIHostdevs);
|
||||
virObjectUnlock(mgr->inactivePCIHostdevs);
|
||||
virObjectUnref(pcidevs);
|
||||
}
|
||||
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user