Hide Forgot
Created attachment 814560 [details] reproducer Description of problem: Let's consider this setup: $ vgcreate test /dev/sdb1 $ lvcreate -l 2 -n 00 test $ vgdisplay --- Volume group --- VG Name test System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 4 VG Access read/write VG Status resizable MAX LV 0 Cur LV 1 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size 92.00 MiB PE Size 4.00 MiB Total PE 23 Alloc PE / Size 2 / 8.00 MiB Free PE / Size 21 / 84.00 MiB VG UUID NJA1Qr-yf3e-7WVU-5bHj-Q3mZ-1yEL-5FMQXr So, 2 extents are used, 21 extents are free. But blivet reports 23 free extents: LVMVolumeGroupDevice instance (0x2925590) -- ... format args = [] originalFormat = None target = None dmUuid = None free = 84.0 PE Size = 4.0 PE Count = 23 PE Free = 21 PV Count = 1 ^^^^ LV Names = ['00'] modified = False extents = 23.0 free space = 92 free extents = 23.0 reserved percent = 0 reserved space = 0 ^^^^^ vg.freeExtents = 23 vg.peFree = 21 OpenLMI has used freeExtents so far, is there some API change and should we switch to peFree? In the reproducer debug logs I can see LVMLogicalVolumeDevice printed once with parent LVMVolumeGroupDevice.free extents = 21.0 and once with free extents = 23.0; something has changed it in the meantime. Version-Release number of selected component: python-blivet-0.18.7-1.el7.noarch (python-blivet-0.18.6-1.el7.noarch works fine) This bug applies also to rawhide.
peFree is taken directly from lvm and does not get updated without a reset. freeExtents is blivet doing its best to guess how many extents are free based on what it knows about how lvm uses space in the vg. Normally if this number is wrong it is showing too few free extents, so this is puzzling. I'll take a look at the reproducer.
So, peFree is set during discovery from udev info, and not used anywhere, AFAICT. freeExtents is just freeSpace/peSize rounded to the nearest whole number. 100 to 1 freeSpace is the culprit, since peSize really ought not to move around much. To get this right, free space should be less than 88 but it is at least 92 and probably no more. Just looking at probabilities, it seems unlikely that the vg.size is too big, more likely that the things subtracted from it are too small.
Could you verify that this is still occurring? I ran a test in current rhel7 and the free extents calculated by blivet for the vg matched those reported by vgdisplay. If you can still reproduce it can you give more specifics about /dev/sdb1 and include logs? Thanks!
Tested today with python-blivet-0.61.0.3-1.el7.noarch from brew, it seems to be fixed. vg.freeExtents and vg.peFree are consistent now.
I checked with python-blivet-0.61.0.20-1.el7.noarch that peFree and freeExtents are the same on my system. They get different when an LV is created (as comment #2 says, this is expected) and they get the same after blivet.reset(). So, from OpenLMI point of view, the bug is fixed.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2015-0313.html