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

Re: [PATCH] Lets make sure to use the Volume Group size getter function (#468944).



Joel Granados Moreno wrote:

Hi Joel,
the ways of lvm size computations are dark and twisted, I think
the patch would break computing of clamped PV size based on
non-default PE size chosen by user in UI.

When creating new volume group, origrequest is instance of VolumeGroupRequestSpec
with default physical extent size. In VG editor, user can change physical
extent size in combox, that is why the patched method takes curpe argument
that passes the selected value.
With the patch, origvgrequest.getActualSize would use default value of origrequest.pesize
(not reflecting actual UI setting) when calling lvm.clampPVSize.

---
 iw/lvm_dialog_gui.py |   13 +++----------
 1 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/iw/lvm_dialog_gui.py b/iw/lvm_dialog_gui.py
index 8b40890..8efd96e 100644
--- a/iw/lvm_dialog_gui.py
+++ b/iw/lvm_dialog_gui.py
@@ -818,17 +818,10 @@ class VolumeGroupEditor:
 	return pv
def computeVGSize(self, pvlist, curpe):
here curpe contains user's choice of physical extension size in UI
-	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)
pv size is clamped according to curpe
-
-	    availSpaceMB = availSpaceMB + pvsize
-
+        import pdb; pdb.set_trace()
+        availSpaceMB = self.origvgrequest.getActualSize(self.partitions, self.diskset)
         log.debug("computeVGSize: vgsize is %s" % (availSpaceMB,))
pv size is clamped in getActualSize call according to origvgrequest.pesize which
is not updated with user's choices in UI combobox.
-	return availSpaceMB
+        return availSpaceMB
def computeLVSpaceNeeded(self, logreqs, pesize):
 	neededSpaceMB = 0

The logic of computing of VG size in patched method seem same as in
origvgrequest.getActualSize to me, only the pesize used to clamp PV sizes
makes difference.

Radek


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