def get_disk_bus_for_disk_dev(virt_type, disk_dev):
 if disk_dev.startswith('hd'):
  return 'ide'
 elif disk_dev.startswith('sd'):
  if (virt_type == 'xen'):
   return 'xen'
  else:
   return 'scsi'
 elif disk_dev.startswith('vd'):
  return 'virtio'
 elif disk_dev.startswith('fd'):
  return 'fdc'
 elif disk_dev.startswith('xvd'):
  return 'xen'
 elif disk_dev.startswith('ubd'):
  return 'uml'
 else:
  msg = (_("Unable to determine disk bus for '%s'") % disk_dev[:1])
  raise exception.InternalError(msg)

def get_disk_bus_for_disk_dev ( virt_type , disk_dev ) : if disk_dev . startswith ( 'hd' ) : return 'ide' elif disk_dev . startswith ( 'sd' ) : if ( virt_type == 'xen' ) : return 'xen' else : return 'scsi' elif disk_dev . startswith ( 'vd' ) : return 'virtio' elif disk_dev . startswith ( 'fd' ) : return 'fdc' elif disk_dev . startswith ( 'xvd' ) : return 'xen' elif disk_dev . startswith ( 'ubd' ) : return 'uml' else : msg = ( _ ( "Unable to determine disk bus for '%s'" ) % disk_dev [ : 1 ] ) raise exception . InternalError ( msg )
determine the disk bus for a disk dev .