Signed-off-by: Chunyan Liu <cyliu(a)suse.com>
---
src/qemu/qemu_hostdev.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index ea776ce..8f009e1 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -1270,10 +1270,8 @@ qemuPrepareHostDevices(virQEMUDriverPtr driver,
* are locked
*/
static void
-qemuReattachPciDevice(virPCIDevicePtr dev, virHostdevManagerPtr mgr)
+virHostdevReattachPciDevice(virPCIDevicePtr dev, virHostdevManagerPtr mgr)
{
- int retries = 100;
-
/* If the device is not managed and was attached to guest
* successfully, it must have been inactive.
*/
@@ -1283,10 +1281,14 @@ qemuReattachPciDevice(virPCIDevicePtr dev, virHostdevManagerPtr
mgr)
return;
}
- while (virPCIDeviceWaitForCleanup(dev, "kvm_assigned_device")
- && retries) {
- usleep(100*1000);
- retries--;
+ /* Wait for device cleanup if it is qemu/kvm */
+ if (STREQ(virPCIDeviceGetStubDriver(dev), "pci-stub")) {
+ int retries = 100;
+ while (virPCIDeviceWaitForCleanup(dev, "kvm_assigned_device")
+ && retries) {
+ usleep(100*1000);
+ retries--;
+ }
}
if (virPCIDeviceReattach(dev, mgr->activePciHostdevs,
--
1.6.0.2