Commit 4dd90cb8 by Fukász Rómeó Ervin

Merge branch 'master' into ceph

parents 729c191a faf064b5
......@@ -223,7 +223,7 @@ class Disk(object):
try:
with open(disk_path, 'wb') as f:
for chunk in r.iter_content(chunk_size=chunk_size):
if ext in ('gz', 'bz'):
if ext in ('gz', 'bz2'):
chunk = decompressor.decompress(chunk)
f.write(chunk)
actsize = f.tell()
......
......@@ -127,6 +127,26 @@ def get_storage_stat(data_store_type, path):
'free_percent': free_space_percent}
@celery.task()
def get_file_statistics(datastore):
disks = [Disk.get(datastore, name).get_desc()
for name in listdir(datastore)
if not name.endswith(".dump") and
not path.isdir(path.join(datastore, name))]
dumps = [{'name': name,
'size': path.getsize(path.join(datastore, name))}
for name in listdir(datastore) if name.endswith(".dump")]
trash = [{'name': name,
'size': path.getsize(path.join(datastore, trash_directory,
name))}
for name in listdir(path.join(datastore, trash_directory))]
return {
'dumps': dumps,
'trash': trash,
'disks': disks,
}
@celery.task
def exists(data_store_type, path, disk_name):
''' Recover named disk from the trash directory.
......
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