summaryrefslogtreecommitdiffstats
path: root/partIntfHelpers.py
diff options
context:
space:
mode:
authorMike Fulbright <msf@redhat.com>2002-07-02 20:18:31 +0000
committerMike Fulbright <msf@redhat.com>2002-07-02 20:18:31 +0000
commita248cc6256147281b3a0cbb8556d3b5b19cbdc9d (patch)
treeaaf4df5254da99fde6daea1b95da7dad58b9b365 /partIntfHelpers.py
parentc8fc8a3015e26e7da9f5610da84503deaed1c42b (diff)
downloadanaconda-a248cc6256147281b3a0cbb8556d3b5b19cbdc9d.tar.gz
anaconda-a248cc6256147281b3a0cbb8556d3b5b19cbdc9d.tar.xz
anaconda-a248cc6256147281b3a0cbb8556d3b5b19cbdc9d.zip
Fix crash on certain partition tables because previous delete entire disk algorithm tried to delete FREESPACE and METADATA type partitions, as well as logical partitions after we'd deleted the extended partition it was in
Diffstat (limited to 'partIntfHelpers.py')
-rw-r--r--partIntfHelpers.py38
1 files changed, 32 insertions, 6 deletions
diff --git a/partIntfHelpers.py b/partIntfHelpers.py
index d96aecec2..de89f70dc 100644
--- a/partIntfHelpers.py
+++ b/partIntfHelpers.py
@@ -227,24 +227,50 @@ def doDeletePartitionsByDevice(intf, requestlist, diskset, device,
if not rc:
return
-
+
requests = requestlist.getRequestsByDevice(diskset, device)
if not requests:
return
- # XXX assumes all requests are due to a real partition device
- notdeleted = []
+ # get list of unique IDs of these requests
+ reqIDs = []
for req in requests:
+ part = partedUtils.get_partition_by_name(diskset.disks, req.device)
+ if part.type & parted.PARTITION_FREESPACE or part.type & parted.PARTITION_METADATA:
+ continue
+ reqIDs.append(req.uniqueID)
+
+ # now go thru and try to delete the unique IDs
+ for id in reqIDs:
try:
+ req = requestlist.getRequestByID(id)
+ if req is None:
+ continue
part = partedUtils.get_partition_by_name(diskset.disks, req.device)
rc = doDeletePartitionByRequest(intf, requestlist, part,
confirm=0, quiet=1)
-
# not sure why it returns both '0' and '(None, None)' on failure
if not rc or rc == (None, None):
- notdeleted.append(req)
+ pass
except:
- notdeleted.append(req)
+ pass
+
+ # see which partitions are left
+ notdeleted = []
+ left_requests = requestlist.getRequestsByDevice(diskset, device)
+ if left_requests:
+ # get list of unique IDs of these requests
+ leftIDs = []
+ for req in left_requests:
+ part = partedUtils.get_partition_by_name(diskset.disks, req.device)
+ if part.type & parted.PARTITION_FREESPACE or part.type & parted.PARTITION_METADATA:
+ continue
+ leftIDs.append(req.uniqueID)
+
+ for id in leftIDs:
+ req = requestlist.getRequestByID(id)
+ notdeleted.append(req)
+
# see if we need to report any failures - some were because we removed
# an extended partition which contained other members of our delete list