[libvirt] [PATCH v13 16/49] rename qemuReAttachPciDevice to virHostdevReAttachPciDevice

Chunyan Liu cyliu at suse.com
Sat Mar 1 06:29:11 UTC 2014


Signed-off-by: Chunyan Liu <cyliu at 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




More information about the libvir-list mailing list