提交 de4aace4 编写于 作者: C Chunyan Liu 提交者: Daniel P. Berrange

extract general code of NodeDeviceReset

上级 1f12cef6
......@@ -11450,6 +11450,25 @@ cleanup:
return ret;
}
static int
virHostdevPciNodeDeviceReset(virHostdevManagerPtr hostdev_mgr,
virPCIDevicePtr pci)
{
int ret = -1;
virObjectLock(hostdev_mgr->activePciHostdevs);
virObjectLock(hostdev_mgr->inactivePciHostdevs);
if (virPCIDeviceReset(pci, hostdev_mgr->activePciHostdevs,
hostdev_mgr->inactivePciHostdevs) < 0)
goto out;
ret = 0;
out:
virObjectUnlock(hostdev_mgr->inactivePciHostdevs);
virObjectUnlock(hostdev_mgr->activePciHostdevs);
return ret;
}
static int
qemuNodeDeviceReset(virNodeDevicePtr dev)
{
......@@ -11479,16 +11498,8 @@ qemuNodeDeviceReset(virNodeDevicePtr dev)
if (!pci)
goto cleanup;
virObjectLock(hostdev_mgr->activePciHostdevs);
virObjectLock(hostdev_mgr->inactivePciHostdevs);
if (virPCIDeviceReset(pci, hostdev_mgr->activePciHostdevs,
hostdev_mgr->inactivePciHostdevs) < 0)
goto out;
ret = virHostdevPciNodeDeviceReset(hostdev_mgr, pci);
ret = 0;
out:
virObjectUnlock(hostdev_mgr->inactivePciHostdevs);
virObjectUnlock(hostdev_mgr->activePciHostdevs);
virPCIDeviceFree(pci);
cleanup:
virNodeDeviceDefFree(def);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册