diff options
author | Jeremy Katz <katzj@redhat.com> | 2005-05-05 01:42:17 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2005-05-05 01:42:17 +0000 |
commit | 383a190ddb0648b78a0d80a9903348a64987438a (patch) | |
tree | 93ebfc2155378084003f2eb36bd9189598cae691 /autopart.py | |
parent | d2e725e1df3b07de24566d37dfb2afe3c7a29031 (diff) | |
download | anaconda-383a190ddb0648b78a0d80a9903348a64987438a.tar.gz anaconda-383a190ddb0648b78a0d80a9903348a64987438a.tar.xz anaconda-383a190ddb0648b78a0d80a9903348a64987438a.zip |
2005-05-04 Jeremy Katz <katzj@redhat.com>
* fsset.py (HfsPlusFileSystem.__init__): Add hfs+ support.
* autopart.py (growParts): Don't try to grow a partition beyond
the size of the largest free space. Fixes pathological problem
hit when installing a dual boot with MacOS X.
Diffstat (limited to 'autopart.py')
-rw-r--r-- | autopart.py | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/autopart.py b/autopart.py index 81d171766..e1f6ba78e 100644 --- a/autopart.py +++ b/autopart.py @@ -327,14 +327,14 @@ def fitSized(diskset, requests, primOnly = 0, newParts = None): largestPart = (0, None) drives = getDriveList(request, diskset) -# log("Trying drives to find best free space out of", free) +# log("Trying drives to find best free space out of %s" %(free,)) for drive in drives: # this request is bootable and we've found a large enough # partition already, so we don't need to keep trying other # drives. this keeps us on the first possible drive if isBoot and largestPart[1]: break -## print "Trying drive", drive +## print "Trying drive", drive disk = diskset.disks[drive] numPrimary = len(partedUtils.get_primary_partitions(disk)) numLogical = len(partedUtils.get_logical_partitions(disk)) @@ -613,6 +613,7 @@ def growParts(diskset, requests, newParts): def getFreeSpace(diskset): free = findFreespace(diskset) freeSize = {} + largestFree = {} # find out the amount of free space on each drive for key in free.keys(): @@ -620,10 +621,14 @@ def growParts(diskset, requests, newParts): del free[key] continue freeSize[key] = 0 + largestFree[key] = 0 for part in free[key]: - freeSize[key] = freeSize[key] + partedUtils.getPartSize(part) + sz = partedUtils.getPartSize(part) + freeSize[key] += sz + if sz > largestFree[key]: + largestFree[key] = sz - return (free, freeSize) + return (free, freeSize, largestFree) #### # start of growParts @@ -636,7 +641,7 @@ def growParts(diskset, requests, newParts): ## printNewRequestsCyl(diskset, newRequest) ## print "\n\n\n" - (free, freeSize) = getFreeSpace(diskset) + (free, freeSize, largestFree) = getFreeSpace(diskset) # find growable partitions growable = {} @@ -773,8 +778,7 @@ def growParts(diskset, requests, newParts): imposedMax = 1 log("Enforced max swap size of %s based on suggested max swap", maxsect) - - + # round max fs limit down a cylinder, helps when growing # so we don't end up with a free cylinder at end if # maxlimit fell between cylinder boundaries @@ -785,8 +789,14 @@ def growParts(diskset, requests, newParts): maxsect = long(maxFSSize) imposedMax = 1 -## print "freesize, max = ",freeSize[drive],maxsect -## print "startsize = ",startSize + maxfree = largestFree[drive] + if maxsect > largestFree[drive]: + maxsect = long(maxfree) + imposedMax = 1 + +# print "freesize, max, maxfree = ",freeSize[drive],maxsect, maxfree +# print "freeSizeMB, maxMB = ", freeSize[drive] * sector_size/(1024.0 * 1024.0), maxsect * sector_size/(1024.0*1024.0), largestFree[drive] +# print "startsize = ",startSize min = startSize max = maxsect @@ -843,7 +853,7 @@ def growParts(diskset, requests, newParts): # print "end min, max, cur, diffs = ",min,max,cur,diff,lastDiff # print "%s took %s loops" % (request.mountpoint, inner_iter) lastFreeSize = freeSize[drive] - (free, freeSize) = getFreeSpace(diskset) + (free, freeSize, largestFree) = getFreeSpace(diskset) # printFreespace(free) if ret == PARTITION_FAIL or (max == maxsect and imposedMax): |