[PATCH] Give access to partitions when determining min/max size to resize; also keep

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

 



---
 iw/lvm_dialog_gui.py           |    2 +-
 iw/partition_dialog_gui.py     |    2 +-
 iw/partition_ui_helpers_gui.py |   11 +++++------
 iw/raid_dialog_gui.py          |    2 +-
 partRequests.py                |   13 +++++++++++--
 5 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/iw/lvm_dialog_gui.py b/iw/lvm_dialog_gui.py
index 560970f..88ead9f 100644
--- a/iw/lvm_dialog_gui.py
+++ b/iw/lvm_dialog_gui.py
@@ -463,7 +463,7 @@ class VolumeGroupEditor:
 
 	self.fsoptionsDict = {}
 	if logrequest.getPreExisting():
-	    (row, self.fsoptionsDict) = createPreExistFSOptionSection(logrequest, maintable, row, mountCombo, ignorefs = ["software RAID", "physical volume (LVM)", "vfat"])
+	    (row, self.fsoptionsDict) = createPreExistFSOptionSection(logrequest, maintable, row, mountCombo, self.partitions, ignorefs = ["software RAID", "physical volume (LVM)", "vfat"])
 
         dialog.vbox.pack_start(maintable)
         dialog.show_all()
diff --git a/iw/partition_dialog_gui.py b/iw/partition_dialog_gui.py
index fa7a6fd..0dc13ac 100644
--- a/iw/partition_dialog_gui.py
+++ b/iw/partition_dialog_gui.py
@@ -444,7 +444,7 @@ class PartitionEditor:
         # aren't protected (we'd still like to be able to mount them, though)
 	self.fsoptionsDict = {}
         if self.origrequest.type == REQUEST_PREEXIST and self.origrequest.fstype and not self.origrequest.getProtected():
-	    (row, self.fsoptionsDict) = createPreExistFSOptionSection(self.origrequest, maintable, row, self.mountCombo)
+	    (row, self.fsoptionsDict) = createPreExistFSOptionSection(self.origrequest, maintable, row, self.mountCombo, self.partitions)
 
         # size options
         if self.origrequest.type == REQUEST_NEW:
diff --git a/iw/partition_ui_helpers_gui.py b/iw/partition_ui_helpers_gui.py
index e4477d2..4773e8e 100644
--- a/iw/partition_ui_helpers_gui.py
+++ b/iw/partition_ui_helpers_gui.py
@@ -270,7 +270,7 @@ def noformatCB(widget, data):
        resizesb      - spinbutton with resize target
 """
 def createPreExistFSOptionSection(origrequest, maintable, row, mountCombo,
-                                  ignorefs=[]):
+                                  partitions, ignorefs=[]):
     rc = {}
     ofstype = origrequest.fstype
 
@@ -316,9 +316,8 @@ def createPreExistFSOptionSection(origrequest, maintable, row, mountCombo,
 	migratecb = None
 	migfstypeCombo = None
 
-    # FIXME: we should support resizing LVs too
-    if origrequest.origfstype.isResizable() and origrequest.type == REQUEST_PREEXIST:
-        resizecb = gtk.CheckButton(label=_("_Resize partition"))
+    if origrequest.isResizable():
+        resizecb = gtk.CheckButton(label=_("_Resize"))
         resizecb.set_active(origrequest.targetSize is not None)
         rc["resizecb"] = resizecb
         maintable.attach(resizecb, 0, 1, row, row + 1)
@@ -328,8 +327,8 @@ def createPreExistFSOptionSection(origrequest, maintable, row, mountCombo,
         else:
             value = origrequest.size
 
-        reqlower = origrequest.getMinimumResizeMB()
-        requpper = origrequest.getMaximumResizeMB()
+        reqlower = origrequest.getMinimumResizeMB(partitions)
+        requpper = origrequest.getMaximumResizeMB(partitions)
         if not origrequest.format:
             lower = reqlower
         else:
diff --git a/iw/raid_dialog_gui.py b/iw/raid_dialog_gui.py
index 22123f8..563cc4a 100644
--- a/iw/raid_dialog_gui.py
+++ b/iw/raid_dialog_gui.py
@@ -444,7 +444,7 @@ class RaidEditor:
             maintable.attach(self.lukscb, 0, 2, row, row + 1)
             row = row + 1
 	else:
-	    (row, self.fsoptionsDict) = createPreExistFSOptionSection(self.origrequest, maintable, row, self.mountCombo)
+	    (row, self.fsoptionsDict) = createPreExistFSOptionSection(self.origrequest, maintable, row, self.mountCombo, self.partitions)
 
 	# put main table into dialog
 	dialog.vbox.pack_start(maintable)
diff --git a/partRequests.py b/partRequests.py
index c5655e0..84ff18a 100644
--- a/partRequests.py
+++ b/partRequests.py
@@ -158,6 +158,9 @@ class RequestSpec:
         self.targetSize = None
         """Size to resize to"""
 
+        self.resizable = False
+        """Is this a request that can be resized?"""
+
     def __str__(self):
         if self.fstype:
             fsname = self.fstype.getName()
@@ -190,6 +193,11 @@ class RequestSpec:
         import traceback
         traceback.print_stack()
 
+    def isResizable(self):
+        if self.encryption: # encrypted devices can't be resized currently
+            return False
+        return self.resizable and self.fstype.isResizable()
+
     def toEntry(self, partitions):
         """Turn a request into a fsset entry and return the entry."""
         device = self.getDevice(partitions)
@@ -581,17 +589,18 @@ class PreexistingPartitionSpec(PartitionSpec):
                                format = format, migrate = migrate,
                                mountpoint = mountpoint, preexist = 1)
         self.type = REQUEST_PREEXIST
+        self.resizable = True
 
         self.maxResizeSize = None
         """Maximum size of this partition request"""
 
-    def getMaximumResizeMB(self):
+    def getMaximumResizeMB(self, partitions):
         if self.maxResizeSize is not None:
             return self.maxResizeSize
         log.warning("%s doesn't have a max size set" %(self.device,))
         return MAX_PART_SIZE
 
-    def getMinimumResizeMB(self):
+    def getMinimumResizeMB(self, partitions):
         return self.fstype.getMinimumSize(self.device)
 
 class RaidRequestSpec(RequestSpec):
-- 
1.5.3.4

_______________________________________________
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