[DRBD-user] drbd9: drbdmanage.storage.lvm_thinlv.LvmThinLv plugin - free space calculation still wrong (drbdmanage update-pool)

Alexander Barton alex at barton.de
Wed Oct 11 14:57:07 CEST 2017

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


Hi!

Am 09.10.2017 um 15:35 schrieb Robert Altnoeder <robert.altnoeder at linbit.com>:

>On 10/09/2017 11:04 AM, Roberto Resoli wrote:
>
>> I currently remove snap_percent from used space in "update_pool"
>> function inside
>>
>> /usr/lib/python2.7/dist-packages/drbdmanage/storage/lvm_thinlv.py
>It is quite interesting that you even get any values in this column that
>could then mess up your results.
>I just tested this on three different installations (Debian 8, Ubuntu
>16.04, CentOS 7.3), and none of them even reports any values for the
>snap_percent field, neither for the thinpool nor for any volumes or
>snapshots inside the pool.
>
>We are still trying to figure out what LVM is supposed to report for
>which one of all those values.

We are seeing the same problem here and are applying the patch below
to all of our installations.

Regards
Alex


Patch for: python-drbdmanage 0.99.11-1

Don't add "snap_percent" to "data_percent", the latter already includes the
space occupied by snapshots.

Apply with:
  patch -d / -p0 <drbdmanage-lvm_thinlv.patch

References:
- https://forum.proxmox.com/threads/36669
- https://bugzilla.proxmox.com/show_bug.cgi?id=1493#c2

2017-09-20, abarton at thomas-daily.de

--- /usr/lib/python2.7/dist-packages/drbdmanage/storage/lvm_thinlv.py.orig	2017-09-14 16:02:45.000000000 +0200
+++ /usr/lib/python2.7/dist-packages/drbdmanage/storage/lvm_thinlv.py	2017-09-20 17:09:19.189418160 +0200
@@ -235,7 +235,7 @@
                 self._cmd_lvs, "--noheadings", "--nosuffix",
                 "--units", "k", "--separator", ",",
                 "--options",
-                "size,data_percent,snap_percent",
+                "size,data_percent",
                 self._conf[consts.KEY_VG_NAME] + "/" +
                 self._conf[LvmThinLv.KEY_POOL_NAME]
             ]
@@ -249,7 +249,7 @@
             if len(pool_data) > 0:
                 pool_data.strip()
                 try:
-                    size_data, data_part, snap_part = (
+                    size_data, data_part = (
                         pool_data.split(",")
                     )
                     size_data = self.discard_fraction(size_data)
@@ -263,21 +263,10 @@
                         except ValueError:
                             pass

-                    # Snapshots percentage
-                    snap_perc = float(0)
-                    if len(snap_part) > 0:
-                        try:
-                            snap_perc = float(snap_part) / 100
-                        except ValueError:
-                            pass
-
                     # Calculate the amount of occupied space
                     data_used = data_perc * space_size
-                    snap_used = snap_perc * space_size
-
-                    space_used = data_used + snap_used

-                    space_free = int(space_size - space_used)
+                    space_free = int(space_size - data_used)
                     if space_free < 0:
                         space_free = 0



More information about the drbd-user mailing list