def domain_xml(identifier, xml, disk_path):
    """Fills the XML file with the required fields.

     * name
     * uuid
     * devices

    """
    domain = etree.fromstring(xml)

    subelement(domain, './/name', 'name', identifier)
    subelement(domain, './/uuid', 'uuid', identifier)
    devices = subelement(domain, './/devices', 'devices', None)
    disk = subelement(devices, './/disk', 'disk', None, type='file', device='disk')
    subelement(disk, './/source', 'source', None, file=disk_path)

    return etree.tostring(domain).decode('utf-8')
def domain_xml ( identifier , xml , disk_path ) : domain = etree . fromstring ( xml ) subelement ( domain , './/name' , 'name' , identifier ) subelement ( domain , './/uuid' , 'uuid' , identifier ) devices = subelement ( domain , './/devices' , 'devices' , None ) disk = subelement ( devices , './/disk' , 'disk' , None , type = 'file' , device = 'disk' ) subelement ( disk , './/source' , 'source' , None , file = disk_path ) return etree . tostring ( domain ) . decode ( 'utf-8' )
Fills the XML file with the required fields.

     * name
     * uuid
     * devices