[libvirt] [PATCH v14 17/49] rename qemuReAttachPciDevice to virHostdevReAttachPciDevice

Chunyan Liu cyliu at suse.com
Fri Mar 7 10:52:44 UTC 2014


Signed-off-by: Chunyan Liu <cyliu at suse.com>
---
 src/qemu/qemu_hostdev.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index 5fa6eb4..2dfe252 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -1254,10 +1254,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.
      */
@@ -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,
@@ -1363,7 +1365,7 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr,
 
     while (virPCIDeviceListCount(pcidevs) > 0) {
         virPCIDevicePtr dev = virPCIDeviceListStealIndex(pcidevs, 0);
-        qemuReattachPciDevice(dev, hostdev_mgr);
+        virHostdevReattachPciDevice(dev, hostdev_mgr);
     }
 
     virObjectUnref(pcidevs);
-- 
1.9.0




More information about the libvir-list mailing list