Commit d8650c62 by Dudás Ádám

vm, storage: reorder and add comments to *_async methods

parent 7b28a03d
......@@ -113,9 +113,6 @@ class Disk(TimeStampedModel):
def __unicode__(self):
return u"%s (#%d)" % (self.name, self.id)
def deploy_async(self):
local_tasks.deploy.apply_async(self)
def deploy(self):
"""Reify the disk model on the associated data store.
......@@ -143,6 +140,11 @@ class Disk(TimeStampedModel):
self.save()
return True
def deploy_async(self):
"""Execute deploy asynchronously.
"""
local_tasks.deploy.apply_async(self)
def delete(self):
# TODO
# StorageDriver.delete_disk.delay(instance.to_json()).get()
......
......@@ -476,12 +476,6 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
'raw_data': "" if not self.raw_data else self.raw_data
}
def deploy_async(self, user=None):
""" Launch celery task to handle the job asynchronously.
"""
local_tasks.deploy.apply_async(args=[self, user],
queue="localhost.man")
def deploy(self, user=None, task_uuid=None):
""" Deploy new virtual machine with network
1. Schedule
......@@ -521,8 +515,11 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
act.finish(result='SUCCESS')
def stop_async(self, user=None):
local_tasks.stop.apply_async(args=[self, user], queue="localhost.man")
def deploy_async(self, user=None):
"""Execute deploy asynchronously.
"""
local_tasks.deploy.apply_async(args=[self, user],
queue="localhost.man")
def stop(self, user=None, task_uuid=None):
act = InstanceActivity(activity_code='vm.Instance.stop')
......@@ -535,9 +532,10 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
remote_tasks.stop.apply_async(args=[self.get_vm_desc()],
queue=queue_name).get()
def resume_async(self, user=None):
local_tasks.resume.apply_async(args=[self, user],
queue="localhost.man")
def stop_async(self, user=None):
"""Execute stop asynchronously.
"""
local_tasks.stop.apply_async(args=[self, user], queue="localhost.man")
def resume(self, user=None, task_uuid=None):
act = InstanceActivity(activity_code='vm.Instance.resume')
......@@ -550,8 +548,10 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
remote_tasks.resume.apply_async(args=[self.vm_name],
queue=queue_name).get()
def poweroff_async(self, user=None):
local_tasks.power_off.apply_async(args=[self, user],
def resume_async(self, user=None):
"""Execute resume asynchronously.
"""
local_tasks.resume.apply_async(args=[self, user],
queue="localhost.man")
def poweroff(self, user=None, task_uuid=None):
......@@ -565,8 +565,10 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
remote_tasks.power_off.apply_async(args=[self.get_vm_desc()],
queue=queue_name).get()
def restart_async(self, user=None):
local_tasks.restart.apply_async(args=[self, user],
def poweroff_async(self, user=None):
"""Execute poweroff asynchronously.
"""
local_tasks.power_off.apply_async(args=[self, user],
queue="localhost.man")
def restart(self, user=None, task_uuid=None):
......@@ -580,8 +582,10 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
remote_tasks.restart.apply_async(args=[self.get_vm_desc()],
queue=queue_name).get()
def save_as_async(self, user=None):
local_tasks.save_as.apply_async(args=[self, user],
def restart_async(self, user=None):
"""Execute restart asynchronously.
"""
local_tasks.restart.apply_async(args=[self, user],
queue="localhost.man")
def save_as(self, user=None, task_uuid=None):
......@@ -595,6 +599,12 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
remote_tasks.save_as.apply_async(args=[self.get_vm_desc()],
queue=queue_name).get()
def save_as_async(self, user=None):
"""Execute save_as asynchronously.
"""
local_tasks.save_as.apply_async(args=[self, user],
queue="localhost.man")
def renew(self, which='both'):
"""Renew virtual machine instance leases.
"""
......
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