Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   CentOS (http://www.linux-archive.org/centos/)
-   -   Remove unused container devices when removing an md or last lv in a vg. (http://www.linux-archive.org/centos/675095-remove-unused-container-devices-when-removing-md-last-lv-vg.html)

David Lehman 06-20-2012 05:44 PM

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

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


All times are GMT. The time now is 10:33 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.