Commit c77c627d by Fukász Rómeó Ervin

dashboard, storage: add new attribute to storage task, change trash in storage detail

parent 57ce6e25
Pipeline #631 passed with stage
in 0 seconds
...@@ -267,13 +267,19 @@ class StorageDetail(SuperuserRequiredMixin, UpdateView): ...@@ -267,13 +267,19 @@ class StorageDetail(SuperuserRequiredMixin, UpdateView):
# file stats # file stats
data = self.get_object().get_file_statistics() data = self.get_object().get_file_statistics()
disk_names = [d['name'] for d in data['disks']]
destroyed_filenames = [d.filename for d
in Disk.objects.filter(
filename__in=disk_names, destroyed=None)]
disks = [d for d in data['disks']
if d['name'] not in destroyed_filenames]
trash = [d for d in data['disks'] if d not in disks]
dumps_size = sum(d['size'] for d in data['dumps']) dumps_size = sum(d['size'] for d in data['dumps'])
trash = sum(d['size'] for d in data['trash']) iso_raw = sum(d['size'] for d in disks
iso_raw = sum(d['size'] for d in data['disks']
if d['format'] in ("iso", "raw")) if d['format'] in ("iso", "raw"))
vm_size = vm_actual_size = template_actual_size = 0 vm_size = vm_actual_size = template_actual_size = 0
for d in data['disks']: for d in disks:
if d['format'] == "qcow2" and d['type'] == "normal": if d['format'] == "qcow2" and d['type'] == "normal":
template_actual_size += d['actual_size'] template_actual_size += d['actual_size']
else: else:
......
...@@ -197,7 +197,7 @@ class DataStore(Model): ...@@ -197,7 +197,7 @@ class DataStore(Model):
def get_file_statistics(self, timeout=30): def get_file_statistics(self, timeout=30):
queue_name = self.get_remote_queue_name('storage', "slow") queue_name = self.get_remote_queue_name('storage', "slow")
data = storage_tasks.get_file_statistics.apply_async( data = storage_tasks.get_file_statistics.apply_async(
args=[self.path], queue=queue_name).get(timeout=timeout) args=[self.type, self.path], queue=queue_name).get(timeout=timeout)
return data return data
......
...@@ -79,5 +79,5 @@ def get_storage_stat(data_store_type, path): ...@@ -79,5 +79,5 @@ def get_storage_stat(data_store_type, path):
@celery.task(name='storagedriver.get_file_statistics') @celery.task(name='storagedriver.get_file_statistics')
def get_file_statistics(datastore): def get_file_statistics(data_store_type, path_or_pool):
pass pass
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