def prepare_domain_xml(domain_name, qemu_bin_path, nitro_image_path, open_vnc):
with open('template_domain.xml') as templ:
domain_xml = templ.read()
domain_xml = domain_xml.format(domain_name, qemu_bin_path,
nitro_image_path)
root = tree.fromstring(domain_xml)
if open_vnc:
# search for graphics element
graphics_elem = root.findall("./devices/graphics")[0]
graphics_elem.attrib['listen'] = '0.0.0.0'
domain_xml = tree.tostring(root).decode()
return domain_xml
return None
评论列表
文章目录