1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Filesystem blocks are of size f_frsize (#17493)

The statvfs(3) manpage on Linux states that `f_blocks` is the "size of fs in `f_frsize` units".  The manpages on Solaris and AIX state something similar.

With ext4 on Linux, I suspect that `f_bsize` and `f_frsize` are always identical, masking this error.  On Solaris, the sizes differ for each of ufs, vxfs and zfs causing the `size_available` and `size_total` facts to be set incorrectly on this OS.
This commit is contained in:
Peter Oliver 2016-09-09 22:39:39 +01:00 committed by Brian Coca
parent a3028783d4
commit c87d84f5b8

View file

@ -581,8 +581,8 @@ class Facts(object):
size_available = None
try:
statvfs_result = os.statvfs(mountpoint)
size_total = statvfs_result.f_bsize * statvfs_result.f_blocks
size_available = statvfs_result.f_bsize * (statvfs_result.f_bavail)
size_total = statvfs_result.f_frsize * statvfs_result.f_blocks
size_available = statvfs_result.f_frsize * (statvfs_result.f_bavail)
except OSError:
pass
return size_total, size_available