def IsValidDiskAccessModeCombination(hv, disk_template, mode):
  if mode == constants.DISK_KERNELSPACE:
    return True

  if (hv == constants.HT_KVM and
      disk_template in constants.DTS_HAVE_ACCESS and
      mode == constants.DISK_USERSPACE):
    return True

  # Everything else:
  return False
Checks if an hypervisor can read a disk template with given mode.
dataset/ETHPy150Open ganeti/ganeti/lib/cmdlib/common.py/IsValidDiskAccessModeCombination