Commit 1e70ee0c by Czémán Arnold

dashboard, storage: minimal rework of StorageDetail view for multi data store mode

parent 3dc284a9
......@@ -84,9 +84,6 @@ class StorageDetail(SuperuserRequiredMixin, UpdateView):
form_class = DataStoreForm
template_name = "dashboard/storage/detail.html"
def get_object(self):
return DataStore.get_default_datastore()
def get_context_data(self, **kwargs):
context = super(StorageDetail, self).get_context_data(**kwargs)
......
......@@ -133,7 +133,7 @@ class DataStore(Model):
"""
queue_name = self.get_remote_queue_name('storage', "slow")
files = set(storage_tasks.list_files.apply_async(
args=[self.path], queue=queue_name).get(timeout=timeout))
args=[self.type, self.path], queue=queue_name).get(timeout=timeout))
disks = set([disk.filename for disk in self.disk_set.all()])
orphans = []
......@@ -148,8 +148,9 @@ class DataStore(Model):
"""
queue_name = self.get_remote_queue_name('storage', "slow")
files = set(storage_tasks.list_files.apply_async(
args=[self.path], queue=queue_name).get(timeout=timeout))
disks = Disk.objects.filter(destroyed__isnull=True, is_ready=True)
args=[self.type, self.path], queue=queue_name).get(timeout=timeout))
disks = Disk.objects.filter(destroyed__isnull=True, is_ready=True,
datastore=self)
return disks.exclude(filename__in=files)
@classmethod
......
......@@ -64,7 +64,7 @@ def list_orphan_disks(timeout=15):
for ds in DataStore.objects.all():
queue_name = ds.get_remote_queue_name('storage', "slow")
files = set(storage_tasks.list_files.apply_async(
args=[ds.path], queue=queue_name).get(timeout=timeout))
args=[ds.type, ds.path], queue=queue_name).get(timeout=timeout))
disks = set([disk.filename for disk in ds.disk_set.all()])
for i in files - disks:
if not re.match('cloud-[0-9]*\.dump', i):
......@@ -81,7 +81,7 @@ def list_missing_disks(timeout=15):
for ds in DataStore.objects.all():
queue_name = ds.get_remote_queue_name('storage', "slow")
files = set(storage_tasks.list_files.apply_async(
args=[ds.path], queue=queue_name).get(timeout=timeout))
args=[ds.type, ds.path], queue=queue_name).get(timeout=timeout))
disks = set([disk.filename for disk in
ds.disk_set.filter(destroyed__isnull=True)])
for i in disks - files:
......
......@@ -19,12 +19,12 @@ from manager.mancelery import celery
@celery.task(name='storagedriver.list')
def list(dir):
def list(data_store_type, dir):
pass
@celery.task(name='storagedriver.list_files')
def list_files(dir):
def list_files(data_store_type, dir):
pass
......@@ -54,7 +54,7 @@ def snapshot(disk_desc):
@celery.task(name='storagedriver.get')
def get(path):
def get(json_data):
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