More statvfs info for mount facts rebase 12073 (#25454)

* Add more mount point statvfs info including sizes

Based on https://github.com/ansible/ansible/pull/12073

facts.utils.get_mount_size() now returns a dict of most
of the posix statvfs data, including block_size and inode
counts.

Update the facts.hardware classes that use get_mount_size() to
use the new info by mount_info.update(mount_statvfs_inof) to merge.

* add back unit tests for LinuxHardware mount/fs facts

* add test cases for facts.utils.get_mount_size
This commit is contained in:
Adrian Likins 2017-06-13 15:31:41 -04:00 committed by GitHub
parent 3bba43a487
commit 56b7483b85
10 changed files with 591 additions and 46 deletions

View file

@ -428,7 +428,7 @@ class LinuxHardware(Hardware):
if fstype == 'none':
continue
size_total, size_available = get_mount_size(mount)
mount_statvfs_info = get_mount_size(mount)
if mount in bind_mounts:
# only add if not already there, we might have a plain /etc/mtab
@ -439,11 +439,10 @@ class LinuxHardware(Hardware):
'device': device,
'fstype': fstype,
'options': options,
# statvfs data
'size_total': size_total,
'size_available': size_available,
'uuid': uuids.get(device, 'N/A')}
mount_info.update(mount_statvfs_info)
mounts.append(mount_info)
mount_facts['mounts'] = mounts