diff options
author | Jeremy Katz <katzj@redhat.com> | 2002-05-31 04:22:19 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2002-05-31 04:22:19 +0000 |
commit | 2e58842ca3172343937392a35f41566e34c1755c (patch) | |
tree | 54ebd81c773e6a79cb219dc8be67e3801641f42d /partitioning.py | |
parent | 87a722dab1676eb1e1bb37bcfc866d1f6175789f (diff) | |
download | anaconda-2e58842ca3172343937392a35f41566e34c1755c.tar.gz anaconda-2e58842ca3172343937392a35f41566e34c1755c.tar.xz anaconda-2e58842ca3172343937392a35f41566e34c1755c.zip |
clean up getting of request sizes for lvm and raid to be just the same as
for partitions. clean up the ensuing mess. we also need to use proper
sanity checking of requests before doing autopartitioning instead of
the hack that was there before.
Diffstat (limited to 'partitioning.py')
-rw-r--r-- | partitioning.py | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/partitioning.py b/partitioning.py index d7144f5a5..ffd2bae22 100644 --- a/partitioning.py +++ b/partitioning.py @@ -38,85 +38,6 @@ import partRequests from rhpl.translate import _ from rhpl.log import log -def get_lvm_volume_group_size(request, requests, diskset): - # got to add up all of physical volumes to get total size - if request.physicalVolumes is None: - return 0 - totalspace = 0 - for physvolid in request.physicalVolumes: - pvreq = requests.getRequestByID(physvolid) - if pvreq.type != REQUEST_RAID: - part = partedUtils.get_partition_by_name(diskset.disks, - pvreq.device) - partsize = part.geom.length * part.geom.disk.dev.sector_size - else: - partsize = get_raid_device_size(pvreq, requests, diskset) - - totalspace = totalspace + partsize - - return totalspace - - -def get_raid_device_size(raidrequest, partitions, diskset): - if not raidrequest.raidmembers or not raidrequest.raidlevel: - return 0 - - raidlevel = raidrequest.raidlevel - nummembers = len(raidrequest.raidmembers) - raidrequest.raidspares - smallest = None - sum = 0 - for member in raidrequest.raidmembers: - req = partitions.getRequestByID(member) - device = req.device - part = partedUtils.get_partition_by_name(diskset.disks, device) - partsize = part.geom.length * part.geom.disk.dev.sector_size - - if raid.isRaid0(raidlevel): - sum = sum + partsize - else: - if not smallest: - smallest = partsize - elif partsize < smallest: - smallest = partsize - - if raid.isRaid0(raidlevel): - return sum - elif raid.isRaid1(raidlevel): - return smallest - elif raid.isRaid5(raidlevel): - return (nummembers-1) * smallest - else: - raise ValueError, "Invalid raidlevel in get_raid_device_size()" - -# return the actual size being used by the request in megabytes -def requestSize(req, diskset): - if req.type == REQUEST_VG: - if req.size != None: - thissize = req.size - else: - thissize = 0 - if req.type == REQUEST_RAID: - # XXX duplicate the hack below. - if req.size != None: - thissize = req.size - else: - thissize = 0 - else: - part = partedUtils.get_partition_by_name(diskset.disks, req.device) - if not part: - # XXX hack for kickstart which ends up calling this - # before allocating the partitions - if req.size: - thissize = req.size - else: - thissize = 0 - else: - thissize = partedUtils.getPartSizeMB(part) - return thissize - - - - def partitionObjectsInitialize(diskset, partitions, dir, intf): if iutil.getArch() == "s390": |