#!/usr/bin/python import libvirt conn = libvirt.open(None) xmlDefFile = open('./xendef2.xml', 'r') xmlDef = "" for line in xmlDefFile: xmlDef = xmlDef + (line.split('\n')[0]).strip() conn.createLinux(xmlDef, 0)