提交 cceada57 编写于 作者: L Laine Stump

util: save hostdev network device config before unbinding from host driver

In order to properly restore the original state of an SRIOV VF when
we're finished with it, we need to save the MAC address of the VF
itself (not just the admin MAC address for the VF that is stored in
the PF). But that can only be done when the VF is still bound to the
host's netdev driver, and we have always done the saving of device
config after the VF is already bound to vfio-pci. This patch prepares
us for adding a save of the VF's MAC by calling the function that
saves netconfig earlier in the device preparation, before we've
unbound it from the host netdev driver.
上级 b684734b
...@@ -653,6 +653,14 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr, ...@@ -653,6 +653,14 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
} }
} }
/* Step 1.5: For non-802.11Qbh SRIOV network devices, save the
* current device config
*/
for (i = 0; i < nhostdevs; i++) {
if (virHostdevSaveNetConfig(hostdevs[i], mgr->stateDir) < 0)
goto cleanup;
}
/* Step 2: detach managed devices and make sure unmanaged devices /* Step 2: detach managed devices and make sure unmanaged devices
* have already been taken care of */ * have already been taken care of */
for (i = 0; i < virPCIDeviceListCount(pcidevs); i++) { for (i = 0; i < virPCIDeviceListCount(pcidevs); i++) {
...@@ -743,9 +751,6 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr, ...@@ -743,9 +751,6 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
* the network device, set the new netdev config */ * the network device, set the new netdev config */
for (i = 0; i < nhostdevs; i++) { for (i = 0; i < nhostdevs; i++) {
if (virHostdevSaveNetConfig(hostdevs[i], mgr->stateDir) < 0)
goto resetvfnetconfig;
if (virHostdevSetNetConfig(hostdevs[i], uuid) < 0) if (virHostdevSetNetConfig(hostdevs[i], uuid) < 0)
goto resetvfnetconfig; goto resetvfnetconfig;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册