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

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

 



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

_______________________________________________
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