summaryrefslogtreecommitdiffstats
path: root/autopart.py
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>2001-06-27 05:10:44 +0000
committerMatt Wilson <msw@redhat.com>2001-06-27 05:10:44 +0000
commit4b465094292e6ee972bf87a564d02af2d7331836 (patch)
tree02f3dea8f92b6eecaaeb8cb3cde7d6b7fd1a2ffd /autopart.py
parentea389fb28dc34d3a1670cc30723c86173463ef09 (diff)
downloadanaconda-4b465094292e6ee972bf87a564d02af2d7331836.tar.gz
anaconda-4b465094292e6ee972bf87a564d02af2d7331836.tar.xz
anaconda-4b465094292e6ee972bf87a564d02af2d7331836.zip
fix double remove corruption in autopart
Diffstat (limited to 'autopart.py')
-rw-r--r--autopart.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/autopart.py b/autopart.py
index e4787b4ae..cad2cdb86 100644
--- a/autopart.py
+++ b/autopart.py
@@ -505,6 +505,25 @@ def deletePart(diskset, delete):
part = disk.next_partition(part)
def processPartitioning(diskset, requests, newParts):
+ # collect a hash of all the devices that we have created extended
+ # partitions on. When we remove these extended partitions the logicals
+ # (all of which we created) will be destroyed along with it.
+ extendeds = {}
+ for part in newParts.parts:
+ if part.type == parted.PARTITION_EXTENDED:
+ extendeds[part.geom.disk.dev.path] = None
+
+ # Go through the list again and check for each logical partition we have.
+ # If we created the extended partition on the same device as the logical
+ # partition, remove it from out list, as it will be cleaned up for us
+ # when the extended partition gets removed.
+ for part in newParts.parts:
+ if (part.type & parted.PARTITION_LOGICAL
+ and extendeds.has_key(part.geom.disk.dev.path)):
+ newParts.parts.remove(part)
+
+ # Finally, remove all of the partitions we added in the last try from
+ # the disks. We'll start again from there.
for part in newParts.parts:
disk = part.geom.disk
if part.type & parted.PARTITION_LOGICAL: