Commit 41ec590a by Bach Dániel

vm: add new agent tasks

parent 1c558830
...@@ -41,3 +41,13 @@ def set_hostname(vm, time): ...@@ -41,3 +41,13 @@ def set_hostname(vm, time):
@celery.task(name='agent.mount_store') @celery.task(name='agent.mount_store')
def mount_store(vm, host, username, password): def mount_store(vm, host, username, password):
pass pass
@celery.task(name='agent.cleanup')
def cleanup(vm):
pass
@celery.task(name='agent.start_ssh')
def start_ssh(vm):
pass
...@@ -17,13 +17,16 @@ ...@@ -17,13 +17,16 @@
from manager.mancelery import celery from manager.mancelery import celery
from vm.tasks.agent_tasks import (restart_networking, change_password, from vm.tasks.agent_tasks import (restart_networking, change_password,
set_time, set_hostname) set_time, set_hostname, start_ssh,
cleanup)
import time import time
def send_init_commands(instance, act, vm): def send_init_commands(instance, act, vm):
queue = instance.get_remote_queue_name("agent") queue = instance.get_remote_queue_name("agent")
with act.sub_activity('cleanup'):
cleanup.apply_async(queue=queue, args=(vm, ))
with act.sub_activity('restart_networking'): with act.sub_activity('restart_networking'):
restart_networking.apply_async(queue=queue, args=(vm, )) restart_networking.apply_async(queue=queue, args=(vm, ))
with act.sub_activity('change_password'): with act.sub_activity('change_password'):
...@@ -47,6 +50,10 @@ def agent_started(vm): ...@@ -47,6 +50,10 @@ def agent_started(vm):
pass pass
if not initialized: if not initialized:
send_init_commands(instance, act, vm) send_init_commands(instance, act, vm)
with act.sub_activity('start_ssh'):
queue = instance.get_remote_queue_name("agent")
start_ssh.apply_async(
queue=queue, args=(vm, ))
@celery.task @celery.task
......
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