def _gen_vol_xml(vmname,
                 diskname,
                 disktype,
                 size,
                 pool):
    '''
    Generate the XML string to define a libvirt storage volume
    '''
    size = int(size) * 1024  # MB
    context = {
        'name': vmname,
        'filename': '{0}.{1}'.format(diskname, disktype),
        'volname': diskname,
        'disktype': disktype,
        'size': six.text_type(size),
        'pool': pool,
    }
    fn_ = 'libvirt_volume.jinja'
    try:
        template = JINJA.get_template(fn_)
    except jinja2.exceptions.TemplateNotFound:
        log.error('Could not load template %s', fn_)
        return ''
    return template.render(**context)
def _gen_vol_xml ( vmname , diskname , disktype , size , pool ) : size = int ( size ) * 1024 context = { 'name' : vmname , 'filename' : '{0}.{1}' . format ( diskname , disktype ) , 'volname' : diskname , 'disktype' : disktype , 'size' : six . text_type ( size ) , 'pool' : pool , } fn_ = 'libvirt_volume.jinja' try : template = JINJA . get_template ( fn_ ) except jinja2 . exceptions . TemplateNotFound : log . error ( 'Could not load template %s' , fn_ ) return '' return template . render ( ** context )
Generate the XML string to define a libvirt storage volume