Commit 5bba4803 by Guba Sándor

refactoring storage function names delegate create and snapshot

parent f32bb4ec
......@@ -132,11 +132,19 @@ class Disk(TimeStampedModel):
'dir': self.datastore.path,
'format': self.format,
'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'
}
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.save()
return True
......
from manager.mancelery import celery
@celery.task(name='storagedriver.list_disks')
def list_disks(dir):
@celery.task(name='storagedriver.list')
def list(dir):
pass
@celery.task(name='storagedriver.create_disk')
def create_disk(disk_desc):
@celery.task(name='storagedriver.create')
def create(disk_desc):
pass
@celery.task(name='storagedriver.delete_disk')
def delete_disk(json_data):
@celery.task(name='storagedriver.delete')
def delete(json_data):
pass
@celery.task(name='storagedriver.get_disk')
def get_disk(json_data):
@celery.task(name='storagedriver.snapshot')
def snapshot(json_data):
pass
@celery.task(name='storagedriver.get')
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