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} labels = {VOLUME_ID: volume_id}
dev_stat = img_file.stat() dev_stat = img_file.stat()
dev_size.labels(**labels).set(dev_stat.st_size) dev_size.labels(**labels).set(dev_stat.st_size)
dev_free.labels(**labels).set( dev_free.labels(**labels).set(dev_stat.st_size - dev_stat.st_blocks * 512)
dev_stat.st_size - dev_stat.st_blocks * dev_stat.st_blksize
)
for dev in attached_loops(img_file): for dev in attached_loops(img_file):
mountpoint = dev_to_mountpoint(dev) mountpoint = dev_to_mountpoint(dev)
if mountpoint is None: if mountpoint is None: