diff options
author | Jeremy Katz <katzj@redhat.com> | 2001-07-04 01:26:59 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2001-07-04 01:26:59 +0000 |
commit | 4814536cb4a3b5e385cc7904ac1f4853f7cc1f82 (patch) | |
tree | eb89ef80c173a200e1e5f054ec0415baca7231c1 /partitioning.py | |
parent | 80aeb81504ff08479288702aa3693cba88d30131 (diff) | |
download | anaconda-4814536cb4a3b5e385cc7904ac1f4853f7cc1f82.tar.gz anaconda-4814536cb4a3b5e385cc7904ac1f4853f7cc1f82.tar.xz anaconda-4814536cb4a3b5e385cc7904ac1f4853f7cc1f82.zip |
Move the partitioning bits into Partitions object. The diskset should probably
go in here at some point, and arguably the fsset as well, but that should be
able to be done without major upheaval. Major changes to note:
* id.partitions created
* PartitionRequest object folded into Partitions
* all of the various autopartitioning variables folded into Partitions
* avoid passing just instdata as much as possible
other minor fixes which are slipping into this commit
* /usr for server install size to 800 megs... 512 is too small :(
* kickstart bootloader fix
* fix a couple places to use convenience functions instead of part.geom.disk.dev.path
* set self.intf for gui autopartitioning so message window works
Diffstat (limited to 'partitioning.py')
-rw-r--r-- | partitioning.py | 65 |
1 files changed, 49 insertions, 16 deletions
diff --git a/partitioning.py b/partitioning.py index e25e0240b..6704b1a5b 100644 --- a/partitioning.py +++ b/partitioning.py @@ -527,16 +527,43 @@ class PartitionSpec: entry.setFormat(self.format) return entry -class PartitionRequests: +class Partitions: def __init__ (self, diskset = None): + # requests for partitions including preexisting partitions + # a list of PartitionSpec objects self.requests = [] + + # preexisting partitions which should be deleted + # a list of DeleteSpec objects self.deletes = [] - # identifier used for raid partitions + + # auto partitioning requests + # a list of PartitionSpec objects + # these are set by the installclass and then folded into self.requests + self.autoPartitionRequests = [] + + # CLEARPART_TYPE_LINUX, CLEARPART_TYPE_ALL, CLEARPART_TYPE_NONE + # used by installclasses to say which partitions to clear + self.autoClearPartType = None + + # drives to clear partitions on (following self.autoClearPartType) + # note that None clears ALL drives + self.autoClearPartDrives = None + + # internal counter... if you use it as an ID, increment it to avoid + # problems later on self.nextUniqueID = 1 + + # partition method + self.useAutopartitioning = 1 + self.useFdisk = 0 + if diskset: self.setFromDisk(diskset) + # clear out the delete list and initialize all partitions which + # currently exist on the disk def setFromDisk(self, diskset): self.deletes = [] self.requests = [] @@ -569,7 +596,7 @@ class PartitionRequests: start = part.geom.start end = part.geom.end size = getPartSizeMB(part) - drive = part.geom.disk.dev.path[5:] + drive = get_partition_drive(part) spec = PartitionSpec(ptype, requesttype = REQUEST_PREEXIST, start = start, end = end, size = size, @@ -580,7 +607,7 @@ class PartitionRequests: part = disk.next_partition(part) def addRequest (self, request): - request.uniqueID = self.nextUniqueID + 1 + request.uniqueID = self.nextUniqueID self.nextUniqueID = self.nextUniqueID + 1 self.requests.append(request) self.requests.sort() @@ -644,13 +671,20 @@ class PartitionRequests: n = n + 1 def copy (self): - new = PartitionRequests() + new = Partitions() for request in self.requests: new.addRequest(request) for delete in self.deletes: new.addDelete(delete) - return new + new.autoPartitionRequests = self.autoPartitionRequests + new.autoClearPartType = self.autoClearPartType + new.autoClearPartDrives = self.autoClearPartDrives + new.nextUniqueID = self.nextUniqueID + new.useAutopartitioning = self.useAutopartitioning + new.useFdisk = self.useFdisk + return new + class DiskSet: skippedDisks = [] @@ -864,30 +898,29 @@ class DiskSet: part = disk.next_partition(part) return rc -def partitionObjectsInitialize(id, dir): +def partitionObjectsInitialize(diskset, partitions, dir): if dir == DISPATCH_BACK: return # read in drive info - id.diskset = DiskSet() - id.diskset.refreshDevices() - id.partrequests = PartitionRequests(id.diskset) + diskset.refreshDevices() + partitions.setFromDisk(diskset) -def partitionMethodSetup(id, dispatch): +def partitionMethodSetup(partitions, dispatch): # turn on/off step based on 3 paths: # - use fdisk, then set mount points # - use autopartitioning, then set mount points # - use interactive partitioning tool, continue - dispatch.skipStep("autopartition", skip = not id.useAutopartitioning) - dispatch.skipStep("autopartitionexecute",skip = not id.useAutopartitioning) - dispatch.skipStep("fdisk", skip = not id.useFdisk) + dispatch.skipStep("autopartition", skip = not partitions.useAutopartitioning) + dispatch.skipStep("autopartitionexecute",skip = not partitions.useAutopartitioning) + dispatch.skipStep("fdisk", skip = not partitions.useFdisk) protected = dispatch.method.protectedPartitions() if protected: for device in protected: - request = id.partrequests.getRequestByDeviceName(device) + request = partitions.getRequestByDeviceName(device) request.type = REQUEST_PROTECTED @@ -983,7 +1016,7 @@ def doDeletePartitionByRequest(intf, requestlist, partition): drive = get_partition_drive(partition) if partition.type & parted.PARTITION_EXTENDED: - deleteAllLogicalPartitions(partition, requsestlist) + deleteAllLogicalPartitions(partition, requestlist) delete = DeleteSpec(drive, partition.geom.start, partition.geom.end) requestlist.addDelete(delete) |