[PATCH rhel 5.4] Reserve enough space for lvm metadata when computing PV size usable for LVs (#500431)

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

 



This is port of patch which went in RHEL 4.9. Up to now we reserved one more
PE for metadata if PV size was equal to clamped size (too narrow). With the
patch, we reserve one more PE if clamping itself would reserve less than 1MB.

The patch is tested and the bug is exception.

---
 iw/lvm_dialog_gui.py |    8 +++-----
 partRequests.py      |    8 +++-----
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/iw/lvm_dialog_gui.py b/iw/lvm_dialog_gui.py
index c571146..b10d7eb 100644
--- a/iw/lvm_dialog_gui.py
+++ b/iw/lvm_dialog_gui.py
@@ -827,11 +827,9 @@ class VolumeGroupEditor:
                 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.
+                if long(pvsize) == clampedSize:
+                    # If clamping reserves only less than 1MB for lvm metadata,
+                    # reserve one more PE.
                     clampedSize = clampedSize - (curpe / 1024)
 
                 availSpaceMB = availSpaceMB + clampedSize
diff --git a/partRequests.py b/partRequests.py
index 657e62d..0ae6b74 100644
--- a/partRequests.py
+++ b/partRequests.py
@@ -840,11 +840,9 @@ 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.
+                if long(size) == clamped:
+                    # If clamping reserves only less than 1MB for lvm metadata,
+                    # reserve one more PE.
                     clamped = clamped - (self.pesize / 1024)
 
                 log.debug("  got pv.size of %s, clamped to %s" % (size,clamped))
-- 
1.6.0.6

_______________________________________________
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