qemu.utils.accel module

QEMU accel module:

This module provides utilities for discover and check the availability of accelerators.

qemu.utils.accel.kvm_available(target_arch: Optional[str] = None, qemu_bin: Optional[str] = None)bool[source]
Check if KVM is available using the following heuristic:
  • Kernel module is present in the host;

  • Target and host arches don’t mismatch;

  • KVM is enabled in the QEMU binary.

@param target_arch (str): target architecture @param qemu_bin (str): path to the QEMU binary @return True if kvm is available, otherwise False.

qemu.utils.accel.list_accel(qemu_bin: str)List[str][source]

List accelerators enabled in the QEMU binary.

@param qemu_bin (str): path to the QEMU binary. @raise Exception: if failed to run qemu -accel help @return a list of accelerator names.

qemu.utils.accel.tcg_available(qemu_bin: str)bool[source]

Check if TCG is available.

@param qemu_bin (str): path to the QEMU binary