summaryrefslogtreecommitdiffstats
path: root/autopart.py
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2002-06-07 05:21:26 +0000
committerJeremy Katz <katzj@redhat.com>2002-06-07 05:21:26 +0000
commit8b7ae92532fb49d0a344a3a04738999dcc979b45 (patch)
treef3698e9774aa0d1735aa3b2fbcf78bdae6eea9a0 /autopart.py
parentddf139564817a3b0d203136b5448421456a39dac (diff)
downloadanaconda-8b7ae92532fb49d0a344a3a04738999dcc979b45.tar.gz
anaconda-8b7ae92532fb49d0a344a3a04738999dcc979b45.tar.xz
anaconda-8b7ae92532fb49d0a344a3a04738999dcc979b45.zip
clearpart needs to go through and delete raid or lvm devices sitting on top of physical partitions as it goes through
Diffstat (limited to 'autopart.py')
-rw-r--r--autopart.py37
1 files changed, 36 insertions, 1 deletions
diff --git a/autopart.py b/autopart.py
index fe772eac7..15c5b3117 100644
--- a/autopart.py
+++ b/autopart.py
@@ -760,7 +760,9 @@ def doPartitioning(diskset, requests, doRefresh = 1):
diskset.refreshDevices()
# XXX - handle delete requests
for delete in requests.deletes:
- deletePart(diskset, delete)
+ if isinstance(delete, partRequests.DeleteSpec):
+ deletePart(diskset, delete)
+ # FIXME: do we need to do anything with other types of deletes??
newParts = partlist()
(ret, msg) = processPartitioning(diskset, requests, newParts)
@@ -782,6 +784,38 @@ def doPartitioning(diskset, requests, doRefresh = 1):
# more specific message?
raise PartitioningWarning, _("Boot partition %s may not meet booting constraints for your architecture. Creation of a boot disk is highly encouraged.") %(requests.getBootableRequest().mountpoint)
+# remove metadevices (lvm and raid) from partitions which depend on
+# the request which had the given id. to be called from within clearpart
+# NOTE: I am called recursively to handle LVM on top of RAID and LVs in VGs
+def doClearDependentDevices(partitions, id):
+ toRemove = []
+ for req in partitions.requests:
+ if isinstance(req, partRequests.RaidRequestSpec):
+ if id in req.raidmembers:
+ toRemove.append(req)
+ elif isinstance(req, partRequests.VolumeGroupRequestSpec):
+ if id in req.physicalVolumes:
+ toRemove.append(req)
+ delete = partRequests.DeleteVolumeGroupSpec(req.volumeGroupName)
+ partitions.addDelete(delete)
+ elif isinstance(req, partRequests.LogicalVolumeRequestSpec):
+ if id == req.volumeGroup:
+ toRemove.append(req)
+ tmp = partitions.getRequestByID(req.volumeGroup)
+ if not tmp:
+ log("Unable to find the vg for %s" (req.logicalVolumeName,))
+ vgname = req.volumeGroup
+ else:
+ vgname = tmp.volumeGroupName
+ delete = partRequests.DeleteLogicalVolumeSpec(req.logicalVolumeName,
+ vgname)
+ partitions.addDelete(delete)
+
+ for request in toRemove:
+ doClearDependentDevices(partitions, request.uniqueID)
+ partitions.removeRequest(request)
+
+
# given clearpart specification execute it
# probably want to reset diskset and partition request lists before calling
# this the first time
@@ -823,6 +857,7 @@ def doClearPartAction(partitions, diskset):
part = disk.next_partition(part)
continue
+ doClearDependentDevices(partitions, old.uniqueID)
partitions.removeRequest(old)
drive = partedUtils.get_partition_drive(part)