[PATCH 1/2] Prevent resizes that would go past the end of the disk (#495520)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Prevent users from creating resize actions that would go past the end of
the disk.  Take in to account the disk geometry as well as the maximum
size of the resizable filesystem.
---
 iw/partition_ui_helpers_gui.py |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/iw/partition_ui_helpers_gui.py b/iw/partition_ui_helpers_gui.py
index f5650e9..fe28088 100644
--- a/iw/partition_ui_helpers_gui.py
+++ b/iw/partition_ui_helpers_gui.py
@@ -380,13 +380,17 @@ def createPreExistFSOptionSection(origrequest, maintable, row, mountCombo,
         else:
             value = origrequest.size
 
-        reqlower = origrequest.minSize
+        reqlower = 1
         requpper = origrequest.maxSize
+
         if origfs.exists:
-            lower = reqlower
-        else:
-            lower = 1
-        adj = gtk.Adjustment(value = value, lower = lower,
+            reqlower = origrequest.minSize
+
+            geomsize = origrequest.partedPartition.geometry.getSize(unit="MB")
+            if (requpper != 0) and (requpper > geomsize):
+                requpper = geomsize
+
+        adj = gtk.Adjustment(value = value, lower = reqlower,
                              upper = requpper, step_incr = 1)
         resizesb = gtk.SpinButton(adj, digits = 0)
         resizesb.set_property('numeric', True)
-- 
1.6.2.5

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux