提交 b2985cfe 编写于 作者: M Michal Privoznik

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: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 bf450f5b
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册