From: Chunyan Liu Date: Wed, 5 Mar 2014 11:56:17 +0000 (+0800) Subject: Conditionally wait for kvm_assigned_device cleanup X-Git-Tag: v1.2.3-rc1~271 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=82e8dd4cf80c6a34f74344943cadcbdaa6cba342;p=thirdparty%2Flibvirt.git Conditionally wait for kvm_assigned_device cleanup Only wait for kvm device cleanup if the driver is pci-stub --- diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c index 5fa6eb4db2..3a0653ff77 100644 --- a/src/qemu/qemu_hostdev.c +++ b/src/qemu/qemu_hostdev.c @@ -1256,8 +1256,6 @@ qemuPrepareHostDevices(virQEMUDriverPtr driver, static void qemuReattachPciDevice(virPCIDevicePtr dev, virHostdevManagerPtr mgr) { - int retries = 100; - /* If the device is not managed and was attached to guest * successfully, it must have been inactive. */ @@ -1267,10 +1265,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,