Re: [PATCH 5/6] hostdev: Only rollback detach of managed devices on error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/17/2015 10:23 AM, Andrea Bolognani wrote:
Since we don't detach unmanaged devices before attaching them to a
domain, we shouldn't reattach them to rollback an error either.

Yes, definitely ACK. This patch makes the error cleanup code exactly mirror the code it is cleaning up from.

---
  src/util/virhostdev.c | 14 ++++++++------
  1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index afacd4e..c8da8e5 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -711,12 +711,14 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
      for (i = 0; i < virPCIDeviceListCount(pcidevs); i++) {
          virPCIDevicePtr dev = virPCIDeviceListGet(pcidevs, i);
- /* NB: This doesn't actually re-bind to original driver, just
-         * unbinds from the stub driver
-         */
-        ignore_value(virPCIDeviceReattach(dev,
-                                          hostdev_mgr->activePCIHostdevs,
-                                          hostdev_mgr->inactivePCIHostdevs));
+        if (virPCIDeviceGetManaged(dev)) {
+            /* NB: This doesn't actually re-bind to original driver, just
+             * unbinds from the stub driver
+             */
+            ignore_value(virPCIDeviceReattach(dev,
+                                              hostdev_mgr->activePCIHostdevs,
+                                              hostdev_mgr->inactivePCIHostdevs));
+        }
      }
cleanup:

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]