The shrink dialog is presenting different values than resize in the partition editor. Use the same logic for both. As a result, it won't allow you to shrink a partition if it cannot find its proper minimum size. Related: rhbz#608172 --- iw/autopart_type.py | 3 +-- iw/partition_ui_helpers_gui.py | 27 +++++++++++++++++---------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/iw/autopart_type.py b/iw/autopart_type.py index 7436751..36d4e6c 100644 --- a/iw/autopart_type.py +++ b/iw/autopart_type.py @@ -45,8 +45,7 @@ def whichToShrink(storage, intf): newSize = shrinkSB.get_value_as_int() part = getActive(combo) - reqlower = long(math.ceil(part.format.minSize)) - requpper = long(math.floor(part.format.currentSize)) + (reqlower, requpper) = getResizeMinMax( part ) adj = shrinkSB.get_adjustment() adj.lower = max(1,reqlower) diff --git a/iw/partition_ui_helpers_gui.py b/iw/partition_ui_helpers_gui.py index 8fa5f6f..34e4524 100644 --- a/iw/partition_ui_helpers_gui.py +++ b/iw/partition_ui_helpers_gui.py @@ -26,6 +26,7 @@ import gtk import checklist import datacombo import iutil +import math from constants import * from partIntfHelpers import * @@ -378,16 +379,7 @@ def createPreExistFSOptionSection(origrequest, maintable, row, mountCombo, else: value = origrequest.size - reqlower = 1 - requpper = origrequest.maxSize - - if origfs.exists: - reqlower = origrequest.minSize - - if origrequest.type == "partition": - geomsize = origrequest.partedPartition.geometry.getSize(unit="MB") - if (geomsize != 0) and (requpper > geomsize): - requpper = geomsize + (reqlower, requpper) = getResizeMinMax( origrequest ) adj = gtk.Adjustment(value = value, lower = reqlower, upper = requpper, step_incr = 1) @@ -435,3 +427,18 @@ def doUIRAIDLVMChecks(format, req_disks, storage): "drive in the 'Allowable Drives' checklist.") % format.name) +def getResizeMinMax( part ): + """ Return the minimum/maximum size for a selected partition + + Assumes that it is resizable and that it exists. + """ + reqlower = long(math.ceil(part.minSize)) + requpper = long(math.floor(part.maxSize)) + + if part.type == "partition": + geomsize = part.partedPartition.geometry.getSize(unit="MB") + if (geomsize != 0) and (requpper > geomsize): + requpper =long(math.floor(geomsize)) + + return(reqlower, requpper) + -- 1.7.1.1 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list