Commit 62b131b4 by Szeberényi Imre

..celery: Queue and Exchange names are generated from host name

vmdriver: raw data can contain an XML tree.
parent bf0de0cc
......@@ -41,6 +41,6 @@ celery.conf.update(
CELERY_TASK_RESULT_EXPIRES=300,
CELERY_QUEUES=(
Queue(HOSTNAME, Exchange(
'netdriver', type='direct'), routing_key="netdriver"),
HOSTNAME, type='direct'), routing_key=HOSTNAME),
)
)
......@@ -92,8 +92,14 @@ class VMInstance:
'type': self.vm_type
})
# Building raw data into xml
# Raw data may contain a tree or a single element
if self.raw_data:
xml_top.append(ET.fromstring(self.raw_data))
raw_data = ET.fromstring(self.raw_data)
if len(raw_data):
for child in raw_data:
xml_top.append(child)
else:
xml_top.append(raw_data)
# Basic virtual machine paramaters
ET.SubElement(xml_top, 'name').text = self.name
ET.SubElement(xml_top, 'vcpu').text = str(self.vcpu)
......
......@@ -46,6 +46,6 @@ celery.conf.update(
CELERY_TASK_RESULT_EXPIRES=300,
CELERY_QUEUES=(
Queue(HOSTNAME, Exchange(
'vmdriver', type='direct'), routing_key="vmdriver"),
HOSTNAME, type='direct'), routing_key=HOSTNAME),
)
)
......@@ -174,7 +174,7 @@ def create(vm_desc):
if vm.vm_type == "test":
vm.arch = "i686"
vm_xml_dump = vm.dump_xml()
logging.info(vm_xml_dump)
logging.debug(vm_xml_dump)
# Emulating DOMAIN_START_PAUSED FLAG behaviour on test driver
if vm.vm_type == "test":
Connection.get().createXML(
......@@ -186,6 +186,8 @@ def create(vm_desc):
Connection.get().createXML(
vm_xml_dump, libvirt.VIR_DOMAIN_START_PAUSED)
logging.info("Virtual machine %s is created from xml", vm.name)
""" What .. is this ?
# context
try:
sock = socket.create_connection(('127.0.0.1', 1235), 3)
......@@ -195,6 +197,7 @@ def create(vm_desc):
sock.close()
except socket.error:
logging.error('Unable to connect to context server')
"""
return vm_xml_dump
......
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