[PATCH] Update getMaxLVSize from lvm1 to lvm2.

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

 



Maximum lv size in lvm2 does not depend on the extent size.

Also, if you're checking limits on new pe size, clamp lvs using
the new pe size, not the old one.

Resolves: rhbz#695299
---
 iw/lvm_dialog_gui.py    |    8 ++++----
 lvm.py                  |   14 ++++++++------
 textw/partition_text.py |    4 ++--
 3 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/iw/lvm_dialog_gui.py b/iw/lvm_dialog_gui.py
index b10d7eb..f0aa367 100644
--- a/iw/lvm_dialog_gui.py
+++ b/iw/lvm_dialog_gui.py
@@ -207,10 +207,10 @@ class VolumeGroupEditor:
             else:
                 self.updateLogVolStore()
 	else:
-	    maxlv = lvm.getMaxLVSize(curval)
+	    maxlv = lvm.getMaxLVSize()
 	    for lv in self.logvolreqs:
 		lvsize = lv.getActualSize(self.partitions, self.diskset,
-                            pesize=lastval)
+                            pesize=curval)
 		if lvsize > maxlv:
 		    self.intf.messageWindow(_("Not enough space"),
 					    _("The physical extent size "
@@ -456,7 +456,7 @@ class VolumeGroupEditor:
         if not logrequest or not logrequest.getPreExisting():
             pesize = int(self.peCombo.get_active_value())
             (tspace, uspace, fspace) = self.computeSpaceValues(usepe=pesize)
-            maxlv = min(lvm.getMaxLVSize(pesize), fspace)
+            maxlv = min(lvm.getMaxLVSize(), fspace)
 
             # add in size of current logical volume if it has a size
             if logrequest and not isNew:
@@ -617,7 +617,7 @@ class VolumeGroupEditor:
 	    size = lvm.clampLVSizeRequest(size, pesize, roundup=1)
 
 	    # do some final tests
-	    maxlv = lvm.getMaxLVSize(pesize)
+	    maxlv = lvm.getMaxLVSize()
 	    if size > maxlv:
 		self.intf.messageWindow(_("Not enough space"),
 					_("The current requested size "
diff --git a/lvm.py b/lvm.py
index c0608ee..64f6afe 100644
--- a/lvm.py
+++ b/lvm.py
@@ -16,6 +16,7 @@ import os,sys
 import string
 import math
 import isys
+import rhpl.arch
 
 from flags import flags
 
@@ -394,12 +395,13 @@ def clampPVSize(pvsize, pesize):
     pvsize *= 1024.0
     return long((math.floor(pvsize / pesize) * pesize) / 1024)
 
-def getMaxLVSize(pe):
-    """Given a PE size in KB, returns maximum size (in MB) of a logical volume.
-
-    pe - PE size in KB
-    """
-    return pe*64
+def getMaxLVSize():
+    """ Return the maximum size (in MB) of a logical volume. """
+    if rhpl.arch.canonArch in ("s390x", "sparc64", "x86_64", "ia64") or \
+       rhpl.arch.canonArch.startswith("ppc64"): #64bit architectures
+        return (8*1024*1024*1024*1024) #Max is 8EiB (very large number..)
+    else:
+        return (16*1024*1024) #Max is 16TiB
 
 def createSuggestedVGName(partitions):
     """Given list of partition requests, come up with a reasonable VG name
diff --git a/textw/partition_text.py b/textw/partition_text.py
index 5f2d1db..f8f06c9 100644
--- a/textw/partition_text.py
+++ b/textw/partition_text.py
@@ -1295,8 +1295,8 @@ class PartitionWindow:
                 pesize = vgreq.pesize
                 size = lvm.clampLVSizeRequest(size, pesize, roundup=1)
 
-                maxlv = lvm.getMaxLVSize(pesize)
-                if size > lvm.getMaxLVSize(pesize):
+                maxlv = lvm.getMaxLVSize()
+                if size > lvm.getMaxLVSize():
                     self.intf.messageWindow(_("Not enough space"),
                                             _("The current requested size "
                                               "(%10.2f MB) is larger than "
-- 
1.7.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