Commit 41d42a18 by Guba Sándor

driver: added move_to_trash function

parent 24e73171
......@@ -79,3 +79,15 @@ def get_storage_stat(path):
free_space_percent = 100.0 * free_space / all_space
return {'free_space': free_space,
'free_percent': free_space_percent}
@celery.task
def move_to_trash(datastore, disk_name):
''' Move path to the trash directory.
'''
trash_path = path.join(datastore, trash_directory)
disk_path = path.join(datastore, disk_name)
if not path.isdir(trash_path):
mkdir(trash_path)
#TODO: trash dir configurable?
move(disk_path, trash_path)
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