[master 4/6] Fix VG free space check when shrinking an LV

vpodzime installerbot-noreply at redhat.com
Wed Aug 19 13:51:07 UTC 2015


From: Vratislav Podzimek <vpodzime at redhat.com>

Shrinking means that there is an LV that fits into the VG (otherwise it cannot
exist) and thus we can skip the check for maximum size according to the current
size and VG's free space.
---
 blivet/devices/lvm.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/blivet/devices/lvm.py b/blivet/devices/lvm.py
index c75ccdf..189a1bd 100644
--- a/blivet/devices/lvm.py
+++ b/blivet/devices/lvm.py
@@ -616,10 +616,10 @@ def _setSize(self, size):
         log.debug("trying to set lv %s size to %s", self.name, size)
         # Don't refuse to set size if we think there's not enough space in the
         # VG for an existing LV, since it's existence proves there is enough
-        # space for it.
+        # space for it. A similar reasoning applies to shrinking the LV.
         if not self.exists and \
            not isinstance(self, LVMThinLogicalVolumeDevice) and \
-           size > self.vg.freeSpace + self.vgSpaceUsed:
+           size > self.size and size > self.vg.freeSpace + self.vgSpaceUsed:
             log.error("failed to set size: %s short", size - (self.vg.freeSpace + self.vgSpaceUsed))
             raise ValueError("not enough free space in volume group")
 


-- 
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/67b04190f4bc02db76a1000cf38348a3e33fcbfe


More information about the anaconda-patches mailing list