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

virHostdevReAttachPCIDevices: Separate out function body

In near future we will have a list of PCI devices we want to
re-attach to the host (held in virPCIDeviceListPtr) but we don't
have virDomainHostdevDefPtr. That's okay because
virHostdevReAttachPCIDevices() works with virPCIDeviceListPtr
mostly anyway. And in very few places where it needs
virDomainHostdevDefPtr are not interesting for our case.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
ACKed-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NCole Robinson <crobinso@redhat.com>
上级 12140238
......@@ -1002,30 +1002,17 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
}
/* @oldStateDir:
* For upgrade purpose: see virHostdevRestoreNetConfig
*/
void
virHostdevReAttachPCIDevices(virHostdevManagerPtr mgr,
const char *drv_name,
const char *dom_name,
virDomainHostdevDefPtr *hostdevs,
int nhostdevs,
const char *oldStateDir)
static void
virHostdevReAttachPCIDevicesImpl(virHostdevManagerPtr mgr,
const char *drv_name,
const char *dom_name,
virPCIDeviceListPtr pcidevs,
virDomainHostdevDefPtr *hostdevs,
int nhostdevs,
const char *oldStateDir)
{
g_autoptr(virPCIDeviceList) pcidevs = NULL;
size_t i;
if (!nhostdevs)
return;
if (!(pcidevs = virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs))) {
VIR_ERROR(_("Failed to allocate PCI device list: %s"),
virGetLastErrorMessage());
virResetLastError();
return;
}
virObjectLock(mgr->activePCIHostdevs);
virObjectLock(mgr->inactivePCIHostdevs);
......@@ -1121,6 +1108,35 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr mgr,
virObjectUnlock(mgr->inactivePCIHostdevs);
}
/* @oldStateDir:
* For upgrade purpose: see virHostdevRestoreNetConfig
*/
void
virHostdevReAttachPCIDevices(virHostdevManagerPtr mgr,
const char *drv_name,
const char *dom_name,
virDomainHostdevDefPtr *hostdevs,
int nhostdevs,
const char *oldStateDir)
{
g_autoptr(virPCIDeviceList) pcidevs = NULL;
if (!nhostdevs)
return;
if (!(pcidevs = virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs))) {
VIR_ERROR(_("Failed to allocate PCI device list: %s"),
virGetLastErrorMessage());
virResetLastError();
return;
}
virHostdevReAttachPCIDevicesImpl(mgr, drv_name, dom_name, pcidevs,
hostdevs, nhostdevs, oldStateDir);
}
int
virHostdevUpdateActivePCIDevices(virHostdevManagerPtr mgr,
virDomainHostdevDefPtr *hostdevs,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册