hostdev: Only rollback detach of managed devices on error

Since we don't detach unmanaged devices before attaching them to a
domain, we shouldn't reattach them to rollback an error either.
This commit is contained in:
Andrea Bolognani 2015-12-17 15:11:27 +01:00
parent b8a625f384
commit e926df601d

View File

@ -711,12 +711,14 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
for (i = 0; i < virPCIDeviceListCount(pcidevs); i++) {
virPCIDevicePtr dev = virPCIDeviceListGet(pcidevs, i);
/* NB: This doesn't actually re-bind to original driver, just
* unbinds from the stub driver
*/
ignore_value(virPCIDeviceReattach(dev,
hostdev_mgr->activePCIHostdevs,
hostdev_mgr->inactivePCIHostdevs));
if (virPCIDeviceGetManaged(dev)) {
/* NB: This doesn't actually re-bind to original driver, just
* unbinds from the stub driver
*/
ignore_value(virPCIDeviceReattach(dev,
hostdev_mgr->activePCIHostdevs,
hostdev_mgr->inactivePCIHostdevs));
}
}
cleanup: