Commit ce0146cf by Guba Sándor

storagedriver: added free disk space function fixes #1

parent 14485710
from disk import Disk
from storagecelery import celery
from os import path, unlink
from os import path, unlink, statvfs
@celery.task()
def list(dir):
......@@ -42,3 +43,10 @@ def merge(old_json, new_json):
def get(json_data):
disk = Disk.get(dir=json_data['dir'], name=json_data['name'])
return disk.get_desc()
@celery.task()
def get_free_space(path):
''' Return free disk space avaliable at path in bytes.'''
s = statvfs()
return s.f_bavail * s.f_frsize
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