def determine_is_pv(session, vdi_ref, disk_image_type, os_type):
 LOG.debug(_('Looking up vdi %s for PV kernel'), vdi_ref)
 if (disk_image_type == ImageType.DISK_VHD):
  if (os_type == 'windows'):
   is_pv = False
  else:
   is_pv = True
 elif (disk_image_type == ImageType.DISK_RAW):
  with vdi_attached_here(session, vdi_ref, read_only=True) as dev:
   is_pv = _is_vdi_pv(dev)
 elif (disk_image_type == ImageType.DISK):
  is_pv = True
 elif (disk_image_type == ImageType.DISK_ISO):
  is_pv = False
 elif (not disk_image_type):
  LOG.warning((_('Image format is None: trying to determine PV status using pygrub; if instance with vdi %s does not boot correctly, try with image metadata.') % vdi_ref))
  with vdi_attached_here(session, vdi_ref, read_only=True) as dev:
   is_pv = _is_vdi_pv(dev)
 else:
  msg = (_('Unknown image format %(disk_image_type)s') % locals())
  raise exception.NovaException(msg)
 return is_pv

def determine_is_pv ( session , vdi_ref , disk_image_type , os_type ) : LOG . debug ( _ ( 'Looking up vdi %s for PV kernel' ) , vdi_ref ) if ( disk_image_type == ImageType . DISK_VHD ) : if ( os_type == 'windows' ) : is_pv = False else : is_pv = True elif ( disk_image_type == ImageType . DISK_RAW ) : with vdi_attached_here ( session , vdi_ref , read_only = True ) as dev : is_pv = _is_vdi_pv ( dev ) elif ( disk_image_type == ImageType . DISK ) : is_pv = True elif ( disk_image_type == ImageType . DISK_ISO ) : is_pv = False elif ( not disk_image_type ) : LOG . warning ( ( _ ( 'Image format is None: trying to determine PV status using pygrub; if instance with vdi %s does not boot correctly, try with image metadata.' ) % vdi_ref ) ) with vdi_attached_here ( session , vdi_ref , read_only = True ) as dev : is_pv = _is_vdi_pv ( dev ) else : msg = ( _ ( 'Unknown image format %(disk_image_type)s' ) % locals ( ) ) raise exception . NovaException ( msg ) return is_pv
determine whether the vm will use a paravirtualized kernel or if it will use hardware virtualization .