Hardcode block size as 512 instead of using blksize!

See: https://stackoverflow.com/a/3212102/585678
See: https://stackoverflow.com/a/12952830/585678
This commit is contained in:
Mehran Kholdi 2020-04-26 00:40:53 +04:30
parent 9deaefc203
commit 974ad321a9

View File

@ -39,9 +39,7 @@ def collect_stats():
labels = {VOLUME_ID: volume_id}
dev_stat = img_file.stat()
dev_size.labels(**labels).set(dev_stat.st_size)
dev_free.labels(**labels).set(
dev_stat.st_size - dev_stat.st_blocks * dev_stat.st_blksize
)
dev_free.labels(**labels).set(dev_stat.st_size - dev_stat.st_blocks * 512)
for dev in attached_loops(img_file):
mountpoint = dev_to_mountpoint(dev)
if mountpoint is None: