Merge pull request #3083 from mvo5/feature/facts-add-statvfs
add "size_{total,free}" to the "mount" facts
This commit is contained in:
commit
373e4ee7d4
1 changed files with 10 additions and 1 deletions
11
system/setup
11
system/setup
|
@ -539,7 +539,16 @@ class LinuxHardware(Hardware):
|
|||
for line in mtab.split('\n'):
|
||||
if line.startswith('/'):
|
||||
fields = line.rstrip('\n').split()
|
||||
self.facts['mounts'].append({'mount': fields[1], 'device':fields[0], 'fstype': fields[2], 'options': fields[3]})
|
||||
statvfs_result = os.statvfs(fields[1])
|
||||
self.facts['mounts'].append(
|
||||
{'mount': fields[1],
|
||||
'device':fields[0],
|
||||
'fstype': fields[2],
|
||||
'options': fields[3],
|
||||
# statvfs data
|
||||
'size_total': statvfs_result.f_bsize * statvfs_result.f_blocks,
|
||||
'size_available': statvfs_result.f_bsize * (statvfs_result.f_bavail),
|
||||
})
|
||||
|
||||
def get_device_facts(self):
|
||||
self.facts['devices'] = {}
|
||||
|
|
Loading…
Reference in a new issue