diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c index b397b7917555e51035cdf46b3447716bc8a47ef6..933c94263c58a5653196524a7833ed11c8e7c580 100644 --- a/src/util/virhostdev.c +++ b/src/util/virhostdev.c @@ -1658,7 +1658,6 @@ virHostdevPCINodeDeviceReAttach(virHostdevManagerPtr mgr, virPCIDevicePtr pci) { struct virHostdevIsPCINodeDeviceUsedData data = { mgr, NULL, false }; - virPCIDevicePtr actual; int ret = -1; virObjectLock(mgr->activePCIHostdevs); @@ -1667,12 +1666,11 @@ virHostdevPCINodeDeviceReAttach(virHostdevManagerPtr mgr, if (virHostdevIsPCINodeDeviceUsed(virPCIDeviceGetAddress(pci), &data)) goto cleanup; - /* We need to look up the actual device because that's what - * virPCIDeviceReattach() expects as its argument */ - if (!(actual = virPCIDeviceListFind(mgr->inactivePCIHostdevs, pci))) - goto cleanup; + virPCIDeviceSetUnbindFromStub(pci, true); + virPCIDeviceSetRemoveSlot(pci, true); + virPCIDeviceSetReprobe(pci, true); - if (virPCIDeviceReattach(actual, mgr->activePCIHostdevs, + if (virPCIDeviceReattach(pci, mgr->activePCIHostdevs, mgr->inactivePCIHostdevs) < 0) goto cleanup;