Commit 5bba4803 by Guba Sándor

refactoring storage function names delegate create and snapshot

parent f32bb4ec
...@@ -132,11 +132,19 @@ class Disk(TimeStampedModel): ...@@ -132,11 +132,19 @@ class Disk(TimeStampedModel):
'dir': self.datastore.path, 'dir': self.datastore.path,
'format': self.format, 'format': self.format,
'size': self.size, 'size': self.size,
'base_name': self.base.name if self.base else None, 'base_name': self.base.filename if self.base else None,
'type': 'snapshot' if self.type == 'qcow2-snap' else 'normal' 'type': 'snapshot' if self.type == 'qcow2-snap' else 'normal'
} }
remote_tasks.create_disk.apply_async(
args=[disk_desc], queue=self.datastore.hostname + ".storage").get() # Delegate create / snapshot jobs
if self.type == 'qcow2-snap':
remote_tasks.snapshot.apply_async(
args=[disk_desc],
queue=self.datastore.hostname + ".storage").get()
else:
remote_tasks.create.apply_async(
args=[disk_desc],
queue=self.datastore.hostname + ".storage").get()
self.ready = True self.ready = True
self.save() self.save()
return True return True
......
from manager.mancelery import celery from manager.mancelery import celery
@celery.task(name='storagedriver.list_disks') @celery.task(name='storagedriver.list')
def list_disks(dir): def list(dir):
pass pass
@celery.task(name='storagedriver.create_disk') @celery.task(name='storagedriver.create')
def create_disk(disk_desc): def create(disk_desc):
pass pass
@celery.task(name='storagedriver.delete_disk') @celery.task(name='storagedriver.delete')
def delete_disk(json_data): def delete(json_data):
pass pass
@celery.task(name='storagedriver.get_disk') @celery.task(name='storagedriver.snapshot')
def get_disk(json_data): def snapshot(json_data):
pass
@celery.task(name='storagedriver.get')
def get(json_data):
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