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

[PATCH 4/4] Remove unused container devices when removing an md or last lv in a vg.



We don't remove the empty containers unless we are the ones removing
the last device that uses them.
---
 pyanaconda/ui/gui/spokes/custom.py |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index f43d8c2..2c33762 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -404,6 +404,14 @@ class CustomPartitioningSpoke(NormalSpoke):
                 # FIXME:  Do creation.
                 pass
 
+    def _destroy_device(self, device):
+        # if this device has parents with no other children, remove them too
+        parents = device.parents[:]
+        self.storage.destroyDevice(device)
+        for parent in parents:
+            if parent.kids == 0 and not parent.isDisk:
+                self._destroy_device(parent)
+
     def _remove_from_ui(self, root, device):
         if root is None:
             pass    # unused device
@@ -415,7 +423,7 @@ class CustomPartitioningSpoke(NormalSpoke):
             for mountpoint in mountpoints:
                 root.mounts.pop(mountpoint)
 
-        self.storage.destroyDevice(device)
+        self._destroy_device(device)
 
         # Now that it's removed from the installation root, refreshing the
         # display will have the effect of making it disappear.  It's like
-- 
1.7.7.6


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