Commit db3ffeb2 by tarokkk

local celery manager for tracking tasks

parent f3cf1fb8
#!/usr/bin/env python #!/usr/bin/env python
from mancelery import celery from mancelery import celery
from celery import current_task
import scheduler
@celery.task @celery.task
def create_vm(): def deploy(instance):
'''Create new virtual machine from VM class. '''Create new virtual machine from VM class.
''' '''
# Get info from scheduler (free sapce, node with enough cpu and ram) # Get info from scheduler (free space, node with enough cpu and ram)
current_task.update_state(state='PENDING')
instance.node = scheduler.get_node()
# Create hard drives (storage) # Create hard drives (storage)
current_task.update_state(state='PREPARE')
for disk in instance.disks:
disk.deploy()
# Create context
instance.create_context()
# Create machine (vmdriver) # Create machine (vmdriver)
current_task.update_state(state='DEPLOY VM')
instance.deploy_task()
# Estabilish network connection (vmdriver) # Estabilish network connection (vmdriver)
current_task.update_state(state='DEPLOY NET')
instance.deploy_net()
# Resume machine (vmdriver) # Resume machine (vmdriver)
current_task.update_state(state='BOOT')
instance.resume()
pass pass
...@@ -39,3 +57,7 @@ def restart(): ...@@ -39,3 +57,7 @@ def restart():
def reset(): def reset():
pass pass
def migrate():
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