-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LVM resize fails with calculation error - pv metadata unaccounted for #1320
Comments
I've noticed an inconsistency in how blivet reports the size of the underlying pv. The blivet vg size property appears to reach straight back to read the size of the underlying block device read_current_size and subtracts only the volume group metadata, completely ignoring the pv metadata (and any unusable blocks) If I subtract a total of 8 MiB (4 MiB for pv metadata + 4 MiB for vg metadata) from 10 GiB, the math adds up: >>> pv.size - vg.lvm_metadata_space*2
Size (9.9921875 GiB)
>>> pv.size - vg.lvm_metadata_space*2 == lv.size
True I would expect pvs to be handled by blivet with similar properties to other lvm objects, with an accounting for metadata, but it appears they are handled as DiskDevice type objects. >>> vg.lvm_metadata_space
Size (4 MiB)
>>> pv.lvm_metadata_space
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'DiskDevice' object has no attribute 'lvm_metadata_space' |
Hi, thank you for the report. First of all I am not saying there is no bug the code or that our calculation of metadata sizes in LVM is perfect. I know it's not and we had more than a few issues with it in the past. There is one problem with your example -- you are not supposed to call the
That's not how the The reason for this is that The question is why
In our code there is a difference between size and free space. For VG the size is the sum of the PV sizes minus the PV metadata calculated in
Because the device itself is disk, the format is LVM PV so for LVM PV specific values you need to look at The low level API in blivet (especially for LVM) is horribly complicated. The upper level API (helper functions in the But all the complicated explanations above aside -- we definitely do have a bug somewhere, because we think there is one free extent in your VG ( Can you please share the entire blivet log from your system? If you run the code below it will save the log to from blivet import util
util.set_up_logging()
import blivet; b=blivet.Blivet(); b.reset() if you don't want to share the entire log publicly you can send it to me to |
I have been troubleshooting the use of this library in the ansible linux-system-roles collection and have traced an issue with the resizing capabilities to what I believe to be a size calculation bug in blivet. I searched the issues and didn't see anything related, so I'm opening this here.
Note: I first encountered this bug while trying to use blivet to resize a logical volume (after resizing the underlying disk) but have been able to reproduce the issue by simply calling the
LVMLogicalVolumeDevice.resize()
method even when there is no extra space available.Expected behaviors:
resize
method with unallocated PEs in the parent volume group will expand the logical volume to fill those unallocated PEsresize
method with no unallocated PEs in the parent volume group will see that the logical volume and volume groups sizes already match and return something indicating there are no available extentsActual behavior:
LVM specs:
Server OS: RHEL 9.2
The text was updated successfully, but these errors were encountered: