[PATCH] Make sure that we tell the user that the LV has a smaller capacity than the

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

 



---
 iw/lvm_dialog_gui.py |   27 ++++++++++++++++++---------
 partRequests.py      |    7 +++++++
 2 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/iw/lvm_dialog_gui.py b/iw/lvm_dialog_gui.py
index 8b40890..c571146 100644
--- a/iw/lvm_dialog_gui.py
+++ b/iw/lvm_dialog_gui.py
@@ -818,17 +818,26 @@ class VolumeGroupEditor:
 	return pv
 
     def computeVGSize(self, pvlist, curpe):
-	availSpaceMB = 0L
-	for id in pvlist:
-	    pvreq = self.partitions.getRequestByID(id)
-	    pvsize = pvreq.getActualSize(self.partitions, self.diskset)
-	    # have to clamp pvsize to multiple of PE
-	    pvsize = lvm.clampPVSize(pvsize, curpe)
-
-	    availSpaceMB = availSpaceMB + pvsize
+        availSpaceMB = 0L
+        if self.origvgrequest.preexist and self.origvgrequest.preexist_size:
+            availSpaceMB = lvm.clampPVSize(self.origvgrequest.preexist_size, curpe)
+        else:
+            for id in pvlist:
+                pvreq = self.partitions.getRequestByID(id)
+                pvsize = pvreq.getActualSize(self.partitions, self.diskset)
+                # have to clamp pvsize to multiple of PE
+                clampedSize = lvm.clampPVSize(pvsize, curpe)
+                if pvsize == clampedSize:
+                    # This is a corner case were we say that the available size of the VG
+                    # is the total size of the paritition.  Given that the pvs need metadata
+                    # it is better to be on the safe side and give ourselves on pe of extra
+                    # space.
+                    clampedSize = clampedSize - (curpe / 1024)
+
+                availSpaceMB = availSpaceMB + clampedSize
 
         log.debug("computeVGSize: vgsize is %s" % (availSpaceMB,))
-	return availSpaceMB
+        return availSpaceMB
 
     def computeLVSpaceNeeded(self, logreqs, pesize):
 	neededSpaceMB = 0
diff --git a/partRequests.py b/partRequests.py
index 241dd39..5c1b934 100644
--- a/partRequests.py
+++ b/partRequests.py
@@ -836,6 +836,13 @@ class VolumeGroupRequestSpec(RequestSpec):
                 pvreq = partitions.getRequestByID(pvid)
                 size = pvreq.getActualSize(partitions, diskset)
                 clamped = lvm.clampPVSize(size, self.pesize)
+                if size == clamped:
+                    # This is a corner case were we say that the available size of the VG
+                    # is the total size of the paritition.  Given that the pvs need metadata
+                    # it is better to be on the safe side and give ourselves on pe of extra
+                    # space.  This code is repeated in iw/lvm_dialog_gui.py.
+                    clamped = clamped - (self.pesize / 1024)
+
                 log.debug("  got pv.size of %s, clamped to %s" % (size,clamped))
                 totalspace = totalspace + clamped
             log.debug("  total space: %s" % (totalspace,))
-- 
1.5.6.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