From c87d84f5b8b222de737a249657fd8dfa6509f013 Mon Sep 17 00:00:00 2001 From: Peter Oliver Date: Fri, 9 Sep 2016 22:39:39 +0100 Subject: [PATCH] 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. --- lib/ansible/module_utils/facts.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index d740efc037..325f5a9931 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -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