]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Conditionally wait for kvm_assigned_device cleanup
authorChunyan Liu <cyliu@suse.com>
Wed, 5 Mar 2014 11:56:17 +0000 (19:56 +0800)
committerDaniel P. Berrange <berrange@redhat.com>
Wed, 12 Mar 2014 16:03:05 +0000 (16:03 +0000)
Only wait for kvm device cleanup if the driver is pci-stub

src/qemu/qemu_hostdev.c

index 5fa6eb4db293f9cfdd05bb7da97b24b16620fd6d..3a0653ff77a645d96c0a08e40cb10ad2a1958dc0 100644 (file)
@@ -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,