utils - Miscellaneous Utilities¶
QEMU development and testing utilities
This package provides a small handful of utilities for performing various tasks not directly related to the launching of a VM.
- qemu.utils.get_info_usernet_hostfwd_port(info_usernet_output: str) → Optional[int][source]¶
Returns the port given to the hostfwd parameter via info usernet
- Parameters
info_usernet_output – output generated by hmp command “info usernet”
- Returns
the port number allocated by the hostfwd option
- qemu.utils.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.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.tcg_available(qemu_bin: str) → bool[source]¶
Check if TCG is available.
@param qemu_bin (str): path to the QEMU binary