Commit f408ecd0 by Szeberényi Imre

Fured fix

parent 840dd333
result_backend = 'amqp://'
task_result_expires = 300
result_expires = 300
timezone = 'utc'
timezone = 'UTC'
enable_utc = True
accept_content = ['json', 'pickle_v2']
accept_content = ['json', 'pickle_v2', 'pickle']
task_serializer = 'json'
result_serializer = 'pickle_v2'
task_store_errors_even_if_ignored = True
......
Defaults: cloud !requiretty
cloud ALL = (ALL) NOPASSWD: /usr/bin/ovs-ofctl, /usr/bin/ovs-vsctl, /sbin/ip link set *
......@@ -198,24 +198,31 @@ def create(vm_desc):
return vm_xml_dump
class shutdown(AbortableTask):
@celery.task(
name='vmdriver.shutdown',
bind=True,
base=AbortableTask,
time_limit=120,
)
@req_connection
@wrap_libvirtError
def shutdown(self, args):
""" Shutdown virtual machine (need ACPI support).
Return When domain is missiing.
This job is abortable:
AbortableAsyncResult(id="<<jobid>>").abort()
"""
time_limit = 120
@req_connection
def run(self, args):
from time import sleep
name, = args
logger.info("Shutdown started for vm: %s", name)
try:
# VM lookup
domain = lookupByName(name)
logger.info("%s domain found in shutdown", name)
# ACPI shutdown
domain.shutdown()
logger.info("Domain shutdown called for vm: %s", name)
# Wait for disappearance
while True:
try:
Connection.get().lookupByName(name)
......@@ -234,7 +241,6 @@ class shutdown(AbortableTask):
new_e.libvirtError = True
raise new_e
@celery.task
@req_connection
@wrap_libvirtError
......
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