def determine_disk_image_type(image_meta):
 if (not image_meta.obj_attr_is_set('disk_format')):
  return None
 disk_format_map = {'ami': ImageType.DISK, 'aki': ImageType.KERNEL, 'ari': ImageType.RAMDISK, 'raw': ImageType.DISK_RAW, 'vhd': ImageType.DISK_VHD, 'iso': ImageType.DISK_ISO}
 try:
  image_type = disk_format_map[image_meta.disk_format]
 except KeyError:
  raise exception.InvalidDiskFormat(disk_format=image_meta.disk_format)
 LOG.debug('Detected %(type)s format for image %(image)s', {'type': ImageType.to_string(image_type), 'image': image_meta})
 return image_type

def determine_disk_image_type ( image_meta ) : if ( not image_meta . obj_attr_is_set ( 'disk_format' ) ) : return None disk_format_map = { 'ami' : ImageType . DISK , 'aki' : ImageType . KERNEL , 'ari' : ImageType . RAMDISK , 'raw' : ImageType . DISK_RAW , 'vhd' : ImageType . DISK_VHD , 'iso' : ImageType . DISK_ISO } try : image_type = disk_format_map [ image_meta . disk_format ] except KeyError : raise exception . InvalidDiskFormat ( disk_format = image_meta . disk_format ) LOG . debug ( 'Detected %(type)s format for image %(image)s' , { 'type' : ImageType . to_string ( image_type ) , 'image' : image_meta } ) return image_type
disk image types are used to determine where the kernel will reside within an image .