[DRBD-user] drbdmanage, lvm thinlv, wrong free pool space calculation

Roberto Resoli roberto at resolutions.it
Thu May 19 12:48:00 CEST 2016

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


Il 12/05/2016 17:58, Gaudenz Steinlin ha scritto:
> 
> Hi

Hi

> I ran into the same problem someone 
> else previously reported here today:
> http://lists.linbit.com/pipermail/drbd-user/2016-May/022909.html

that's me, and others before

> I then looked into the code to better understand how drbdmanage
> calculates the free space and discocered that the code makes wrong
> assumptions about how lvmthin metadata allocation works. As described in
> the lvmthin(7) manpage a thin pool lv actually consists of 2 hidden
> lv's, one for the actual data and another much smaller one for metadata.
> 
> But the code in storage/lvm_thinlv.py calculates the free space as
> 
> total_space - %data_used*total_space - %metadata_used*total_space - %snap_used*total_space
> 
> Where total_space is the size of the data LV on the thin pool lv.
> 
> This is wrong because metadata is not allocated from the data lv and
> should not be considered in this calculation. I had a thin pool which
> was 50% full and the metadata was also 50% which resulted in 0 free
> space :-(. See below for the actual relevant code.
> 
> IMO the free space should be calculated without even considering
> metadata space used. If you want to make sure that there is enough
> metadata space available this needs to be done in a separate
> calculation.
> 
> I verified that removing meta_used on line 285 solves the problem and
> drbdmanage then reports the correct free space.

You are right, imho.

In my case total data space is 1,6TB , total metadata size is 100MB.

It doesn't make sense to apply metadata percentage to total data size.

The code you are quoting is taken from the update_pool function that
recalculates free space (drbdmanage update-pool), and appears to be the
same inside the current version form package drbdmanage 0.95-1 inside
current pve 4.2:

It is still the same code inside latest drbdmanage upstream (
http://www.drbd.org/download/drbdmanage/drbdmanage-0.95.tar.gz )

bye,
rob




More information about the drbd-user mailing list