[libvirt] [PATCH] pci: Log debug messages when manipulating the inactive list

Andrea Bolognani abologna at redhat.com
Thu Jan 7 17:21:18 UTC 2016


Most of the changes to the list of active and inactive PCI devices
happen in virHostdev, where they are properly logged.

virPCIDeviceDetach() and virPCIDeviceReattach(), however, change the
inactive list as well, so they should be logging similar messages.
---
 src/util/virpci.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/util/virpci.c b/src/util/virpci.c
index 5ebd408..505c1f3 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -1370,9 +1370,10 @@ virPCIDeviceDetach(virPCIDevicePtr dev,
     /* Add *a copy of* the dev into list inactiveDevs, if
      * it's not already there.
      */
-    if (inactiveDevs && !virPCIDeviceListFind(inactiveDevs, dev) &&
-        virPCIDeviceListAddCopy(inactiveDevs, dev) < 0) {
-        return -1;
+    if (inactiveDevs && !virPCIDeviceListFind(inactiveDevs, dev)) {
+        VIR_DEBUG("Adding PCI device %s to inactive list", dev->name);
+        if (virPCIDeviceListAddCopy(inactiveDevs, dev) < 0)
+            return -1;
     }
 
     return 0;
@@ -1393,8 +1394,10 @@ virPCIDeviceReattach(virPCIDevicePtr dev,
         return -1;
 
     /* Steal the dev from list inactiveDevs */
-    if (inactiveDevs)
+    if (inactiveDevs) {
+        VIR_DEBUG("Removing PCI device %s from inactive list", dev->name);
         virPCIDeviceListDel(inactiveDevs, dev);
+    }
 
     return 0;
 }
-- 
2.5.0




More information about the libvir-list mailing list