def _gen_vol_xml(vmname, diskname, size, hypervisor, **kwargs):
 size = (int(size) * 1024)
 disk_info = _get_image_info(hypervisor, vmname, **kwargs)
 context = {'name': vmname, 'filename': '{0}.{1}'.format(diskname, disk_info['disktype']), 'volname': diskname, 'disktype': disk_info['disktype'], 'size': str(size), 'pool': disk_info['pool']}
 fn_ = 'libvirt_volume.jinja'
 try:
  template = JINJA.get_template(fn_)
 except jinja2.exceptions.TemplateNotFound:
  log.error('Could not load template {0}'.format(fn_))
  return ''
 return template.render(**context)

def _gen_vol_xml ( vmname , diskname , size , hypervisor , ** kwargs ) : size = ( int ( size ) * 1024 ) disk_info = _get_image_info ( hypervisor , vmname , ** kwargs ) context = { 'name' : vmname , 'filename' : '{0}.{1}' . format ( diskname , disk_info [ 'disktype' ] ) , 'volname' : diskname , 'disktype' : disk_info [ 'disktype' ] , 'size' : str ( size ) , 'pool' : disk_info [ 'pool' ] } fn_ = 'libvirt_volume.jinja' try : template = JINJA . get_template ( fn_ ) except jinja2 . exceptions . TemplateNotFound : log . error ( 'Could not load template {0}' . format ( fn_ ) ) return '' return template . render ( ** context )
generate the xml string to define a libvirt storage volume .