[PATCH 03/19] Tear down devices breadth-first instead of depth first.

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

 



This way we do "sda1 sda2 sda" instead of "sda1 sda sda2 sda", which
means "sda" doesn't have to have the ability to do partial teardowns.
---
 storage/devicetree.py |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/storage/devicetree.py b/storage/devicetree.py
index 99af7c6..0059a20 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -1946,11 +1946,15 @@ class DeviceTree(object):
 
     def teardownAll(self):
         """ Run teardown methods on all devices. """
-        for device in self.leaves:
-            try:
-                device.teardown(recursive=True)
-            except StorageError as e:
-                log.info("teardown of %s failed: %s" % (device.name, e))
+        candidates = self.leaves
+        parents = []
+        while candidates:
+            for candidate in candidates:
+                parents.extend(candidate.parents)
+                if candidate.exists:
+                    candidate.teardown()
+            candidates = parents
+            parents = []
 
     def setupAll(self):
         """ Run setup methods on all devices. """
-- 
1.6.5.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux