def _create_kernel_image(context, session, instance, name_label, image_id, image_type):
 if CONF.xenserver.independent_compute:
  raise exception.NotSupportedWithOption(operation='Non-VHD images', option='CONF.xenserver.independent_compute')
 filename = ''
 if (CONF.xenserver.cache_images != 'none'):
  args = {}
  args['cached-image'] = image_id
  args['new-image-uuid'] = uuidutils.generate_uuid()
  filename = session.call_plugin('kernel.py', 'create_kernel_ramdisk', args)
 if (filename == ''):
  return _fetch_disk_image(context, session, instance, name_label, image_id, image_type)
 else:
  vdi_type = ImageType.to_string(image_type)
  return {vdi_type: dict(uuid=None, file=filename)}

def _create_kernel_image ( context , session , instance , name_label , image_id , image_type ) : if CONF . xenserver . independent_compute : raise exception . NotSupportedWithOption ( operation = 'Non-VHD images' , option = 'CONF.xenserver.independent_compute' ) filename = '' if ( CONF . xenserver . cache_images != 'none' ) : args = { } args [ 'cached-image' ] = image_id args [ 'new-image-uuid' ] = uuidutils . generate_uuid ( ) filename = session . call_plugin ( 'kernel.py' , 'create_kernel_ramdisk' , args ) if ( filename == '' ) : return _fetch_disk_image ( context , session , instance , name_label , image_id , image_type ) else : vdi_type = ImageType . to_string ( image_type ) return { vdi_type : dict ( uuid = None , file = filename ) }
creates kernel/ramdisk file from the image stored in the cache .