Commit 24e73171 by Guba Sándor

driver: added get_storage_stat function

parent d9210dd5
......@@ -71,7 +71,11 @@ def get(json_data):
@celery.task()
def get_free_space(path):
''' Return free disk space avaliable at path in bytes.'''
def get_storage_stat(path):
''' Return free disk space avaliable at path in bytes and percent.'''
s = statvfs(path)
return s.f_bavail * s.f_frsize
all_space = s.f_bsize * s.f_blocks
free_space = s.f_bavail * s.f_frsize
free_space_percent = 100.0 * free_space / all_space
return {'free_space': free_space,
'free_percent': free_space_percent}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment