Commit e321cd88 by Szeberényi Imre

raw-data fix

parent 5c0d0529
......@@ -98,9 +98,12 @@ class VMInstance:
})
# Building raw data into xml
if self.raw_data:
raw_data = ET.fromstring("<raw_data>" + self.raw_data + "</raw_data>")
for child in raw_data:
xml_top.append(child)
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
if self.vcpu < self.vcpu_max and self.vcpu_max != 0:
......@@ -267,9 +270,9 @@ class VMDisk:
'name': self.driver_name,
'type': self.driver_type,
'cache': self.driver_cache})
metadata_cache = ET.SubElement(driver, 'metadata_cache')
ET.SubElement(metadata_cache, 'max_size',
attrib={'unit': 'KB'}).text = str(self.cache_size)
# metadata_cache = ET.SubElement(driver, 'metadata_cache')
# ET.SubElement(metadata_cache, 'max_size',
# attrib={'unit': 'KB'}).text = str(self.cache_size)
return xml_top
def dump_xml(self):
......
......@@ -11,7 +11,7 @@ import lxml.etree as ET
from psutil import cpu_count, virtual_memory, cpu_percent
from celery.contrib.abortable import AbortableTask
from vm import VMInstance, VMDisk, VMNetwork
from vmcelery import celery, lib_connection, to_bool
from vmcelery import celery, lib_connection, to_bool, HOSTNAME
from celery.utils.log import get_task_logger
sys.path.append(os.path.dirname(os.path.basename(__file__)))
......@@ -549,6 +549,9 @@ def migrate(name, host, live=False):
if live:
flags = flags | libvirt.VIR_MIGRATE_LIVE
domain = lookupByName(name)
if HOSTNAME.startswith(host):
return
# return _parse_info(domain.info())
domain.migrateToURI(
duri="qemu+tcp://" + host + "/system",
flags=flags,
......
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